Need help making minimal bare metal ARM Cortex-M D program

Mike none at none.com
Sun Nov 24 04:42:59 PST 2013


I am very new to D, but I finally got my toolchain compiled and 
working.  I'm using LDC.  I failed with GDC and eventually gave 
up.

I am trying to get an _extremely_ minimal bare metal ARM Cortex-M 
HelloWorld-type program compiled and executed on my STM32F4-based 
hardware.  I know the toochain is buggy for arm right now, but 
I'm hoping I can do something about that if I can just get 
started.

Here's the basic C code and linker script for my hardware. It 
doesn't actually print "hello world".  I intend to add that after 
I get the following basic code compiled and downloaded to my 
hardware.

/***************************
* start.c
****************************/
// defined in linker script
extern unsigned long _stack_end;

void handler_reset(void)
{
   //Print hello world using SWI
}

__attribute__ ((section(".interrupt_vector")))
void (* const table_interrupt_vector[])(void) =
{
   (void *) &_stack_end,
   handler_reset
};

/***************************
* linkerscript.ld
****************************/
MEMORY
{
   CCRAM    (rxw) : ORIGIN = 0x10000000, LENGTH =   64k
   SRAM     (rxw) : ORIGIN = 0x20000000, LENGTH =  128k
   FLASH    (rx)  : ORIGIN = 0x08000000, LENGTH = 1024k
}

SECTIONS
{
.ccm (NOLOAD) :
	{
		. = ALIGN(4);
         *(.ccm)
		. = ALIGN(4);
	} >CCRAM
	
	stackTop = ORIGIN(CCRAM) + LENGTH(CCRAM);


More information about the Digitalmars-d mailing list