adafruit / Adafruit_nRF52_Bootloader

USB-enabled bootloaders for the nRF52 BLE SoC chips
MIT License
427 stars 380 forks source link

PCA10056: Part of the HEX regions are out of the device memory size #277

Closed lonelycorn closed 11 months ago

lonelycorn commented 1 year ago

Operating System

Windows 11

INFO_UF2.TXT

N/A

What happened ?

I downloaded pca10056_bootloader-0.7.0_s140_6.1.1.hex from the 0.7.0 release, and used Programmer v3.0.3 from nRF Connect to flash an nRF52840-DK.

The programmer showed the following warning (see screenshot)

Part of the HEX regions are out of the device memory size, but you can still proceed write operation

The device seems to be working fine-ish after the flash. At least for a couple of days I was able to flash Arduino sketches using the Arduino IDE via the adafruit package.

How to reproduce ?

  1. download pca10056_bootloader-0.7.0_s140_6.1.1.hex from the 0.7.0 release
  2. use Programmer v3.0.3 from nRF Connect to flash an nRF52840-DK

Debug Log

No response

Screenshots

part-of-hex-regions-are-out-of

hathach commented 1 year ago

did the programmer specify which region is out of the flash. It is probably due to the ucir register for mbr/bootloader at 0x10001014. And it should be safe to program

- file: 'feather_nrf52840_express_bootloader-0.7.0-8-gb55f516-dirty_s140_6.1.1.hex'
  entry: 0xF000C4E1
  data:
  - { first: 0x00000000, last: 0x00000AFF, length: 0x00000B00 }
  - { first: 0x00001000, last: 0x00025DE7, length: 0x00024DE8 }
  - { first: 0x000F4000, last: 0x000FD333, length: 0x00009334 }
  - { first: 0x000FD800, last: 0x000FD857, length: 0x00000058 }
  - { first: 0x10001014, last: 0x1000101B, length: 0x00000008 }
sunxkui commented 1 year ago

after flashing the device stays in DFU-Mode without running the application.....FTHR840BOOT

DuMaM commented 1 year ago

@hathach This is still true. The Bootloader address starts at: 0xf4000 where the size of the compiled image is:

LD particle_xenon_bootloader-0.7.0-19-g80c3a84.out
   text    data     bss     dec     hex filename
  32592    1744   22558   56894    de3e _build/build-particle_xenon/particle_xenon_bootloader-0.7.0-19-g80c3a84.out
vivek-pai commented 1 year ago

I'm getting this too.

Not sure if related/important nRF Programmer identifies the resulting region as an "Application" region when it's named a Bootloader region in the hex.

hathach commented 1 year ago

it is not clear too me which part of the memory is out of region and what issue it caused

DuMaM commented 1 year ago

@hathach add 0xf4000 + 0xde3e, and you are reaching a new memory region. As far as I remember, there is a limit of how big the bootloader can take in nrf52.

My suggestion is to put in Makefile some kind of protection, which should block build if this is overwriting code memory. I took me 2 weeks to find this issue.

hathach commented 1 year ago

the limit is in the linker file, please elaborate why it is out of region.

DuMaM commented 1 year ago

Here is a memory layout https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_bootloader.html I think current linker layout do not fit documentation.

DuMaM commented 11 months ago

@hathach any updates here?

Bootloader should be in range of: 0x000F 8000 - 0x000F E000 (24 kB)

hathach commented 11 months ago

Here is a memory layout https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_bootloader.html I think current linker layout do not fit documentation.

That is not this bootloader project

@hathach any updates here?

Bootloader should be in range of: 0x000F 8000 - 0x000F E000 (24 kB)

this bootloader is 38KB in size. There is no point to keep this open