AnsweredAssumed Answered

Building a relocatable C program that can be run out of SRAM in MQX

Question asked by Michael Predko on Dec 1, 2010
Latest reply on Jul 31, 2014 by Robin Zou

HI Folks,

 

I am interested in finding if anyone has bult a ColdFire C app (as well as created the build configuration files) that can be run in SRAM under MQX?  I would be using CW10 as the development tool. 

 

There are three situations that I am interested in:

1) A larger program which would run independently in SRAM with its primary purpose being to update the entire CF's Flash with an image downloaded over a Serial or USB link. 

2) A small program that could be run out of allocated memory (using _mem_alloc and then loading the code and data segments into SRAM) with access to the system via my own library (probably use a SW interrupt interface to allow it to be relocatable).  This would mean the app's variable and stack memory would follow at the end of the application image. 

3) As a permutation of 2), loading the C app in an arbitrary location in Flash and provide it with its own SRAM, using _mem_alloc before execution. 

 

Question 1) is really the important one - I would like to provide a mechanism for updating the Flash while the application is in the field.  In this case, the program would be built as a complete application with no set code addresses, other than the interrupt table. 

 

From looking at the code output, it seems like the IAR compiler generates relocatable code (seemingly known as "PIC" = "Position Independent Code") - along with this, what would I have to do extra that is needed for an application's start up (like setting FLASHBAR & RAMBAR) for it to execute correctly? 

 

Should I post this on the CW forum?  There was a thread there with a similar request that didn't move to completion so I thought I would try here. 

 

Is there any documentation that I should have reviewed (before bothering people on the list)? 

 

Thanx,

 

myke

Outcomes