Compare commits

..
8 Commits
Author SHA1 Message Date
Ha Thach 81da515ae6 upload update uf2 separately in release 2021-02-17 16:19:09 +07:00
Ha Thach 3aaef724b2 release 0.4.1 2021-02-17 15:59:15 +07:00
Ha Thach ba5d783c20 Merge pull request #189 from glenne/master
Add USB connect timeout for app reset to UF2 or Serial via GPREGRET
2021-02-17 15:52:47 +07:00
Glenn Engel 755cfa95e4 Add USB connect timeout for app reset to UF2 or Serial via GPREGRET 2021-02-15 07:49:52 -08:00
Ha Thach b37c078213 Merge pull request #191 from adafruit/fix-ci-190
fix ci arm gcc install path
2021-02-15 14:16:53 +07:00
hathach ba5977d679 fix ci arm gcc install path 2021-02-15 14:07:20 +07:00
Ha Thach 4ba802d127 Merge pull request #186 from lyusupov/REGOUT0
fix against pollution of REGOUT0 reserved bits
2021-02-01 21:36:54 +07:00
Linar Yusupov f9125593b2 fix against pollution of REGOUT0 reserved bits 2021-01-30 12:27:52 +03:00
5 changed files with 45 additions and 12 deletions

No files matched your search

+12 -3
View File
@@ -66,7 +66,7 @@ jobs:
# 9.3.1-1.2.1 is xpack modified version which significantly increased compiled size to 6-7KB and cause flash overflow.
# Skip this version for now, we will try again with next official release from ARM
xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@9.3.1-1.1.1
echo `echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` >> $GITHUB_PATH
echo `echo $HOME/.local/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` >> $GITHUB_PATH
- name: Build
run: |
@@ -78,12 +78,11 @@ jobs:
name: ${{ matrix.board }}
path: _bin/${{ matrix.board }}
- name: Creat Release Asset
- name: Create Release Asset
if: ${{ github.event_name == 'release' }}
run: zip -jr ${{ matrix.board }}_bootloader-${{ github.event.release.tag_name }}.zip _bin/${{ matrix.board }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -94,3 +93,13 @@ jobs:
asset_name: ${{ matrix.board }}_bootloader-${{ github.event.release.tag_name }}.zip
asset_content_type: application/zip
- name: Upload Release Asset for Self-Update
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event_name == 'release' }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: _bin/${{ matrix.board }}/update-${{ matrix.board }}_bootloader-${{ github.event.release.tag_name }}_nosd.uf2
asset_name: update-${{ matrix.board }}_bootloader-${{ github.event.release.tag_name }}_nosd.uf2
asset_content_type: application/x-binary
+21 -5
View File
@@ -57,6 +57,14 @@ There are two pins, `DFU` and `FRST` that bootloader will check upon reset/power
- The `GPREGRET` register can also be set to force the bootloader can enter any of above modes (plus a CDC-only mode for Arduino).
`GPREGRET` is set by the application before performing a soft reset.
```c
#include "nrf_nvic.h"
void reset_to_uf2(void) {
NRF_POWER->GPREGRET = 0x57; // 0xA8 OTA, 0x4e Serial
NVIC_SystemReset(); // or sd_nvic_SystemReset();
}
```
On the Nordic PCA10056 DK board, `DFU` is connected to **Button1**, and `FRST` is connected to **Button2**.
So holding down **Button1** while clicking **RESET** will put the board into USB bootloader mode, with UF2 and CDC support.
Holding down **Button2** while clicking **RESET** will put the board into OTA (over-the-air) bootloader mode.
@@ -69,7 +77,7 @@ For other boards, please check the board definition for details.
### Making your own UF2
To create your own UF2 DFU update image, simply use the [Python conversion script](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py) on a .bin file or .hex file, specifying the family as **0xADA52840**. If using a .bin file with the conversion script you must specify application address with the -b switch, this address depend on the SoftDevice size/version e.g S140 v6 is 0x26000
To create your own UF2 DFU update image, simply use the [Python conversion script](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py) on a .bin file or .hex file, specifying the family as **0xADA52840**. If using a .bin file with the conversion script you must specify application address with the -b switch, this address depend on the SoftDevice size/version e.g S140 v6 is 0x26000
To create a UF2 image from a .bin file:
```
@@ -105,6 +113,15 @@ You must have have a J-Link available to "unbrick" your device.
Prerequisites
- ARM GCC
To install for macos
```bash
brew tap ArmMbed/homebrew-formulae
brew install arm-none-eabi-gcc
brew link --overwrite arm-none-eabi-gcc # if a prior version was present
```
- Nordic's [nRF5x Command Line Tools](https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools)
- [Python IntelHex](https://pypi.org/project/IntelHex/)
@@ -148,7 +165,7 @@ Makefile:90: *** BOARD not defined. Stop
If you get the following error ...
```
$ make BOARD=feather_nrf52840_express all
$ make BOARD=feather_nrf52840_express all
Compiling file: main.c
/bin/sh: /usr/bin/arm-none-eabi-gcc: No such file or directory
make: *** [_build/main.o] Error 127
@@ -160,6 +177,8 @@ the variable `CROSS_COMPILE` as below:
$ make CROSS_COMPILE=/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi- BOARD=feather_nrf52832 all
```
For other compile errors, check the gcc version with `arm-none-eabi-gcc --version` to insure it is at least 9.x.
#### 2. `ModuleNotFoundError: No module named 'intelhex'`
Install python-intelhex with
@@ -169,9 +188,6 @@ pip install intelhex
```
#### 3. `make: nrfjprog: No such file or directory`
Make sure that `nrfjprog` is available from the command-line. This binary is
+5
View File
@@ -1,5 +1,10 @@
# Adafruit nRF52 Bootloader Changelog
## 0.4.1 - 2021.02.17
- Add USB connect timeout for app reset to UF2 or Serial via GPREGRET
- Fix pollution of REGOUT0 reserved bits
## 0.4.0 - 2021.01.19
- Decouple bootloader and softdevice i.e bootloader will always work with and/or without softdevice present. This allows application to pack firmware + softdevice into an uf2/serial for DFU.
+4 -2
View File
@@ -94,11 +94,13 @@ void board_init(void)
// #define UICR_REGOUT0_VALUE UICR_REGOUT0_VOUT_3V3
// in board.h when using that power configuration.
#ifdef UICR_REGOUT0_VALUE
if (NRF_UICR->REGOUT0 != UICR_REGOUT0_VALUE)
if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) !=
(UICR_REGOUT0_VALUE << UICR_REGOUT0_VOUT_Pos))
{
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
NRF_UICR->REGOUT0 = UICR_REGOUT0_VALUE;
NRF_UICR->REGOUT0 = (NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |
(UICR_REGOUT0_VALUE << UICR_REGOUT0_VOUT_Pos);
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
+3 -2
View File
@@ -170,9 +170,10 @@ int main(void)
// Serial only mode
bool serial_only_dfu = (NRF_POWER->GPREGRET == DFU_MAGIC_SERIAL_ONLY_RESET);
bool uf2_dfu = (NRF_POWER->GPREGRET == DFU_MAGIC_UF2_RESET);
// start either serial, uf2 or ble
bool dfu_start = _ota_dfu || serial_only_dfu || (NRF_POWER->GPREGRET == DFU_MAGIC_UF2_RESET) ||
bool dfu_start = _ota_dfu || serial_only_dfu || uf2_dfu ||
(((*dbl_reset_mem) == DFU_DBL_RESET_MAGIC) && (NRF_POWER->RESETREAS & POWER_RESETREAS_RESETPIN_Msk));
// Clear GPREGRET if it is our values
@@ -251,7 +252,7 @@ int main(void)
}
// Initiate an update of the firmware.
if (APP_ASKS_FOR_SINGLE_TAP_RESET())
if (APP_ASKS_FOR_SINGLE_TAP_RESET() || uf2_dfu || serial_only_dfu)
{
// If USB is not enumerated in 3s (eg. because we're running on battery), we restart into app.
APP_ERROR_CHECK( bootloader_dfu_start(_ota_dfu, 3000, true) );