Mark,
When you say you are loading and operating in SRAM, what exactly are you loading? Is this some code that exists as a standalone IAR project (meaning it includes the low level init stuff). The only thing I've done is update the linker script to put everything in RAM and then override the low_level_init.c code with my own where I update the SCB_VTOR
SCB_VTOR = (unsigned int) & __vector_table;
I jump to the code like so...
typedef void(*jumpFunc)(void);
uint8_t BootJump(uint32_t address)
{
/* Jump to whatever address user specifies */
jumpFunc jump = (jumpFunc)(address | 0x1);
jump();
//EnableInterrupts
return TRUE;
}
with address = 0x20000000
the contents of that address is the new stack pointer and when I jump to that address I get a hardfault. I want to use the upper SRAM to hold my ramcode and the lower SRAM is for my stack and heap with the stack pointer starting at 0x20000000.
Essentially what im trying to do is create a project i can use to build ramcode modules I can load and run at runtime. When I do this with the older processor expert (not sure if im saying this right, before KSDK I used codewarrior and a GNU compiler) code my startup function looks like this
__attribute__ ((section (".init"))) void startup(void)
{
extern unsigned int __vector_table[];
extern char __START_BSS[];
extern char __END_BSS[];
char * ptr = __START_BSS;
__DI();
/* Copy interrupts from flash to allow RAM code to install it's own handlers */
memcpy(__vector_table, (unsigned char *)ROM_VECTOR_LOCATION, VECTOR_TABLE_SIZE);
SCB_VTOR = (uint32_t)__vector_table; /* Set the interrupt vector table position */
// zero-fill the .bss section
while(ptr != __END_BSS)
{
*ptr++ = 0x00;
}
/* Enter main with interrupts disabled */
main();
/* Reset interrupt vectors to ROM */
SCB_VTOR = (uint32_t)ROM_VECTOR_LOCATION;
/* Return to bootloader */
}
IAR has hidden most of the startup code from me so I can't figure out where I need to initialize things.
Does any of this make sense? I'm having a hard time explaining what I'm trying to do.