您好!
我想知道如何正确配置启动序列、链接和引导应用、通过通信接口(UART、ETH 等)将应用加载到 RAM 中
对于我的用例、我希望实施自定义引导加载程序、以便能够将应用程序直接加载到 RAM、并跳转到应用程序入口点。
我更改了链接器并将应用的入口点移到了0x701B0000、以便可以从该地址加载 hello world 应用。 "hello world"应用程序会启动并正常工作、但一旦触发中断、便会崩溃。
因为我理解向量表出了问题、无法找到如何正确配置这些表的信息。 请指导我如何为本例配置启动序列和设置矢量表。
期待回复
/* This is the stack that is used by code running within main() * In case of NORTOS, * - This means all the code outside of ISR uses this stack * In case of FreeRTOS * - This means all the code until vTaskStartScheduler() is called in main() * uses this stack. * - After vTaskStartScheduler() each task created in FreeRTOS has its own stack */ --stack_size=16384 /* This is the heap size for malloc() API in NORTOS and FreeRTOS * This is also the heap used by pvPortMalloc in FreeRTOS */ --heap_size=32768 -e_vectors /* This is the entry of the application, _vector MUST be plabed starting address 0x0 */ /* This is the size of stack when R5 is in IRQ mode * In NORTOS, * - Here interrupt nesting is enabled * - This is the stack used by ISRs registered as type IRQ * In FreeRTOS, * - Here interrupt nesting is enabled * - This is stack that is used initally when a IRQ is received * - But then the mode is switched to SVC mode and SVC stack is used for all user ISR callbacks * - Hence in FreeRTOS, IRQ stack size is less and SVC stack size is more */ __IRQ_STACK_SIZE = 256; /* This is the size of stack when R5 is in IRQ mode * - In both NORTOS and FreeRTOS nesting is disabled for FIQ */ __FIQ_STACK_SIZE = 256; __SVC_STACK_SIZE = 4096; /* This is the size of stack when R5 is in SVC mode */ __ABORT_STACK_SIZE = 256; /* This is the size of stack when R5 is in ABORT mode */ __UNDEFINED_STACK_SIZE = 256; /* This is the size of stack when R5 is in UNDEF mode */ SECTIONS { /* This has the R5F boot code until MPU is enabled, this MUST be at a address < 0x80000000 * i.e this cannot be placed in DDR */ GROUP { .vectors:{} palign(8) .text.hwi: palign(8) .text.cache: palign(8) .text.mpu: palign(8) .text.boot: palign(8) .text:abort: palign(8) /* this helps in loading symbols when using XIP mode */ .text: {} palign(8) /* This is where code resides */ .rodata: {} palign(8) /* This is where const's go */ .data: {} palign(8) /* This is where initialized globals and static go */ .bss: {} palign(8) /* This is where uninitialized globals go */ RUN_START(__BSS_START) RUN_END(__BSS_END) .sysmem: {} palign(8) /* This is where the malloc heap goes */ .stack: {} palign(8) /* This is where the main() stack goes */ .irqstack: {. = . + __IRQ_STACK_SIZE;} align(8) RUN_START(__IRQ_STACK_START) RUN_END(__IRQ_STACK_END) .fiqstack: {. = . + __FIQ_STACK_SIZE;} align(8) RUN_START(__FIQ_STACK_START) RUN_END(__FIQ_STACK_END) .svcstack: {. = . + __SVC_STACK_SIZE;} align(8) RUN_START(__SVC_STACK_START) RUN_END(__SVC_STACK_END) .abortstack: {. = . + __ABORT_STACK_SIZE;} align(8) RUN_START(__ABORT_STACK_START) RUN_END(__ABORT_STACK_END) .undefinedstack: {. = . + __UNDEFINED_STACK_SIZE;} align(8) RUN_START(__UNDEFINED_STACK_START) RUN_END(__UNDEFINED_STACK_END) .ARM.exidx: {} palign(8) /* Needed for C++ exception handling */ .init_array: {} palign(8) /* Contains function pointers called before main */ .fini_array: {} palign(8) /* Contains function pointers called after main */ } > OCRAM } MEMORY { /*R5F_VECS : ORIGIN = 0x701B0000 , LENGTH = 0x00000040*/ /*R5F_TCMA : ORIGIN = 0x00000040 , LENGTH = 0x00007FC0*/ /*R5F_TCMB : ORIGIN = 0x00080000 , LENGTH = 0x00008000*/ /* when using multi-core application's i.e more than one R5F/M4F active, make sure * this memory does not overlap with other R5F's */ OCRAM : ORIGIN = 0x701B0000 , LENGTH = 0x40000 /* This section can be used to put XIP section of the application in flash, make sure this does not overlap with * other CPUs. Also make sure to add a MPU entry for this section and mark it as cached and code executable */ FLASH : ORIGIN = 0x60100000 , LENGTH = 0x80000 }