H8-38024 Port

dorianabs wrote on Friday, November 30, 2007:


I’m trying to make a port of FreeRTOS to a
Renesas H8-38024 microcontroller (H8-300L core)

There are two links of my stuff:

The code above seems to works (1 task only LedRun flash), but
when in my main application (handler.c), I add a second task
to flash a second led (LedFault), the microcontroller hangs.

The datasheet of that microcontroller is easly downloadable from:

My current version of the port (port.c,portmacro.h) is based on
R.Barry H8/S2329 port.

Can someone tell me what is wrong in my code ?

Thank you in advance,

rtel wrote on Sunday, December 02, 2007:

Are there any differences in the core between the 38024 and 2329?  That is, are the number, size and meaning of the registers the same?  The other thing that will effect success is the timer being used to generate the RTOS tick - is this the same between the two?

If everything is the same then it should just be a matter of ensuring the memory map is set correctly for the linker, and maybe adjusting the heap size.


dorianabs wrote on Sunday, December 02, 2007:

The 38024 uses H8-300 core, the 2329 uses H8S core. It is different, the first has
16bit register, the second 32bit. The number of registers are the same. The Tick ISR
was writed from scratch but i’ve tested it without freertos, same as memory map of
the linker. I think I’ve changed port.c portmacro.h following along with the datasheet.

Like I said, 1 task seems to run correcly, 2 tasks hangs the microcontroller, and sadly
I don’t know what is wrong …

Thanks for the support,

rtel wrote on Sunday, December 02, 2007:

So this is quite a different port then.  I cannot go through your code or datasheet as this will take a couple of days (I can send you a quote for the work if you like :o), but below are my suggestions for testing the new port.

I would suggest writing a task that fills the registers with known values (using inline asm), then calls taskYIELD(), then checks that all the registers still contain their known values (again using inline asm) - the registers should not have been altered across the call to taskYIELD().  Run this task with configUSE_PREEMPTION set to 0.

Once you have a single task running this way, create another task that does the same thing, but fills the registers with different values and run both tasks at once.  When both tasks are running you should have something like this:

1) Task A fills registers with known values and yields to task 2.
2) During the yield the Task A values are stored to the Task A context.
3) Task B runns and fills registers with different values, overwriting those filled by Task A.
4) Task B yields back to Task A.
5) During the yield, that Task B values are saved to the Task B context, and the Task A values are restored from the Task A context back into the registers.
6) Task A checks the registers hold the values it expects, flagging an error if not.
7) etc. etc.

Once you have both tasks running correct in this cooperative way, take out the call to task taskYIELD() and set the configUSE_PREEMPTION to 1, and check no errors are found when running preemptively.