TMS570 port patch for non preemtive scheduler

emab73 wrote on Thursday, May 09, 2013:

Hi, I want to use FreeRTOS in a Hercules TMS570 with CCSv5, and I used this port ->

When I configured the FreeRTOS scheduler as non-preemptive I got compilation and semantic errors. My fix of these errors is attached.

Please, let me know if my changes are correct.

Thanks in advance!

diff -Naur CORTEX_R4_RM48_TMS570_CCS5-original/FreeRTOS/portable/CCS/ARM_Cortex-R4/port.c CORTEX_R4_RM48_TMS570_CCS5/FreeRTOS/portable/CCS/ARM_Cortex-R4/port.c
--- CORTEX_R4_RM48_TMS570_CCS5-original/FreeRTOS/portable/CCS/ARM_Cortex-R4/port.c	2013-04-30 22:04:48.000000000 -0300are
+++ CORTEX_R4_RM48_TMS570_CCS5/FreeRTOS/portable/CCS/ARM_Cortex-R4/port.c	2013-05-09 16:23:15.285074598 -0300
@@ -279,7 +279,8 @@
 	__interrupt void vPortNonPreemptiveTick( void )
 		/* clear clock interrupt flag */
-		RTI->INTFLAG = 0x00000001;
+		portRTI_INTFLAG_REG = 0x00000001;
 		/* Increment the tick count - this may make a delaying task ready
 		to run - but a context switch is not performed. */
diff -Naur CORTEX_R4_RM48_TMS570_CCS5-original/FreeRTOSConfig.h CORTEX_R4_RM48_TMS570_CCS5/FreeRTOSConfig.h
--- CORTEX_R4_RM48_TMS570_CCS5-original/FreeRTOSConfig.h	2013-05-07 11:11:00.000000000 -0300
+++ CORTEX_R4_RM48_TMS570_CCS5/FreeRTOSConfig.h	2013-05-09 16:22:54.238407769 -0300
@@ -95,7 +95,7 @@
  * See
-#define configUSE_PREEMPTION					1
+#define configUSE_PREEMPTION					0
 #define configUSE_IDLE_HOOK			  			1
 #define configUSE_TICK_HOOK			  			1
diff -Naur CORTEX_R4_RM48_TMS570_CCS5-original/startup/sys_startup.c CORTEX_R4_RM48_TMS570_CCS5/startup/sys_startup.c
--- CORTEX_R4_RM48_TMS570_CCS5-original/startup/sys_startup.c	2012-10-18 15:37:00.000000000 -0300
+++ CORTEX_R4_RM48_TMS570_CCS5/startup/sys_startup.c	2013-05-09 16:23:01.068407822 -0300
@@ -43,7 +43,11 @@
+#if configUSE_PREEMPTION == 1
     vPortPreemptiveTick,		/* RTI */
+    vPortNonPreemptiveTick,

rtel wrote on Friday, May 10, 2013:

Thanks for taking the time to point this out, I can confirm your finding and have added it to the known issues list.  I have tested this compiles but not that it runs so please let me know if more than just this one line change is required.


emab73 wrote on Friday, May 10, 2013:

Thanks Richard,

   please note that the fix includes also a change in the interrupts vector (it seems you forgot to mention it in the known issues list), which is the last in the patch.
FWIW, it runs for me.

BTW, do you know who did this port, so I can check with him/her about this fix? The author is not named in the files.


rtel wrote on Friday, May 10, 2013:

I updated the known issue to include a note about replacing the installed vector too.

do you know who did this port