Beginner Question

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

Beginner Question

442 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gjdevos on Thu Sep 18 09:16:51 MST 2014
I need some basic help to get started with LPCXpresso and a LPC-LINK2 board.

The Blink demo runs when I program it through JTAG. As a next step I want to
program it with the DFUSec tool. I managed to build a blinky.bin file which I can
download to the LPC-LINK2 flash memory using DFUSec. The image verfies
OK after the download. I can not figure out how to start the program after the
download. I guess I need to specify Jum to start address, bu then what should
the address be? I tried something from the map file: 000000, the start of the
flash memory, the ResetISR address, the address of main but nothing works.

I must be missing something obvious, can anyone give me a hint?
0 Kudos
Reply
8 Replies

413 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sander Stoks on Mon Sep 22 06:46:35 MST 2014
We add the checksum via a post-build step.  This was in fact already present in the project but commented out; we just commented it back in.  We understood that there are three header/checksums involved.  Our understanding is this:

1. a checksum over the vector table, which the processor itself uses to check whether a valid binary is present.  This is added by the post-build step mentioned above
2. a "header" added by DFUSec (which turns a .bin file into a .bin.hdr file)
3. a "suffix" demanded by the DFU specification itself; we add this by using the exact code as listed in the DFU specification.  It's not exactly clear why this suffix is there: dfu-util wants to see it (otherwise it will assume the binary about to be flashed is corrupt) yet it's stripped off again before the actual download to the device.

If our understanding of this is wrong, then that would explain part of our suffering :-)
0 Kudos
Reply

413 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Mon Sep 22 02:15:27 MST 2014
Does the binary file have the checksum correct?
http://www.lpcware.com/content/faq/lpcxpresso/image-checksums

Has the image header been correctly applied?
0 Kudos
Reply

413 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sander Stoks on Sat Sep 20 04:56:30 MST 2014
Hello, colleague of Gert-Jan here.

We'd be very interested in that cross-platform tool, so we'll keep an eye on that.  We can't really wait for it though, so the thing which we're getting stuck on is getting the example to run using the supplied tools.

Downloading seems to work - it just doesn't seem to start up.  This is the exact same binary which does work if we run it directly from LPXExpresso.  Is this the correct approach?  Do we somehow have to specify when building that we're trying to make a binary intended to flash with DFUSec as opposed to running directly from LPCExpresso?
0 Kudos
Reply

413 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Sep 19 08:53:27 MST 2014
dfu-util downloads to RAM only. If you want to download to flash, (as you say), you are going to need a two-stage process
1. Download a flash programmer into RAM
2. Communicate with that application to download to flash

We are currently working on a cross-platform application and firmware that will do this over USB - but we are 4-6 weeks away from making a beta.

The device will boot in dfu mode if:
- there is no valid image in flash, or
- the boot pins are configured to boot from dfu (this is what the jumper is doing...)
0 Kudos
Reply

413 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gjdevos on Fri Sep 19 08:36:33 MST 2014
If the device reset, wouldn't it again start in DFU mode and wait for something to download? At least, my LPC-Link2 does not execute my firmware until i put back JMP1.
I wonder how a device that is configured to boot in DFU mode can be instructed to continue executing the downloaded firmware.

Thank you for the boot_link2 hint. I see it uses dfu-util. I understand from the DFUSec documentation that the LPC4370 needs a two stage boot process to be
able to write to flash. Does the boot_link2 script with dfu-util support this? It also does not execute my blinky.bin file after download.

Gert-Jan
0 Kudos
Reply

413 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Sep 19 01:19:04 MST 2014
If you use dfu-util, it (optionally) resets the device on completion, so the downloaded code will run.

Take a look at the boot_link2 script provided in the lpcxpresso\bin directory to see how to use it from the command line. (use this script to boot the Redlink firmware when using LPC-Link2 as a debug probe). Make a simple change to the script to boot your image.
0 Kudos
Reply

413 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gjdevos on Thu Sep 18 10:12:58 MST 2014
Thank you for your quick reply. Indeed, JP1 open puts the LPC-LINK2 in DFU mode and that's what I have.
Is there a way to execute the flash code directly after download? I want to use DFU to support firmware
updates for my LPC4370 based product. My plan was to always boot in DFU, then use DFU to either
update the firmware and/or continue executing the flash based firmware. As a first step I like to download
a binary image and execute that outside of LPCXpresso.

Gert-Jan
0 Kudos
Reply

413 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wellsk on Thu Sep 18 09:40:40 MST 2014

It's been a while, but I think you need JP1 open to program (boot from USB) and JP1 closed to boot from SPIFI FLASH.
0 Kudos
Reply