|
Read-Only
Author Jason F
Posted 30-Nov-2011 20:43 GMT
Toolset ARM
|
 Cortex-M1 and bootloading into RTX app
Jason F
I have a Cortex-M1 system in an FPGA. I have 2KB of code that is
mapped at address 0x0. It contains the vector table, code to load the
SDRAM with application code from serial flash, and code to overwrite
the vector table with the address of the application interrupts and
the handlers for SVC, PendSV, and SysTick.
I can get this bootloader to work correctly with a non RTX
application. But, if I use this simple RTX, my code sets a bit on the
LCD outputs and then crashes in the os_sys_init(task_start) routine.
My debugger gives me the error "Cannot stop Cortex-M device" and
exits.
__task void task_agui_handler(void);
__task void task_start (void) ;
static U64 agui_stack[2048/8];
OS_TID task_ids[1];
int main (void)
{
LCD_SET = 0x00000001;
os_sys_init(task_start);
while(1)
{}
}
__task void task_start (void)
{
LCD_SET = 0x00000002;
task_ids[0]=os_tsk_create_user(task_agui_handler,2,&agui_stack,sizeof(agui_stack));
if(!task_ids[0])
{
while(1){};
}
os_evt_set(0x0001,task_ids[0]);
os_tsk_delete_self();
}
__task void task_agui_handler (void)
{
OS_RESULT result;
LCD_SET = 0x00000004;
while(1)
{
result = os_evt_wait_and(0x1,0xFFFF);
switch(result)
{
case OS_R_EVT: occurred
LCD_SET = 0x00000008;
break;
case OS_R_TMO: // code should never get here (time out occurred during wait for event)
break;
default: // code should never get here
break;
}
os_tsk_pass();
}
}
Is there something that looks wrong?
|
|
Read-Only
Author Jason F
Posted 2-Dec-2011 14:39 GMT
Toolset ARM
|
 RE: Cortex-M1 and bootloading into RTX app
Jason F
There is no VTOR on the Cortex-M1. I was able to discover that the
problem is with the RTX-code running from external RAM. If I use the
same bootloader, but put the RTX code into ITCM, everything works
just fine. I'm guessing this was never tested.
|
|
Read-Only
Author Marc Crandall
Posted 2-Dec-2011 15:14 GMT
Toolset ARM
|
 RE: Cortex-M1 and bootloading into RTX app
Marc Crandall
Sorry, I didn't read your post carefully enough. I'm not sure why
it isn't working from the external RAM I don't see any reason why it
shouldn't? Is there a max jump distance for the interrupt
vectors?
|
|
Read-Only
Author Jason F
Posted 2-Dec-2011 15:17 GMT
Toolset ARM
|
 RE: Cortex-M1 and bootloading into RTX app
Jason F
The hardware interrupts work fine and also the RTX when used
without the os_evt_wait() functions. Only when these wait functions
are used is there issues. So I don't think that is the issue either.
There is a difference in read latency from external memory compared
to the ITCM. The ITCM execute in 1 cycle and the external memory I
believe is about 3.
|