Trouble with Cortex-M "Hello World"

Jens Bauer via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 31 03:39:04 PDT 2015


Encouraged by Timo Sintonen's great posts, I decided to spend 
some time trying to build a Cortex-M toolchain for D-programming.
So this morning, I've successfully built my first toolchain 
supporting C, C++ and D for the first time.
I wanted to take the new language out for a spin, but I ran into 
some trouble...

Referring to the tutorial on this page:
<http://wiki.dlang.org/Minimal_semihosted_ARM_Cortex-M_%22Hello_World%22>

-I'm getting the following error:

start.d:45:11: error: mismatched array lengths, 0 and 3
    uint[3] message =
            ^

... for this part of the code:

void OnReset()
{
	while(true)
	{
		// Create semihosting message
		uint[3] message =
			[
				2,							// stderr
				cast(uint)"hello\r\n".ptr,	// ptr to string
				7							// size of string
			];
		// Send semihosting command
		SendCommand(0x05, &message);
	}
}

... I've carefully checked the code, but found no difference. Is 
this the expected behaviour ?
When I change the square brackets to parantheses, the error goes 
away, but I'm not sure that is the correct fix ?


More information about the Digitalmars-d mailing list