Makeblock-official / FreeRTOS-Arduino

A FreeRtos porting to arduino zero
9 stars 7 forks source link

compile problem #2

Open aduquer opened 8 years ago

aduquer commented 8 years ago

Hello

I have the follow verbose

/tmp/build8120234896648706583.tmp/FreeRTOS/port.c.o: In function xPortStartScheduler': /media/alejo/320efc47-e26f-41b6-ba4e-6fa1069d77fb/alejo/arduinos/arduino-1.6.4/libraries/FreeRtos/src/port.c:224: undefined reference tortosSysTick_Handler'

It seems to be trouble with tick handler

I am using Arduino 1.6.4 and compiling for Arduino Zero.

Thanks in advance

plcengineer commented 8 years ago

Hello aduquer,

I have modified my version of port.c like this:

" ... void (*rtosSysTick_Handler)(void);

int sysTickHook(void) { if (rtosSysTick_Handler) rtosSysTick_Handler(); return 0; // return zero to keep running the arduino default handler! }

BaseType_t xPortStartScheduler( void ) { rtosSysTick_Handler = &xPortSysTickHandler; /* Make PendSV, CallSV and SysTick the same priroity as the kernel. / (portNVIC_SYSPRI2) |= portNVIC_PENDSV_PRI; *(portNVIC_SYSPRI2) |= portNVIC_SYSTICK_PRI; ... "

I'm using the RTOS hock from the cortex_handlers.c file, to keep the default handler of arduino running.

BR

aduquer commented 8 years ago

Thanks. It works now. I dont know if you commit the code....

plcengineer commented 8 years ago

You're welcome... It's not the only change I had to made. I also had to change some details in the arduino libraries to keep it running smooth. E.g. the function delayMicroseconds from arduino freezes the scheduler... I replaced delay, delayMicroseconds and micros directly before I start the scheduler with corresponding functions of FreeRTOS libs.

A simple commit want help here :-( In the moment, I have no idea how to change things that I can keep the arduino files untouched.

My system running with 100µs base tick and 7 tasks for EIA485 communication on Serial1, remote control for power plug switching and some I/O handlings for home automation :-)

plcengineer commented 8 years ago

I branched this code and modified it here: https://github.com/plcengineer/FreeRTOS-Cortex-M0

You need to modify the functions delay and delayMicroseconds in the arduino libs to use this version. I changed it into pointers. In the moment the scheduler started up, I repoint the functions to FreeRtos functions. This way, it is also possible to delay microseconds without blocking the scheduler (like arduinos default function delayMicroseconds would do).