LPC1114 IAP sw upgrade through rs485

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

LPC1114 IAP sw upgrade through rs485

1,041 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pietro on Tue Nov 08 04:41:21 MST 2011
Hi,
I've developed a quite complex architecture where an LPC1768 controls 12 units of LPC114 through rs485 bus.
For LPC1114 sw upgrade I do the following operations:
1) LPC114 receives data trough rs485: the UART is in polling mode, to avoid using interrupts
2) Once a package of 256 bytes arrive, it is stored in the flash using IAP commands starting at address 0 of sector 0.
3) I'm keeping empty the last 32 bytes of RAM to avoid problems with IAP
4) All interrupts are disabled
5) UART polling and IAP commands are located in RAM.

There's something wrong, because as soon as I erase sector 0, the code stops!

I think I'm not correctly locating routines into RAM.
I'm using the following instruction, ad example for a IAP command:
__attribute__((section(".RamLoc8"))) uint32_t prepare_sector_write_ram(uint32_t sector) ;
where RamLoc8 is the 8k RAM area defined in the standard linker.
How should I modify the linker to correctly locate functions in RAM?

Bye!
Pietro
0 Kudos
9 Replies

943 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pietro on Fri Nov 11 06:27:04 MST 2011
I uploaded the example code 'lpc11_func_in_ram' into Red Suite 4 and I got the following warning:

setting incorrect section attributes for .data.ramfunc lpc11_func_in_ram  line 22, external location: C:\DOCUME~1\A0008\IMPOST~1\Temp\ccNYt4zI.s C/C++ Problem

What should I do to solve it?
Regards!
0 Kudos

943 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pietro on Thu Nov 10 09:22:24 MST 2011
Thank you!
It works!!!
I'll also move to LPCXpresso 4.

Regards!
[IMG]http://knowledgebase.nxp.com/images/icons/icon7.gif[/IMG]
0 Kudos

943 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Nov 10 07:35:31 MST 2011

Quote: CodeRedSupport
I'll arrange for the FAQ and attached example to be updated in the near future.


FAQ and example project now updated.
0 Kudos

943 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Nov 10 06:07:40 MST 2011
It looks like the compiler/linker in LPCXpresso 3 when building the Releae configuration optimises the code in such a way that the incorrect Cortex-M0 branch veneer still gets generated, even when a function pointer is used.

The recommended way around this would be to upgrade to LPCXPresso 4

However, you can also modify the code slightly to avoid the issue in LPCXpresso 3.  To do this just move the line
    void (*longfunc)(void) = &ram_func;
to outside of the function making the call - so that it is a global rather than a local.

In the example project attached to the FAQ, you will need to make a similar change in both ram.c and main.c. I'll arrange for the FAQ and attached example to be updated in the near future.

By the way, if you really want to stick with LPCXpresso 3, I would strongly recommend that you at least move to LPCXPresso 3.6.3.

Regards,
CodeRedSupport.
0 Kudos

943 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Nov 10 01:53:14 MST 2011

Quote: pietro
If I load the example code in Release mode it crashes (and my code doesn't work!!).
Could you explain why?
I'm using LPCXpresso 3.6.0.


#1 Optimization :eek:

#2 LPCXpresso 3.6.0. :rolleyes:
0 Kudos

943 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pietro on Thu Nov 10 01:33:31 MST 2011
Thanks, useful example code!
One major problem: the example code work well in debug mode (and my code now works well too!!) .

If I load the example code in Release mode it crashes (and my code doesn't work!!).
Could you explain why?
I'm using LPCXpresso 3.6.0.

Thanks!
pietro
0 Kudos

943 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by pietro on Wed Nov 09 07:04:21 MST 2011
Ok thanks,
I've used lpc11_func_in_ram code and now I'm correctly locating routines in RAM.

There's another issue with lpc11_func_in_ram example:
in debug mode it works (and my code too!! I can succesfully update sw through UART and IAP!! Great!)
In release mode the code crashes (and my application doesn't work!!).
How can I solve this last issue?

I'm using LPCXpresso v3.6.0.

Ciao!
Pietro
0 Kudos

943 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Tue Nov 08 11:36:14 MST 2011
Have you actually checked your map file to see where your code is being placed? And have you supplied some code to copy the code from FLASH into RAM?

Anyway, I suggest that you take a look at this FAQ:

http://support.code-red-tech.com/CodeRedWiki/CodeInRam

Regards,
CodeRedSupport
0 Kudos

943 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gbm on Tue Nov 08 10:15:15 MST 2011
Are you sure that you don't use any library functions nor compiler helpers (like divide) in your code which is supposed to execute from RAM?
0 Kudos