FreeRTOS on HCS08

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeRTOS on HCS08

43,586 Views
jeffw
Contributor I
I've ported FreeRTOS to HCS08, and the project targets the SARD and EVB boards. I'm working on making SMAC compatible with this project.

Steps

1. Download and install FreeRTOS 3.2.4: FreeRTOS
2. Download the attached zip file
3. Unpack it into a temporary directory.
4. Following the FreeRTOS directory structure, move the sub-folders into their correct places.
5. Open the RTOSDemo.mcp project in CW 3.1.
6. Deploy to a Freescale SARD or EVB.

FreeRTOS-3.2.4-HCS08_Files.zip
Message Edited by dkindler on 2009-08-20 02:33 PM
Labels (1)
0 Kudos
Reply
149 Replies

920 Views
BlackNight
NXP Employee
NXP Employee

I actually never use a RAM target. Simply because this is not how the product will end up at the end.

Yes, it might be useful to test things quickly, but that's it. It only will work for small things (I usually have targets with few KByte of RAM). Yes, a 52259 has much more RAM, but at the end I'll have the application anyway in flash too.

Just my one cent.

 

Adding a P&E ML connection to the example makes sense. Adding a connection is rather simple as well (once you know what to do):

- add a new launch config, set up project/binary.

- as system set up the P&E Multilink

- specify the memory config file

- as P&E cannot (yet?) flash the target directly: set up a target task (import one for 52259)

Let me know if you need more detailed steps.

 

BK

0 Kudos
Reply

920 Views
JimDon
Senior Contributor III

 I have not had any of my code run in RAM ok but not flash - but then I try and avoid hacks that cause this.  If this happens, you should try and fix it, or at least understand why. It could indicate you are too close to edge of using up all your time.

 

In fact, the quicker your turn around from code change to running, the higher your productivity.

 

I'm not the only one to say this, and I know this from experience in many code developement domains.

It's one of those bits of wisdom that you learn the hard way.

I will try your new project this evening.

 

 

0 Kudos
Reply

920 Views
BlackNight
NXP Employee
NXP Employee

Hello,

The SWInumber defines the vector number for the SWI (software interrupt). If you hoover with the mouse over the property, you get:

Means: if you set the number to one, you should set up INT_EPORT_EPF1 in the RTOSSWI inherited component.

(yes, I would love to make this link directly in the component, but never found out how to do this with Processor Expert. So you need to set the number and then according to the number the SWI vector).

 

- Stack size: yes, depending on the number of tasks and the stack you give them, you need to increase that number.

- priority: if you set the scheduler to 'preemptive', and if you give each task a delay time, then lower priority tasks will get executed when the higher priorty tasks are idle.

 

 

BK

0 Kudos
Reply

920 Views
Stipey75
Contributor I

Hi everybody!

 

I've seen a new release of freeRtos on the site (7.0), anybody is planning a port of Black Knight OS component for PE on this new release?

 

Thanks!

0 Kudos
Reply

920 Views
BlackNight
NXP Employee
NXP Employee

yes, I have planned to port it to 7.0.x in the next couple of weeks and post it on this forum.

I simple did not had the time yet.

 

BK

0 Kudos
Reply

920 Views
TurboBob
Contributor IV

I wound up having a lot of issues combining the FreeRTOS (which worked great)  and saving things to flash.  I suspect the use of the stack in the flash routines was crashing the RTOS.  If you have any experience or hints in this direction,  that would be great.

 

The application was on a CFV1JM

 

Have a good holiday.

 

Bob

0 Kudos
Reply

920 Views
BlackNight
NXP Employee
NXP Employee

I used the FreeRTOS plus saving things into flash with the V1QE, using the IntFlash component in Processor Expert. I needed to set it to use 'save' writing to flash (so it backups the memory, erases it and stores the bytes I needed). Yes, this needed an extra portion on the stack. The other thing is: interrupts needs to be disabled during flashing as well (should not be interrupted).

 

BK

0 Kudos
Reply

920 Views
TurboBob
Contributor IV

I was disabling interupts,  I played with the min stack size and heap size as well.

 

The IntFlash component is not part of the 'inexpensive' version of CW that I have.  So I am using the routines from the app note (3462 I think).

 

Bob

0 Kudos
Reply

920 Views
BlackNight
NXP Employee
NXP Employee

Well, I guess you need to debug it then. Usually a piece of code will be loaded into RAM which performs the flash operation itself. Make sure that the page/memory your are flashing is not used by other parts (check the sector side).

I had a student who thought that some bytes are free around the vector table, and he erased that sector.

Of course the application crashed with an erased vector table :smileysad:.

 

BK

0 Kudos
Reply

920 Views
TurboBob
Contributor IV

its definately an interaction with the RTOS,  as I initialize that section of the flash (when required) before the RTOS starts.  This works fine with no issues.

 

The app note routines load a small subroutine into the stack and runs it from there.

 

I'll get it figured out.

 

Thanks!

 

Bob

0 Kudos
Reply

920 Views
TurboBob
Contributor IV

Trying to get the bootloader to run.

 

Created a new project in CW6.3

added the bootloader component

 

the mainline of the code looks like:

S192_FileStatus * fileStat;void main(void){  /* Write your local variable definition here */  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/  PE_low_level_init();  /*** End of Processor Expert internal initialization.                    ***/  /* Write your code here */  /* For example: for(;;) { } */                                                  BLUSB1_InitUSB();  for (;;)  {      BLUSB1_PollAndProcessUSB(fileStat);    BLUSB1_ReadAndProcessS19(fileStat);  }      

 

But,  first off it does not enumerate as a disk,  it shows up as a "?"  in the device manager.

 

I'm not sure how to trigger the boot loader to 'bootload' or jump to an existing application,  for normal operation.

 

I'm looking thru the tower stuff,  but its a lot different.

 

Thanks

 

Bob

0 Kudos
Reply

920 Views
TurboBob
Contributor IV

I got the TWR bootloader software to build,  and it seems to enumerate fine.

 

So the next task is to set my application up to be compatible,  setting the jump-in point,  and copying the interrupt vectors to RAM.

 

(I think these are the only 2 issues.)

 

Any hints would be great.

 

Bob

0 Kudos
Reply

920 Views
TurboBob
Contributor IV

got it all working.

 

Bob

0 Kudos
Reply

920 Views
TurboBob
Contributor IV

Not sure you are still following this thread,   but,  I have encountered a wierd condition with the TWR bootloader.

 

It boots and enumerates fine,  and the application runs properly.  But only if the USB-ML dongle is attached and the debugger is running.

 

If I shut it down, and unplug the USB_ML,  the previously bootloaded application still runs fine,  if I try to re-bootload the same application S19 file,  the process appears to go fine,  but the application crashes when the interupts enable.  Its been tough to troubleshoot,  since it works fine when the debugger is attached.

 

Really odd.

 

Bob

0 Kudos
Reply

920 Views
BlackNight
NXP Employee
NXP Employee

Hello,

it might be a power supply issue. I have seen cases were powering the Tower (especially with the LCD attached) just with one USB cable is not enough, especially if a notebook is not able to provide the 500 mA per port.

Then the solution is to have the board powered both with the elevator USB port and the main CPU (debug) port on the board.

 

Not sure if this is the issue.

BK

0 Kudos
Reply

920 Views
TurboBob
Contributor IV

I am powering the target system with its usual power supply.

 

Bob

0 Kudos
Reply

920 Views
Phaled
Contributor I

Hello,

 

I used program " FreeRTOS_06.03.2011 " posted by BlackNight on a microcontroller MC9S08QE128 and I met some difficulties. Freertoos does not manage the paged memory. I need help to use it with processor expert? Explain me please!  How I can manage it with freertos and processor expert.I created two tasks and i want to blink 2 leds but nothing work!

I just changed "port.c +portmacro.h +main.c". I attach them.

 

Thank for your answer and your help

0 Kudos
Reply

920 Views
Stipey75
Contributor I

Two tasks and two led blinking at different speed!! Amazing!! It works!

Thanks Black Knight i'll come back for some support on debug!!

 

Thanks!

0 Kudos
Reply

920 Views
Phaled
Contributor I

Hello everybody,

 

I used a program " FreeRTOS_06.03.2011 " that was posted by BlackNight on a microcontroller MC9S08QE128 and I met some difficulties. I need help please. Freertoos does not manage paged memory. I don't know if BlackNight had planned it;
How i can use it with processor expert? Explain to me please! 
How I can manage it with freertos and processor expert.

Thank

0 Kudos
Reply

920 Views
BlackNight
NXP Employee
NXP Employee

Hello,

I did not use the FreeRTOS yet with an S08 and using banked memory, and did not plan for it so far. But I might have a look.

 

BK

0 Kudos
Reply

920 Views
Phaled
Contributor I

If you might have a look, it would help me for my trainee.

0 Kudos
Reply