Hi FreeRtos Team,
Is there any reference Freertos port code to CR-(4) series starup-cr4.s file and loader file. Need startup.s file with details of all interupts related to scheduling and systick interupt handlers? also need to have stack pointed initialization code with memory details in it.
If any port code of FreeRtos with example would be great help
Hi Gaurav,
Thanks for the response, In shared code of portasm.s file, it doesn’t contain details of Vector table changes for scheduler, timers.
I was looking for some assembly startup code containing below things:-
ResetHandler(Tr_Reset) api calling main application
Also having interrupt vector table with below changes, as i heard that default scheduler api’s doesn’t help in scheduling and starting of newly created task.
a) Make default system scheduler handler to be replaced to FreeRtos scheduler api(FreeRTOS_IRQ_Handler, FreeRTOS_SVC_Handler)
b) system timer to be replaced with PMU timer of R4
Having ResetHandler code with stackPointer initialization and memory allocation
If any code with above few points included would be of great help for us
Hi Gaurav,
Thanks for the response.
I have below follow up question:-
only Api “FreeRTOS_SVC_Handler” is sufficient for scheduling? or any other api’s to be added as part of scheduling like for ex:- in CM4 chip, api’s xPortPendSVHandler, vPortSVCHandler are added by one of our team member
Do we have any code for mapping timer tick or should we use default system time ticks? For CM4 one of our team member faced scheduler issue hence they have to use different timer interupt like interruptvector_TIMER2_DONE
For ARM_CRx_No_GIC how do we know if our chip has EndOfInterupt register?
ulICCEOIR = configEOI_ADDRESS;
Hi Gaurav,
WE are porting the FreeRtos for Cr4 without GIC, so should we use “ARM_CRx_No_GIC” target?
I am getting below error’s for Vpush, Vpop instruction and also for Floating point instruction like fmrx, vmsr in portASM.S and port.c file. Do we have any equivalent instructions or any workaround we can do for this ? i tried with some solutions like -mfpu=vfpv3-d16 option in makefile but those didn’t solve the issue.
FreeRTOS-Kernel-11.1.0/portable/GCC/ARM_CRx_No_GIC/portASM.S:137: Error: selected processor does not support fmrxne R1,FPSCR' in ARM mode FreeRTOS-Kernel-11.1.0/portable/GCC/ARM_CRx_No_GIC/portASM.S:137: Error: selected processor does not support vpushne {D0-D15}’ in ARM mode
FreeRTOS-Kernel-11.1.0/portable/GCC/ARM_CRx_No_GIC/portASM.S:140: Error: selected processor does not support vpopne {D0-D15}' in ARM mode FreeRTOS-Kernel-11.1.0/portable/GCC/ARM_CRx_No_GIC/portASM.S:140: Error: selected processor does not support vmsrne FPSCR,R0’ in ARM mode
FreeRTOS-Kernel-11.1.0/portable/GCC/ARM_CRx_No_GIC/portASM.S:151: Error: selected processor does not support `vpopne {D0-D15}’
Do we have any cr4 porting guide to see what all changes to be done and what code to be included and flags?
i could see that we are providing that option but even though in our code we mention our asm code as ".arm "instructions. So i tried even by removing that flag but still getting same error
Hi Gaurav,
Adding below option has solved the above error.
q1) But are we supposed to use only softfp or both softfp and hardfp instructions? how can we check it?
-mfloat-abi=softfp -mfpu=vfpv3-d16
q3) Also i see undefined function vApplicationIRQHandler in ARM_CRx_No_GIC/portASM.S:249.
i don’t see definition of this function when grepped the code. Can we add this in our application main to handle required interupts? if yes can i get any reference code of this?
q4) Do we have any reference on where to map this below label in interupt table? like the exact index to add this to
svcEntry:
b FreeRTOS_SVC_Handler
q1)you mean for below option as softfp is not a correct solution?
-mfloat-abi=softfp
For hard option i see the error as below. Not sure if its issue related to libgcc.a i am using?
/data/si/ARM_Files/hndtools-armeabi-6.3.1/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld: error: build/mhd_bt_mcu_43711.elf uses VFP register arguments, /data/si/ARM_Files/hndtools-armeabi-6.3.1/bin/../lib/gcc/arm-none-eabi/6.3.1/thumb/v7-ar/libgcc.a(_udivmoddi4.o) does not
/data/si/ARM_Files/hndtools-armeabi-6.3.1/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /data/si/ARM_Files/hndtools-armeabi-6.3.1/bin/../lib/gcc/arm-none-eabi/6.3.1/thumb/v7-ar/libgcc.a(_udivmoddi4.o)
/data/si/ARM_Files/hndtools-armeabi-6.3.1/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld: error: build/mhd_bt_mcu_43711.elf uses VFP register arguments, /data/si/ARM_Files/hndtools-armeabi-6.3.1/arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) does not
/data/si/ARM_Files/hndtools-armeabi-6.3.1/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /data/si/ARM_Files/hndtools-armeabi-6.3.1/arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o)
/data/si/ARM_Files/hndtools-armeabi-6.3.1/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld: error: build/mhd_bt_mcu_43711.elf uses VFP register arguments, /data/si/ARM_Files/hndtools-armeabi-6.3.1/arm-none-eabi/lib/thumb/libc.a(lib_a-memset.o) does not
/data/si/ARM_Files/hndtools-armeabi-6.3.1/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /data/si/ARM_Files/hndtools-armeabi-6.3.1/arm-none-eabi/lib/thumb/libc.a(lib_a-memset.o)
q2) Do we have any reference on where to map this below label in interupt table? like the exact index to add this to
svcEntry:
b FreeRTOS_SVC_Handler
HI Gaurav,
q1) Our Cr4 chip doesn’t support the fpu but supports mpu so using below options if fine then?
-mfloat-abi=softfp -mfpu=vfpv3-d16
q2) Do we have any reference on where to map this below label in interupt table? like the exact index to add this to
svcEntry:
b FreeRTOS_SVC_Handler
The port uses FPU registers. You probably need to guard the FPU parts in the port with #if ( configENABLE_FPU == 1 ) and then set configENABLE_FPU to 0 in your FreeRTOSConfig.h.
Hi Gaurav,
As suggested by you, i have disabled the FPU code by putting in the configENABLE_FPU flag.
Then removed the flags -mfloat-abi=softfp -mfpu=vfpv3-d16.
Q1) Hope this is what you had suggested me right?
Q2) I see one api “xPortPendSVHandler” in CM4 for task switching, is there any equivalent api in CR4 for this?
Q3) Currently i can see that my application static task(xTaskCreateStatic) is getting added to ready list(prvAddNewTaskToReadyList) but while scheduling the task(vTaskStartScheduler), the code enters vPortRestoreTaskContext and here when accesing the taskControlBlock(pxCurrentTCBConst), the code jumps to “prvTaskExitError”, i have check that we are in Supervisor Mode (0x13). Is there anything we need to do for task to start the exectuion using TCB.
Q1) Where did you put this flag? Did you update the FreeRTOS port code?
i have defined FPU code under configUSE_TASK_FPU_SUPPORT and set it to zero.
2) the FVP code was present in port.c and portAsm.s(for this asm file i have added the flag __ARM_FP)
Q2) Do you have a task which exits without calling vTaskDelete
As of now i have only one task creating in application, other two tasks are Timer and idle task which are handled by FreeRtos Code. So in application task i haven’t made any change which is same as FreeRtos code. is there any thing i need to add to application file? have attached the file for reference main.c (5.5 KB)
Q3) I see one api “xPortPendSVHandler” in CM4 for task switching, is there any equivalent api in CR4 for this? if this api not required then task switching happens automatically in CR4?
Hi Gaurav,
Thanks for the response.
If code works yes i can do raise a PR. But we need to make the code to get to working stage.
For your query related to switching to prvTaskExitError, below is my code and the pc points to addr “202db4” below and then when i give step instruction in gdb, pc jumps to prvTaskExitError. This is what i am observing now. Let me know your thoughts on this.