Bootloader lpc1769

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

Bootloader lpc1769

929 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hcanova on Wed Nov 07 15:47:04 MST 2012
Hi,

I need to write an aplication using bootloader, but I need to call the bootloader function on my user code, I'm thinking to use an struct with the functions address on bootloader to call in the user code. someone knows if is it possible?

thanks in advance.

hcanova
Labels (1)
0 Kudos
9 Replies

736 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by robertpalmerjr on Sun Nov 16 19:28:08 MST 2014

Quote:
All tools have the ability to locate functions and variables to specific addresses. In IAR you follow the definition with @



What is the equivalent for LPCXpresso?  I am developing a I2C secondary boot loader based on the NXP app note (AN11258) and I am using LPCXpress 5.2.4

(yes, I know it's old.  I am using this older version because the code it build was EMVCo certified and I do not want a newer version possibly changing the compiled image.  At some point I will rebuild with the newest compiler and do a binary comparison of the output to see if I'm ok with the newer compiler, but for now, the safest bet is to not change the tool)

The SBL_APICall() function needs to be placed at 0xFF0 (top of the 4k FLASH block).  I have tried using the section macro and defining a 16byte section starting at address 0xFF0.  This appears to work in terms of the .hex or .bin file generated.  However, the flash programmer appears to pick up the separate section information and attempts to write the two sections separately.  I believe this is causing a problem because the section starting at 0xFF0 does not start on a FLASH block boundary. 

How can I specify that I want the function SBL_APICall() to appear at 0xFF0, but that I want all of the first 4K written to flash as a single block?  It does not appear that there is any way to do this at compile time.  Modify the linker script?  How?
0 Kudos

736 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hcanova on Sat Jan 26 05:05:19 MST 2013
Hi

You know where I can find one example?

thanks
0 Kudos

736 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by drs on Thu Jan 24 15:20:15 MST 2013
You need to include a function table in the image you plan to ship and locate that function to a specific address in flash. Then distribute a header file that defines the function table structure and publish the address of the table.

All tools have the ability to locate functions and variables to specific addresses. In IAR you follow the definition with @ <address>

0 Kudos

736 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hcanova on Thu Jan 10 10:26:28 MST 2013
Hi Daniel and the community

I need to restart this discussion again!, I will try to describe better my question (sorry for my bad english), I have one code with many functions and relative big, in this code has an function called user_code(), this function basicaly is an code that call another function and have some logic like the normal programming with if,else and variable declarations, this function must be customized by the user, I dont want to give the full code for the user, because that way he will need to recompile and write with some tool on the mcu (ISP,JTAG or anothers).

I wanto to pre-flash the MCU with my code (like an bootloader), and give the possibility to the user, write user_code, calling the function he want and with your own logic, download the code into the flash and execute.

My problem is: how the user code will know where is the function or variables in the pre-flashed code?

Maybe I need to create an table with the functions address and tell this to the user code, but I dont know how can I do this.

can you help me.

thanks

0 Kudos

736 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Daniel Widyanto on Sun Nov 11 19:52:55 MST 2012
Hi Hcanova,

I'm not clear with what you want.

Basically, most applications, that use IAP, use special pin, or I2C / SPI / USB / UART etc to send indication to the MCU to switch the mode from operating mode to programming mode. Which peripheral that you want to use is up to you. But you need to create the code to connect that peripheral to IAP functions in the MCU.
0 Kudos

736 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hcanova on Fri Nov 09 04:02:23 MST 2012
HI Daniel

Thanks for you answer I will read this application notes, and post some news after,

Is possible for example to compile an function -> write on flash memory -> reboot the controller -> execute this function and if I need to change the function compile again -> write ......

I saw in application notes Xmodem to get an image I can do this with this compiled code and execute them?


thanks



Regads

Hcanova
0 Kudos

736 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Daniel Widyanto on Thu Nov 08 19:54:08 MST 2012
Hi,

Do you mean you want to have "virtual" table list like in C++ ? So the real implementation of the function is put into the table. Then user just need to update the table if they update the function ?

Yes. It's possible with IAP, but you need to consider that the erasing sector size is quite huge (about 4kB), and you need to have wear leveling filesystem or your Flash sector will be corrupted very fast.

See AN11008 - Flash based non-volatile storage (http://www.nxp.com/documents/software/AN11008_Flash_based_non-volatile_storage_with_software.zip) and IAP app note (AN11071 - In-Application Programming for the LPC1700 http://www.nxp.com/documents/software/AN11071.zip) to implement the Flash sectors as "virtual" table list.
0 Kudos

736 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hcanova on Thu Nov 08 06:26:56 MST 2012
Hi Lien

Thanks for your answer, I'm not familiar with the IAP but I guess is very interesting, in my application I need to change only one function with the user code, is possible to change only this function with the IAP, or I will need to recompile all my code and write with the bootloader?

I will try to explaine better, for example I have this function:

void test(void)
{
  print "hello word";
  if (x==y)
  {
    do_this(x);
  }
}

and my user need to change to:

void test(void)
{
  print "hello hcanova";
  if (x!=z)
  {
    do_this(z);
  }
}

is possible make some thing like that with IAP or other recourse?

Thanks in Advance

Regards
HCanova
0 Kudos

736 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lien.Nguyen on Wed Nov 07 19:38:24 MST 2012
It is possible. IAP is an example. You just place boot loader entry point at a fix location, create a function pointer and call it.
You can refer to http://www.lpcware.com/content/nxpfile/an11257-spi-secondary-boot-loader for more information.

Best Regards,
Lien
0 Kudos