Tool/software:
Hi,
When I am jumping from one application (boot loader) to a freeRTOS application, the xTaskCreate function is failing. The problem
seems to be with interrupt vector table. During the task creation it calls "BaseType_t xRunningPrivileged = prvRaisePrivilege();",
but I do not find the definition of "prvRaisePrivilege". This is supposed to be defined in "portASM.asm " as per below,
./source/os_mpu_wrappers.c:/* TCJ: check must be against zero, see prvRaisePrivilege in portASM.asm */
I could not find it in
github.com/.../portASM.asm
Here is my boot loader app's linker script contents:
MEMORY
{
VECTORS (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000020 /* Vector table */
BOOTLOADER (RX) : ORIGIN = 0x00000020, LENGTH = 0x0001FFE0 /* Bootloader code/data (128KB total including vectors) */
STACKS (RW) : ORIGIN = 0x08000000, LENGTH = 0x00001500
RAM (RW) : ORIGIN = 0x08001500, LENGTH = 0x0007EB00 /*0x00080000*/ /* 512KB RAM */
}
SECTIONS
{
.intvecs : > VECTORS
.text : > BOOTLOADER
.const : > BOOTLOADER
.cinit : > BOOTLOADER
.data : > RAM
.bss : > RAM
.stack : > RAM
.sysmem : > RAM
FEE_TEXT_SECTION : {} > BOOTLOADER
FEE_CONST_SECTION : {} > BOOTLOADER
FEE_DATA_SECTION : {} > RAM
}
Here is freeRTOS app linker script contents
MEMORY
{
VECTORS (X) : origin=0x00020000 length=0x00000020
KERNEL (RX) : origin=0x00020020 length=0x00008000
FLASH0 (RX) : origin=0x00028020 length=0x001D7FE0 /* 2MB - 0x8020 */
STACKS (RW) : origin=0x08000000 length=0x00000800
KRAM (RW) : origin=0x08000800 length=0x00000800
RAM (RW) : origin=(0x08000800+0x00000800) length=(0x0007F800 - 0x00000800)
}
SECTIONS
{
.intvecs : {} > VECTORS
.kernelTEXT align(32) : {} > KERNEL
.cinit align(32) : {} > KERNEL
.pinit align(32) : {} > KERNEL
.text align(32) : {} > FLASH0
.const align(32) : {} > FLASH0
.kernelBSS : {} > KRAM
.kernelHEAP : {} > RAM
.bss : {} > RAM
.data : {} > RAM
FEE_TEXT_SECTION : {} > FLASH0
FEE_CONST_SECTION : {} > FLASH0
FEE_DATA_SECTION : {} > RAM
}
Note - you can ignore FEE_ parameters. Without these parameters, I had the issue.
While searching I came across the below links,
e2e.ti.com/.../tms570lc4357-bootloader---appication---application-with-freertos-fails-on-task-creation
e2e.ti.com/.../tms570lc4357-bootloader-to-application-jump-leads-to-error
following first link, I changed the HL_sys_intvecs.asm file in boot loader app, to redirect the SVC interrupt to free RTOS vector, but actually it
is not able to find the definition for "prvRaisePrivilege". Please confirm if the HL_sys_intvecs.asm modifications are required.
Here is the HL_sys_intvecs.asm for boot loader:
.sect ".intvecs"
.arm
;-------------------------------------------------------------------------------
; import reference for interrupt routines
.ref _c_int00
.ref phantomInterrupt
.def resetEntry
;-------------------------------------------------------------------------------
; interrupt vectors
resetEntry
b _c_int00
undefEntry
b undefEntry
movw r0, #0xFFF8 ; Lower 16 bits of 0x0001FFF8
movt r0, #0x0001 ; Upper 16 bits of 0x0001FFF8
bx r0
svcEntry
; b svcEntry <---- replaced by below lines
; Load address 0x00020008 into r0
movw r0, #0x0008 ; Lower 16 bits
movt r0, #0x0002 ; Upper 16 bits -> 0x00020000
bx r0 ; Branch to application SWI handler
prefetchEntry
b prefetchEntry
dataEntry
b dataEntry
b phantomInterrupt
ldr pc,[pc,#-0x1b0]
ldr pc,[pc,#-0x1b0]
;-------------------------------------------------------------------------------
Note that, as I added additional instructions, I had to give additional space for the int. vectors in the boot loads, so
the linker script was modified as below,
MEMORY
{
VECTORS (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000040
BOOTLOADER (RX) : ORIGIN = 0x00000040, LENGTH = 0x0001FFC0
STACKS (RW) : ORIGIN = 0x08000000, LENGTH = 0x00001500
RAM (RW) : ORIGIN = 0x08001500, LENGTH = 0x0007EB00 /*0x00080000*/ /* 512KB RAM */
}
Here is the HL_sys_intvecs.asm for free RTOS app (I have not made any modification):
.sect ".intvecs"
.arm
;-------------------------------------------------------------------------------
; import reference for interrupt routines
.ref _c_int00
.ref vPortSWI
.ref phantomInterrupt
.def resetEntry
;-------------------------------------------------------------------------------
; interrupt vectors
resetEntry
b _c_int00
undefEntry
b undefEntry
b vPortSWI
prefetchEntry
b prefetchEntry
dataEntry
b dataEntry
b phantomInterrupt
ldr pc,[pc,#-0x1b0]
ldr pc,[pc,#-0x1b0]
;-------------------------------------------------------------------------------
Please help on resolving the above issue. Thanks in advance!