EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Run Time Flash Programming through the serial port

Started by Jose Ivan Quinones June 20, 2007
Hi All,

I am wondering if you know how to do the following using the IAR
compiler:

1. Segregate the code space so that a module resides in a FLASH
segment which I can later erase.
2. Compile a module and as a result obtain a hex file I can later
download.

I am planning on having said Hex file downloaded as necessary and
update the firmware according to prerequired parameters, using the
serial port connection. Any other help in doing this is highly
appreciated as well! Best regards,

JIQ

Beginning Microcontrollers with the MSP430

Hi Jose,

Is it really necessary to download code chunks? You said that the FW
will be upgraded according to "prerequired parameters". Can you arrange
things so just parameters must be downloaded and saved into the FLASH?
I'm asking this because the scenario you described is a lot more
complicated - there is much more things to take into consideration.
While I'm not an expert with IAR, it seems to me that it can't be done
in "pure" C.

Regards,
Yuliyan

Jose Ivan Quinones wrote:
>
> Hi All,
>
> I am wondering if you know how to do the following using the IAR
> compiler:
>
> 1. Segregate the code space so that a module resides in a FLASH
> segment which I can later erase.
> 2. Compile a module and as a result obtain a hex file I can later
> download.
>
> I am planning on having said Hex file downloaded as necessary and
> update the firmware according to prerequired parameters, using the
> serial port connection. Any other help in doing this is highly
> appreciated as well! Best regards,
>
> JIQ
>
>
You can easily use the "#pragma location" directive to put the code
wherever you want. We have a small bootloader that starts at 0x4000
and a separate application that starts at 0x8000. With some clever
function pointer manipulation, we can use the bootloader to branch to
our application (or others also residing in flash). The real trick is
sharing interrupt service routines (which we skip by not using
interrupts in our bootloader!).

We also use the "#pragma location" for placing large tables of logged
data, constants, etc., which change over time.

Make use of the .xcl linker configuration file to layout the memory
map. This will simplify things a lot and keep the linker from putting
code where you may not want it (like a place you have reserved for
future use).

Stuart

--- In m..., "Jose Ivan Quinones" wrote:
>
> Hi All,
>
> I am wondering if you know how to do the following using the IAR
> compiler:
>
> 1. Segregate the code space so that a module resides in a FLASH
> segment which I can later erase.
> 2. Compile a module and as a result obtain a hex file I can later
> download.
>
> I am planning on having said Hex file downloaded as necessary and
> update the firmware according to prerequired parameters, using the
> serial port connection. Any other help in doing this is highly
> appreciated as well! Best regards,
>
> JIQ
>

Memfault Beyond the Launch