I have some issues with Keil RTX on NXP LPC11U14 ARM Cortex M0. It is uC with 4k SRAM and 2kb USB. I am running this piece of code in main.c:
#include "LPC11Uxx.h" #include "gpio.h" #include "RTL.h" OS_TID tsk1; extern volatile uint32_t timer32_0_counter[4]; __task void task1(void){ tsk1 = os_tsk_self(); while(1){ GPIOSetBitValue(0, 7, 1); os_dly_wait (10000); GPIOSetBitValue(0, 7, 0); } } int main (void) { SystemInit(); /* Set clock to Crystal(12MHz) */ LPC_SYSCON->CLKOUTSEL = 0x3; LPC_SYSCON->CLKOUTUEN = 0x0; LPC_SYSCON->CLKOUTUEN = 0x1; LPC_SYSCON->CLKOUTDIV = 0x1; LPC_IOCON->PIO0_1 ^= 0x1; /* Divide clk by 1 */ LPC_SYSCON->SYSAHBCLKDIV = 1; LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6); LPC_SYSCON->SYSAHBCLKCTRL |= (1<<9); //init_timer32(0, 12000); //enable_timer32(0); /* Enable AHB clock to the GPIO domain. */ /* Set port 0_7 to output */ GPIOSetDir( 0, 7, 0 ); os_sys_init (task1); while (1) { } }
RTXConfig.c looks like:
#include <RTL.h> #ifndef OS_TASKCNT #define OS_TASKCNT 1 #endif #ifndef OS_PRIVCNT #define OS_PRIVCNT 0 #endif #ifndef OS_STKSIZE #define OS_STKSIZE 128 #endif #ifndef OS_STKCHECK #define OS_STKCHECK 1 #endif #ifndef OS_RUNPRIV #define OS_RUNPRIV 0 #endif #ifndef OS_TIMER #define OS_TIMER 0 #endif #ifndef OS_CLOCK #define OS_CLOCK 60000000 #endif #ifndef OS_TICK #define OS_TICK 10000 #endif // Enable Round-Robin Task switching. #ifndef OS_ROBIN #define OS_ROBIN 1 #endif #ifndef OS_ROBINTOUT #define OS_ROBINTOUT 5 #endif #ifndef OS_TIMERCNT #define OS_TIMERCNT 0 #endif #ifndef OS_FIFOSZ #define OS_FIFOSZ 16 #endif #ifndef OS_MUTEXCNT #define OS_MUTEXCNT 8 #endif
Here is what i got after i rebuild it: Program Size: Code=6788 RO-data=268 RW-data=208 ZI-data=2184
But when i change the maximum number of concurrent running tasks(only that) from 1 to 6 i.e. i get this: Program Size: Code=6788 RO-data=268 RW-data=204 ZI-data=5532
However, in RTX Memory requirements says that maximum RAM space for a task is TaskStackSize + 52 Bytes, my stack size is 128 bytes, so for additional 5 tasks i should spend only 5*(128+52)=900 bytes more, not 3344 more.
What am I missing?
Thank you very much on your answer!
Best Regards! Predrag Pejic.