ARM Cortex-M - Static array dyamically allocated
Iain Buclaw
ibuclaw at gdcproject.org
Wed Dec 18 06:29:57 PST 2013
On 18 December 2013 14:14, Mike <none at none.com> wrote:
> 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
Hi Mike,
This has been fixed to not call any library routines, but has not been
backported to the 4.8 branch yet.
This is something that will be done before New Years (if my list of
things to do does not grow even more...)
More information about the D.gnu
mailing list