ARM Cortex-M - Static array dyamically allocated

Mike none at none.com
Wed Dec 18 06:14:11 PST 2013


I finally got a GDC cross-compiler built for the ARM Cortex-M, 
and it seems to generated executable code (code that can be 
executed).  I'm working on getting a *very* minimal D runtime so 
I can run a simple semihosted hello world program as I did with 
LDC here 
(http://wiki.dlang.org/Extremely_minimal_semihosted_%22Hello_World%22). 
  Please see the code there if you would like more context.

In my program, on this statement...

uint[3] message =
       [
	2, 			      //stderr
	cast(uint)"hello\r\n".ptr,    //ptr to string
	7                             //size of string
       ];

...GDC seems to generate a call to _d_arraycopy, which I've 
implemented, and another call to _d_arrayliteralTX, which I don't 
want to implement because it does a dynamic memory allocation.

I argue that this code should call neither _d_arraycopy, nor 
_d_arrayliteralTX because I believe everything should be known at 
compile time.

Is this a bug, by design, a temporary convenience?  Please advise 
and offer your suggestions?

Host: ArchLinux 64
arm-none-eabi-gdc (GCC) 4.8.2

Compilation: arm-none-eabi-gdc -march=armv7e-m -mcpu=cortex-m4 
-mtune=cortex-m4 -mthumb -fno-emit-moduleinfo -c 
-ffunction-sections -fno-exceptions -fdata-sections start.d 
object.d
Link: arm-none-eabi-ld -nodefaultlibs -nostdlib -nophoboslib 
-nostartfiles --gc-sections object.o start.o -o start.elf

Thanks,
Mike


More information about the D.gnu mailing list