STR912 issue (eclipse + gcc + hitex)

cpelissi wrote on Tuesday, December 04, 2007:

Hello everybody,

I have trouble in using SRT912 and FreeRTOS. I am using the STR9 USB stick coming from Hitex. Normally, it should be quite straightforward to run freeRTOS on the stick due to the already existing port for the STR912 dev board on IAR dev tools. But for me it doesn’t.

The Hitex USB stick is coming with the GNU cross-compiler and the hitex IDE and debugger. Due to some stability issues in using the Hitex tools. I am not sure to still use the Hitex debugger in the future. For this reason, i try to set up my configuration right now using eclipse + mingw make + gnu compiler provide by hitex. For sure I still use Hitex debugger to flash and make bug tracking.

I have rewritten the asm file of the STR912 demo from IAR asm to GNU asm. And wrote a make file with an application which do nothing except launching the idle task. I was hopping to be able see this task running alone.
To avoid ARM-thumb switching issue all the code is compiled for ARM code today.

Stepping in my application seems to be OK until vTaskStartScheduler()->xPortStartScheduler()->vPortStartFirstTask();   

As it has been designed this function is just a call to the macro portRESTORE_CONTEXT
At the end of this macro, just before jumping, every thing seems to be OK…
the registers are correctly initialized (R1=0101…, R2=0202… and so on)
The LR register has the address of the idle task + 4…
We are in supervisor mode…
But stepping the "subs" instruction is issuing an Undefined instruction exception. I do not understand why.

If someone has already faced with this problem I greatly seek its support.


davedoors wrote on Wednesday, December 05, 2007:

It sounds like you have everything in the expected state.  Particularly the Supervisor mode, I thought this was going to be your problem until I got to the bottom of your email.

Can you check that you don’t have THUMB_INTERWORK defined in your makefile (as -DTHUMB_INTERWORK).  Also, is the address in the LR on a four byte boundary?

cpelissi wrote on Wednesday, December 05, 2007:

Thanks Dave for your message!

i have double checked. i am sure that :
- i am in supervisor mode,
- i am not using the THUMB_INTERWORK define
- the address in the LR register is clearly on a 4 byte boundary and this address is the prvIdleTask function + 4

I have made several searches on this forum and on the web. i have seen that there is a pending issue on GCC compiler which gives unsafe behaviour to the portSAVE_CONTEXT function. but i think (maybe i am wrong) that my problem is not in relation with this issue.

To be sure i have transformed the C definition portSAVE_CONTEXT portRESTORE_CONTEXT into assembleur macro. This will avoid the compiler to perform unsafe coding.
the opcode i have on my debugger is exactly the one written in the macro file

I still searching…