Trouble with Cortex-M "Hello World"

Jens Bauer via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 31 19:01:44 PDT 2015


On Tuesday, 31 March 2015 at 15:50:17 UTC, Dan Olson wrote:
> "Mike" <none at none.com> writes:
>> I just cut and pasted the code from the wiki myself and 
>> compiled with
>> my arm-none-eabi-gdc cross-compiler and it works fine.  I'm 
>> sorry, but I'm not sure what the problem could be.
>>
>> Mike
>
> Yeah, something strange.  The start.d on the webpage compiles 
> fine for me too.  I am using LDC as cross compiler to ARM, but 
> you should also be able to compile start.d fine with regular 
> dmd too even though it can't target ARM.
>
> It is as if your message array declaration line is being read by
> compiler as:
>
>     uint[0] message =

I've also tried putting it all on one line, but that didn't help:

src/start.d:46:12: error: mismatched array lengths, 0 and 3
      uint[3]message=[2,cast(uint)"hello\r\n".ptr,7];
             ^

-So it's not because there's a problem with spaces, tabs and 
linefeeds.

>>> When I change the square brackets to parantheses, the error 
>>> goes
>>> away, but I'm not sure that is the correct fix ?
>
> Changing the square brackets to parens is doing something 
> different.
> You do want the square brackets.

I expected that. :)

Thank you both Mike and Dan for the replies.

This could be something related to big endian issues, as my 
compiler is hosted on a big endian machine (PowerMac G5). Note: 
Just in case it's important; I'm using GCC+GDC, not LLVM+LDC.

I hope I'll be able to make a build on my CubieBoard2, so I can 
try the test there.


More information about the Digitalmars-d mailing list