Sorry I thought that dropping the document in the pane would post its contents.
Nordic secure_bootloader_uart_mbr_pca10056_debug questions
The project uses custom hardware with the MIMEW nRF52833 Module MS88SF2 connected to a Silabs ARM microcontroller. For now, we will update only our Nordic application and not the SoftDevice or bootloader. The update will be performed via the serial channel and not by way of the BLE interface. We do not have a button on the Nordic board so I plan to set the NRF_POWER_GPREGRET register and repower the Nordic board to enter bootloader mode.
I use the latest SDK 17.0.2. This is my first time uses the Nordic secure bootloader. I tried looking for answers on the forum but there is a lot of older stuff from previous SDK versions.
I understand that the uECC has a license that prevents it distribution in your example projects, but I would think that all of the SDK config defines would be set correctly for it. I finally got it to compile by the following steps. I may have gotten something wrong.
I work on the pca10056_uart_debug project in SES.
I added my publc key to the project.
Changed NRF_BL_DFU_ENTER_METHOD_BUTTON to zero.
Got uECC.h: No such file or directory
Got:
#error "More than one backend enabled for secp256r1 (NIST 256-bit).");
Got:
Linking secure_bootloader_uart_mbr_pca10056_debug.elf
Output/Release/Obj/secure_bootloader_uart_mbr_pca10056_debug/nrf_crypto_ecc.o:E:/Nordic/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/nrf_crypto_ecc.c:376: undefined reference to `nrf_crypto_backend_micro_ecc_public_key_from_raw'
Output/Release/Obj/secure_bootloader_uart_mbr_pca10056_debug/nrf_crypto_ecc.o:(.rodata.public_key_from_raw_impl+0x4): undefined reference to `nrf_crypto_backend_micro_ecc_public_key_from_raw'
Output/Release/Obj/secure_bootloader_uart_mbr_pca10056_debug/nrf_crypto_ecc.o:(.rodata.public_key_from_raw_impl+0x8): undefined reference to `nrf_crypto_backend_micro_ecc_public_key_from_raw'
Output/Release/Obj/secure_bootloader_uart_mbr_pca10056_debug/nrf_crypto_ecc.o:(.rodata.public_key_from_raw_impl+0xc): undefined reference to `nrf_crypto_backend_micro_ecc_public_key_from_raw'
Output/Release/Obj/secure_bootloader_uart_mbr_pca10056_debug/nrf_crypto_ecdsa.o:E:/Nordic/nRF5_SDK_17.0.2_d674dde/components/libraries/crypto/nrf_crypto_ecdsa.c:153: undefined reference to `nrf_crypto_backend_micro_ecc_verify'
Output/Release/Obj/secure_bootloader_uart_mbr_pca10056_debug/nrf_crypto_ecdsa.o:(.rodata.verify_impl+0x4): undefined reference to `nrf_crypto_backend_micro_ecc_verify'
Output/Release/Obj/secure_bootloader_uart_mbr_pca10056_debug/nrf_crypto_ecdsa.o:(.rodata.verify_impl+0x8): undefined reference to `nrf_crypto_backend_micro_ecc_verify'
Output/Release/Obj/secure_bootloader_uart_mbr_pca10056_debug/nrf_crypto_ecdsa.o:(.rodata.verify_impl+0xc): undefined reference to `nrf_crypto_backend_micro_ecc_verify'
Output/Release/Obj/secure_bootloader_uart_mbr_pca10056_debug/nrf_dfu_validation.o: in function `crypto_init':
undefined reference to `g_nrf_crypto_ecc_secp256r1_curve_info'
<folder Name="ECC">
<file file_name="$(NORDIC_SDK)/components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecc.c" />
<file file_name="$(NORDIC_SDK)/components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecdh.c" />
<file file_name="$(NORDIC_SDK)/components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecdsa.c" />
</folder>
I used the nRF Connect Programmer, erased all and then wrote the Bootloader & the s140_nrf52_7.2.0_softdevice.hex. I did not flash our application so I was expecting to be able to communicate with the Bootloader from our ARM host until the bootloader timed out but this was not the case. When I ran the Bootloader code from the debug the host could communicate with the Bootloader although I got errors. When I flashed the bootloader, softdevice and our application, the application runs but it may not be running by way of the bootloader.
Why does the bootloader seem not to run after flashing and powering up the board and not using the debugger?
09/03/2021 08:32:37[dfu_serial.c: 249] Set Packet Receipt Notification 0
09/03/2021 08:32:37[dfu_serial.c: 626] Sending init packet...
09/03/2021 08:32:37[dfu_serial.c: 302] Selecting Object: type:1
09/03/2021 08:32:37[dfu_serial.c: 321] Object selected: max_size:512 offset:0 crc:0x00000000
09/03/2021 08:32:37[dfu_serial.c: 447] Streaming Data: len:141 offset:0 crc:0x00000000
09/03/2021 08:32:37[dfu_serial.c: 462] Invalid offset (141 -> 29)!
09/03/2021 08:32:37[dfu_serial.c: 468] Invalid CRC (0x253B65F6 -> 0xB91AF43D)!
Here is the Bootloader and soft device programmer map:
When generating the application dfu package I used the following command:
nrfutil pkg generate --hw-version 52 --application-version 1 --application app.hex --sd-req 0xCA --key-file priv.pem app_dfu_package.zip
I used 0xCA since I could not find a number for the s140_nrf52_7.2.0_softdevice.
It does not appear in the list. Is this command OK as I did it?
In Nordic application I had to change the memory placements as below.
FLASH_PH_START=0x0
FLASH_PH_SIZE=0x100000
RAM_PH_START=0x20000000
RAM_PH_SIZE=0x40000
FLASH_START=0x27000
FLASH_SIZE=0xd9000
RAM_START=0x200043a8
RAM_SIZE=0x3bc58
The plan is to have the host send to the running Nordic application a command to write to the NRF_POWER_GPREGRET register and upon received a valid reply, repower the Nordic board so it will enter the bootloader.
I used Jimmy Wong’s Serial DFU Host Application (By using C programming language) program as a basis for my ARM host update Application code. He based it on SDK v15.2 (nRFUtil 3.5.0 protocol) and not SDK 17.0.2. Has there been changes?
When I run the bootloader in the debugger on the Nordic board, the host can ping the bootloader and stream the dat file from the app_dfu_package (which 141 bytes of size) but I get a reply from the bootloader that the offset should be 29 and the CRC is incorrect. This is a result of the NRF_DFU_OP_CRC_GET command reply.
Why is the bootloader expecting 29 bytes and CRC incorrect?
09/03/2021 08:32:37[dfu_serial.c: 249] Set Packet Receipt Notification 0
09/03/2021 08:32:37[dfu_serial.c: 626] Sending init packet...
09/03/2021 08:32:37[dfu_serial.c: 302] Selecting Object: type:1
09/03/2021 08:32:37[dfu_serial.c: 321] Object selected: max_size:512 offset:0 crc:0x00000000
09/03/2021 08:32:37[dfu_serial.c: 447] Streaming Data: len:141 offset:0 crc:0x00000000
09/03/2021 08:32:37[dfu_serial.c: 462] Invalid offset (141 -> 29)!
09/03/2021 08:32:37[dfu_serial.c: 468] Invalid CRC (0x253B65F6 -> 0xB91AF43D)!
Hi,
Sorry for the delay.
1. It seems you haven't select NRF_CRYPTO_BACKEND_NRF_SW_ENABLED and disable NRF_CRYPTO_BACKEND_CC310_BL_ENABLED and added source files and head file for nRF5_SDK\external\micro-ecc\nrf52hf_armgcc\armgcc\micro_ecc_lib_nrf52.a, \components\libraries\sha256 and components\libraries\crypto\backend\nrf_sw
I attached here my project files pca10056_uart_debug_266089.zip, could you please try to put it under nRF5_SDK_17.0.2\examples\dfu\secure_bootloader and compile?
2.
DavidKaplan said:Why does the bootloader seem not to run after flashing and powering up the board and not using the debugger?
Are you using secure_bootloader_uart_mbr_pca10056_debug?
Can you use the J-Link RTT view to connect the DK? You suppose to see the debug log from the RTT view, and enter the command to start the DFU process over the serial link as Secure DFU Bootloader over Serial Link (UART/USB) doc.
3.
DavidKaplan said:It does not appear in the list. Is this command OK as I did it?
The Firmware ID of this SoftDevice is 0x0100. See page.2 of s140_nrf52_7.2.0_release-notes.pdf under nRF5_SDK_17.0.2\components\softdevice\s140\doc
Should correct like this
nrfutil pkg generate --hw-version 52 --application-version 1 --application app.hex --sd-req 0x0100 --key-file priv.pem app_dfu_package.zip
4.
DavidKaplan said:Why is the bootloader expecting 29 bytes and CRC incorrect?
Does the new package instruction fix the issue?
-Amanda H
Hi,
Sorry for the delay.
1. It seems you haven't select NRF_CRYPTO_BACKEND_NRF_SW_ENABLED and disable NRF_CRYPTO_BACKEND_CC310_BL_ENABLED and added source files and head file for nRF5_SDK\external\micro-ecc\nrf52hf_armgcc\armgcc\micro_ecc_lib_nrf52.a, \components\libraries\sha256 and components\libraries\crypto\backend\nrf_sw
I attached here my project files pca10056_uart_debug_266089.zip, could you please try to put it under nRF5_SDK_17.0.2\examples\dfu\secure_bootloader and compile?
2.
DavidKaplan said:Why does the bootloader seem not to run after flashing and powering up the board and not using the debugger?
Are you using secure_bootloader_uart_mbr_pca10056_debug?
Can you use the J-Link RTT view to connect the DK? You suppose to see the debug log from the RTT view, and enter the command to start the DFU process over the serial link as Secure DFU Bootloader over Serial Link (UART/USB) doc.
3.
DavidKaplan said:It does not appear in the list. Is this command OK as I did it?
The Firmware ID of this SoftDevice is 0x0100. See page.2 of s140_nrf52_7.2.0_release-notes.pdf under nRF5_SDK_17.0.2\components\softdevice\s140\doc
Should correct like this
nrfutil pkg generate --hw-version 52 --application-version 1 --application app.hex --sd-req 0x0100 --key-file priv.pem app_dfu_package.zip
4.
DavidKaplan said:Why is the bootloader expecting 29 bytes and CRC incorrect?
Does the new package instruction fix the issue?
-Amanda H