maxikrie opened a new pull request, #21008:
URL: https://github.com/apache/nuttx/pull/21008
## Summary
With `CONFIG_ARCH_BOARD_COMMON=y`, the CMake build of `xiao-nrf52840` links
the image at 0x0, and flashing it leaves the board unable to boot.
The XIAO's UF2 bootloader keeps the first 4 KiB of flash for the MBR it
starts through. The board's `scripts/flash_config.ld` links the image at
0x1000, behind it.
`src/CMakeLists.txt` used that script only when `ARCH_BOARD_COMMON` is off.
With it on, the build took `boards/arm/nrf52/common/scripts/flash_config.ld`,
which links at 0x0 for the nRF52 DKs. The Make build (`scripts/Make.defs`)
always uses the board's script.
This PR makes the CMake build always use the board's script.
## Impact
- `xiao-nrf52840`, CMake build with `ARCH_BOARD_COMMON=y`: the image is now
linked at 0x1000 as with Make.
- Nothing changes with `ARCH_BOARD_COMMON` off (no in-tree XIAO config turns
it on) or for the Make build. No other boards affected.
## Testing
Host: Debian Linux (kernel 6.1), x86_64.
Toolchain: `arm-none-eabi-gcc (Arm GNU Toolchain 13.3.Rel1) 13.3.1 20240614`
`xiao-nrf52840:usbnsh` built with CMake/Ninja, with `ARCH_BOARD_COMMON`
enabled in the generated `.config`. `arm-none-eabi-readelf -lW nuttx`, first
LOAD segment:
Before:
```
LOAD 0x001000 0x00000000 0x00000000 0x1517c 0x1517c R E 0x1000
```
After:
```
LOAD 0x001000 0x00001000 0x00001000 0x1517c 0x1517c R E 0x1000
```
The same change has been in a custom XIAO nRF52840 configuration
(`ARCH_BOARD_COMMON=y`, CMake, flashed via UF2) since NuttX 12.12.0; without
it, the board no longer booted after the first UF2 flash. The patch passes
`tools/checkpatch.sh`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]