Flash Magic Forum

In-System Programming Support => ARM Cortex => Topic started by: sonam chouhan on August 02, 2021, 11:35:54 pm

Title: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: sonam chouhan on August 02, 2021, 11:35:54 pm
Hi, there,

  Our requirement is to design a customized bootloader for external flash programming. We have tried the example code of Flash Magic\Bootloaders\External Memory\LPCxpresso18S37.
But, that does not work. Could you guide us on this requirement? Please see our below concerns.

1. do any flash magic versions have an example code for the LPC1833 external SPI Flash bootloader?

2. What are changes needed in Flash Magic\Bootloaders\External Memory\LPCxpresso18S37 that can help us?

3. We have changed the descriptor content in FlashPrg.c file as per the LPC1833 memory map, but that also does not work. We got the error as "Bootloader is not executing in RAM".

4. Please find the attachment and help us to provide some details about the requirement.
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: Andy Ayre on August 03, 2021, 10:56:30 am
You will need to run your custom bootloader in a debugger, e.g. Keil uVision, to see where it is getting stuck. The error means that Flash Magic is not getting a response.

The example booloader for the LPC4337 uses external SPIFI and that part is the same as the LPC1887 for this purpose, so should be a close enough starting point.

We can also develop this for you as a consulting project - please email us if you want to go down that route.

Andy
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: sonam chouhan on August 03, 2021, 10:04:48 pm
Thanks for your kind support.

We are using Keil uvision for compiling and creating the hex file (customized bootloader). We have attached the screenshot for the FlashPrg.c. Could you please let us know, for lpc1833 support in which files, we need to do the modifications in example bootloader for the LPC4337?
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: Andy Ayre on August 04, 2021, 09:39:34 am
You will need to change all of the parts related to SPIFI to match your external flash device. Andy
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: sonam chouhan on August 11, 2021, 03:14:24 am
I am using UART0 for downloading the bootloader. I checked this after modifying the example code (Flash Magic\Bootloaders\External Memory\LPCxpresso18S37), but still, I am getting the same error (Operation failed, bootloader in RAM is not executing(2)). After this error, I observed that the existing image has been erased but the new image is not updated.

It would be very helpful if you can provide any documentation of the steps to be followed to develop the customized bootloader code.
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: Andy Ayre on August 11, 2021, 09:32:00 am
What do you mean the "new image is not updated"? That Flash Magic is not sending the bootloader? How are you verifying that?

Andy
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: sonam chouhan on August 11, 2021, 10:34:39 am
We have two option to update a image in flash ROM
1..bin using jtag
2. .hex file using flash magic.
So, first we flash .bin in flash ROM and then with a little bit change we created a .hex file and tried to update our customized  bootloader into the flash ROM.
So, basically  before programming  bootloader erase the flash and then program the new image.
After flashing by selecting  this bootloader,  we got the operation failed and when found no content  in the flash. It seems that bootloader  erase the flash but not programed.
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: Andy Ayre on August 11, 2021, 12:22:39 pm
In your bootloader's descriptor you need to specify how the bootloader gets into the LPC1833, for example:

  DESCRIPTOR_BOOTSTRAP_SWDLINK2

tells Flash Magic to automatically download the bootloader using SWD via an NXP Link2.

For the LPC1833 the bootloader should be downloaded into RAM not Flash. If you look at the .map file of the included example the code starts at address 0x10000500. This address also appears in the descriptor so that Flash Magic knows where to put it.

Andy

Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: sonam chouhan on August 13, 2021, 02:08:13 am
Hi,

Thank you so much to guide me.

I have changed the ram address in the descriptor mentioned below.

In descriptor-

0x10050000,                                  // ram start address (for bootloader storage)
  0x100FFFFF,                                  // ram end address (for bootloader storage)
  0x400,//0x10000,                                     // programmable sector size in bytes
  0xFF,                                        // programmable memory erased value
  256,                                         // number of bytes to program at once

In the target, I have set

IROM1- Start Address-0x10000500 and size:0x6000
IRAM1- Start Address-0x10050000 and size:0x10000

After setting the configuration, I compiled the code and created the .map and .hex file. Below is the memory layout in the .map file

Load Region LR_IROM1 (Base: 0x10000500, Size: 0x0000565c, Max: 0x00006000, ABSOLUTE)

    Execution Region ER_IROM1 (Exec base: 0x10000500, Load base: 0x10000500, Size: 0x000055dc, Max: 0x00006000, ABSOLUTE)

Execution Region RW_IRAM1 (Exec base: 0x10050000, Load base: 0x10005adc, Size: 0x00000e50, Max: 0x00010000, ABSOLUTE)


Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: sonam chouhan on August 13, 2021, 02:13:49 am
By doing so, still I am getting "operation failed" bootloader in RAM is not executing.

I have attached the debug file of flash magic, please find the attachment, and help me with the issue.
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: Andy Ayre on August 13, 2021, 09:15:18 am
The ram start address in the descriptor doesn't match the start address you are actually using. Andy
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: sonam chouhan on August 16, 2021, 03:46:54 am
Correcting the IRAM in descriptor and target, I recompiled and flash the. hex. Still, it shows the operation failed.

I am attaching the debug file, could you please take a look into that and let me know if there is anything related to configuration.

Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: Andy Ayre on August 16, 2021, 10:16:04 am
You don't program the hex file into flash - it is downloaded to RAM automatically.

It looks from the debug file that you are choosing the LPC1833 rather than your external flash bootloader. In section 1:

Click on Change
Expand External Memory (third item)
Expand UART
Choose your custom bootloader

If you don't see your bootloader then copy it into the Bootloaders\External Memory folder.
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: sonam chouhan on August 25, 2021, 12:16:30 am
Thanks for your kind support.

With a correct RAM address mapping, my customized BL is working fine for the Winbond flash ROM.

Quick concern: If a flash ROM having almost the same features as the supported QSPI device for LPC1833, then would the same customized BL work for the similar featured flash ROM?

Or there is any specific change required in the sample code?
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: Andy Ayre on August 25, 2021, 09:24:45 am
It would be best to compare the datasheets of the two devices and look for differences. Andy
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: sonam chouhan on August 29, 2021, 10:27:52 pm
I have gone through both MX25L1633E and MX25R6435F but did not find any software-related difference. My customized bootloader code runs in MX25L1633E successfully but failed in MX25R6435F.

By debugging the code, I found that the operation failed from the initial stage Memory_init(). In our MCUxpresso code, we observed the same failure. Can it be the spifi_drv_M3.lib issue?

FYI, we are able to flash the image via JTAG in MX25R6435F.
Title: Re: Customized bootloader for flash ROM Winbond: W25Q16JLSNIG-T with LPC1833
Post by: sonam chouhan on September 29, 2021, 01:57:33 am
Could you let us know the below information about spifi_drv_M3.lib?

1. In the flash magic example code, this lib is directly used for the support of spi flash, so, is the library created from .a (NXP) or it is created in KEIL by using source code?

2. Do you have any source code to create .lib?

3. We got the source code for this from NXP, but by building the project in KEIL, .lib size is different and that does not work?

Currently, we need to add the support of an flash of MXIC which is not supported by the old spifi lib, so we are working to add the support of the flash in spilib source ccode and by doing so, we need to create the customized bootloader for the flash MX25V16xx.