Skip to content

Commit

Permalink
Merge branch 'dev' into 'master'
Browse files Browse the repository at this point in the history
Merge for Release 1.0.0

See merge request smartme.io/arancino/ide/arancino-nrf52-core!1
  • Loading branch information
sergiotomasello committed Dec 7, 2021
2 parents c11f3e9 + 1e6953f commit 92be0fa
Show file tree
Hide file tree
Showing 205 changed files with 37,714 additions and 110,758 deletions.
206 changes: 206 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
image: smartmeio/arancino-library-build


stages:
- start
- package
- upload
- cleanup

#################################
####### START #######
#################################

####### START
start:
stage: start

variables:
GIT_STRATEGY: none

script:
- mkdir -p tmp
- echo `date +%Y-%m-%d` > tmp/date.txt
- echo `date +%H-%M-%S` > tmp/time.txt

artifacts:
paths:
- tmp/

expire_in: 1d

only:
- tags

except:
- master
- branches

######## PUSH
push:
stage: start
when: manual
only: ['tags']
except: ['master', 'branches']

allow_failure: true

variables:
GIT_STRATEGY: clone

before_script:
- eval `python3 check-version-tag.py ${CI_COMMIT_TAG}`

script:
#- apk add git
- git remote add github https://$GITHUB_BOT_USERNAME:[email protected]/$GITHUB_DEST_REPO
#- git remote show github
#- git remote show origin
#- git branch -a
- git checkout $CI_COMMIT_TAG
- git fetch github
#- git push github $CI_COMMIT_REF_NAME --force
- >
if [[ ${PRE_RELEASE} == "test" ]]; then
echo "not performing TAG push";
else
git push github ${CI_COMMIT_TAG}
fi
- git push github --all --force

#################################
####### PACKAGE #######
#################################

####### Package Release #######
package_release:
stage: package
variables:
GIT_SUBMODULE_STRATEGY: recursive

script:
# create some variables into temp folder
- PKG_NAME=$PLATFORM_NAME-$CI_COMMIT_TAG
- PKG_NAME_PIO=framework-arduino-nrf52-arancino-$CI_COMMIT_TAG

- echo $PKG_NAME > tmp/pkg_name.txt
- echo $PKG_NAME_PIO > tmp/pkg_name_pio.txt
- echo $CI_COMMIT_TAG > tmp/target_path.txt

- sed -i "s:\(ARANCINO_CORE_VERSION\) .*:\1 \"$CI_COMMIT_TAG\":" ./cores/nRF5/Arduino.h
- sed -i "s:\(version\)=.*:\1=$CI_COMMIT_TAG:" ./platform.txt
- jq --arg tag_ver ${CI_COMMIT_TAG} '.version = $tag_ver' package.json|sponge package.json

# adding ArduinoJson into core
- git clone $REPO_LIB_ARDUINOJSON_URL -b v6.18.0 libraries/ArduinoJson

# adding MsgPack into core
- git clone $REPO_LIB_MSGPACK_URL -b 0.3.8 libraries/MsgPack

# adding MsgPacketizer into core
- git clone $REPO_LIB_MSGPACKETIZER_URL -b 0.3.0 libraries/MsgPacketizer

# adding Microcontroller ID into core
- git clone $REPO_LIB_MICROCONTROLLER_ID_URL -b 1.0.0 libraries/Microcontroller-id

# adding MQTT PubSubClient into core
- git clone $REPO_LIB_PUBSUBCLIENT_URL -b v2.8 libraries/PubSubClient

- cd ..
# tar files and move temp folder back
- tar --exclude=tmp --exclude=.git* --exclude=*.DS_Store* -cvjf $PKG_NAME.tar.bz2 $CI_PROJECT_NAME

# pio packaging
- cp -r $CI_PROJECT_NAME framework-arduino-nrf52-arancino
- tar --exclude=tmp --exclude=.git* --exclude=*.DS_Store* -cvjf $PKG_NAME_PIO.tar.bz2 framework-arduino-nrf52-arancino

# move tar into temp folder
- cd $CI_PROJECT_NAME
- mv ../$PKG_NAME.tar.bz2 tmp/
- mv ../$PKG_NAME_PIO.tar.bz2 tmp/

# create files containing sha 256 checksum and size in bytes of the tar file
- sha256sum tmp/$PKG_NAME.tar.bz2 | awk '{print $1}' > tmp/SHA256.txt
- du -b tmp/$PKG_NAME.tar.bz2 | awk {'print $1}' > tmp/SIZE.txt
- echo FILENAME $PKG_NAME.tar.bz2
- echo SHA-256 `cat tmp/SHA256.txt`
- echo SIZE `cat tmp/SIZE.txt`
- echo PKG_NAME `cat tmp/pkg_name.txt`

# same step above but for PIO
- sha256sum tmp/$PKG_NAME_PIO.tar.bz2 | awk '{print $1}' > tmp/SHA256_pio.txt
- du -b tmp/$PKG_NAME_PIO.tar.bz2 | awk {'print $1}' > tmp/SIZE_pio.txt
- echo FILENAME_PIO $PKG_NAME_PIO.tar.bz2
- echo SHA-256-PIO `cat tmp/SHA256_pio.txt`
- echo SIZE_PIO `cat tmp/SIZE_pio.txt`
- echo PKG_NAME_PIO `cat tmp/pkg_name_pio.txt`

dependencies:
- start

artifacts:
paths:
- tmp/
except:
- branches
- master

only:
- tags

#################################
####### UPLOAD #######
#################################

####### Upload Staging and Release #######
upload:
stage: upload

before_script:
- eval `python3 check-version-tag.py ${CI_COMMIT_TAG}`

script:
- DATE="$(cat tmp/date.txt)"
- TIME="$(cat tmp/time.txt)"
- PKG_NAME="$(cat tmp/pkg_name.txt)"
- PKG_NAME_PIO="$(cat tmp/pkg_name_pio.txt)"
- TARGET_PATH="$(cat tmp/target_path.txt)"
- >
if [[ ${PRE_RELEASE} == "test" ]]; then
REPO_NAME=${REPO_NAME}-snapshot
REPO_NAME_PIO=${REPO_NAME_PIO}-snapshot
fi
# Upload to Artifactory
- curl -u $REPO_USR:$REPO_PWD -T tmp/$PKG_NAME.tar.bz2 "${REPO_BASE_URL}/artifactory/${REPO_NAME}/${TARGET_PATH}/${PKG_NAME}.tar.bz2"
- curl -u $REPO_USR:$REPO_PWD -T tmp/$PKG_NAME_PIO.tar.bz2 "${REPO_BASE_URL}/artifactory/${REPO_NAME_PIO}/${TARGET_PATH}/${PKG_NAME_PIO}.tar.bz2"

only:
- tags

except:
- master
- branches

#################################
####### CLEANUP #######
#################################

####### Cleanup Job #######
cleanup:
stage: cleanup

variables:
GIT_STRATEGY: none

script:
- echo "Cleaning up"
- rm -rf tmp/

when: always

only:
- tags

except:
- master
- branches
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "libraries/Adafruit_nRFCrypto"]
path = libraries/Adafruit_nRFCrypto
url = https://github.com/adafruit/Adafruit_nRFCrypto.git
[submodule "libraries/Adafruit_TinyUSB_Arduino"]
path = libraries/Adafruit_TinyUSB_Arduino
url = https://github.com/adafruit/Adafruit_TinyUSB_Arduino.git
85 changes: 18 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,22 @@
# Arduino Core for Adafruit Bluefruit nRF52 Boards
# Arduino Core for Arancino nRF52 Boards

[![Build Status](https://github.com/adafruit/Adafruit_nRF52_Arduino/workflows/Build/badge.svg)](https://github.com/adafruit/Adafruit_nRF52_Arduino/actions)
Following board are included:

This repository contains the Arduino BSP for Adafruit Bluefruit nRF52 series:

- [Adafruit CLUE nRF52840](https://www.adafruit.com/product/4500)
- [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333)
- [Adafruit Feather nRF52832](https://www.adafruit.com/product/3406)
- [Adafruit Feather nRF52840 Express](https://www.adafruit.com/product/4062)
- [Adafruit Feather nRF52840 Sense](https://www.adafruit.com/product/4516)
- [Adafruit ItsyBitsy nRF52840 Express](https://www.adafruit.com/product/4481)
- Adafruit Metro nRF52840 Express

Following boards are also included but are not officially supported:

- [Nordic nRF52840DK PCA10056](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK)
- [Particle Xenon](https://store.particle.io/products/xenon)
- Raytac MDBT50Q-RX
- [Arancino Volante](https://arancino.cc)

## BSP Installation

There are two methods that you can use to install this BSP. We highly recommend the first option unless you wish to participate in active development of this codebase via Github.

### Recommended: Adafruit nRF52 BSP via the Arduino Board Manager
### Arancino nRF52 BSP via the Arduino Board Manager

1. [Download and install the Arduino IDE](https://www.arduino.cc/en/Main/Software) (At least v1.6.12)
1. [Download and install the Arduino IDE](https://www.arduino.cc/en/Main/Software)
2. Start the Arduino IDE
3. Go into Preferences
4. Add https://www.adafruit.com/package_adafruit_index.json as an 'Additional Board Manager URL'
5. Restart the Arduino IDE
6. Open the Boards Manager from the Tools -> Board menu and install 'Adafruit nRF52 by Adafruit'
7. Once the BSP is installed, select 'Adafruit Feather nRF52840 Express' from the Tools -> Board menu, which will update your system config to use the right compiler and settings for the nRF52.

### Optional (Core Development): Adafruit nRF52 BSP via git

1. Install BSP via Board Manager as above to install compiler & tools.
2. Delete the core folder `nrf52` installed by Board Manager in Adruino15, depending on your OS. It could be
* macOS : `~/Library/Arduino15/packages/adafruit/hardware/nrf52`
* Linux : `~/.arduino15/packages/adafruit/hardware/nrf52`
* Windows: `%APPDATA%\Local\Arduino15\packages\adafruit\hardware\nrf52`
3. `cd <SKETCHBOOK>`, where `<SKETCHBOOK>` is your Arduino Sketch folder:
* macOS : `~/Documents/Arduino`
* Linux : `~/Arduino`
* Windows: `~/Documents/Arduino`
4. Create a folder named `hardware/adafruit`, if it does not exist, and change directories to it
5. Clone this repo & its submodules:

```
git clone https://github.com/adafruit/Adafruit_nRF52_Arduino.git
cd Adafruit_nRF52_Arduino
git submodule update --init
```

6. Restart the Arduino IDE
7. Once the BSP is installed, select 'Adafruit Feather nRF52840 Express' from the Tools -> Board menu, which will update your system config to use the right compiler and settings for the nRF52.
4. Add https://git.smartme.io/smartme.io/arancino/arduino/smartmeio-package-index/raw/dev/package_smartmeio_index.json as an 'Additional Board Manager URL'
5. Open the Boards Manager from the Tools -> Board -> Board Manager menu and install 'Arancino nRF52 Boards'
6. Once the BSP is installed, select 'Arancino Volante' from the Tools -> Board -> Arancino nRF52 Boards menu, which will update your system config to use the right compiler and settings for the nRF52.


### Adafruit's nrfutil tools

Expand All @@ -66,29 +29,25 @@ There are two methods that you can use to install this BSP. We highly recommend
$ pip3 install adafruit-nrfutil --user
```

### Drivers

- [SiLabs CP2104 driver](http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx) is required for USB to Serial when using with Feather nRF52832

## Bootloader

Bootloader can be updated via UF2 file or DFU if already existed. Or flash on new blank chip using following guide

### Update Bootloader with UF2 ( nRF52840 only and require 0.4.0+ )
### Update Bootloader with UF2

This only works with nRF52840 and require existing bootloader version is at least 0.4.0:
This require existing bootloader version is at least 0.4.0:

- Quickly doulbe tap reset button to put your board in to bootloader mode. A mass storage device i.e `FTHR840BOOT` will appear
- Download latest UF2 for your board i.e `update-{BOARD}-{version}_nosd.uf2` from [Adafruit_nRF52_Bootloader release page](https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases)
- Drap and drop the UF2 file into `FTHR840BOOT` drive to perform update then wait until the board reset.x
- Quickly double tap reset button to put your board into bootloader mode. A mass storage device i.e `NRF52BOOT` will appear
- Download latest UF2 for your board i.e `arancino_volante_bootloader_s140_6.1.1.uf2`
- Drap and drop the UF2 file into `NRF52BOOT` drive to perform update then wait until the board reset.x

### Update Bootloader with DFU

To upgrade to the latest Bootloader + Softdevice using the serial port within Arduino IDE.

- Select `Tools > Board > Adafruit Feather nRF52840 Express`
- Select `Tools > Programmer > Bootloader DFU for Bluefruit nRF52`
- Select `Tools > Burn Bootloader`
- Select `Tools -> Board -> Arancino nRF52 Board -> Arancino Volante`
- Select `Tools -> Programmer -> Bootloader DFU for Arancino nRF52`
- Select `Tools -> Burn Bootloader`
- **WAIT** until the process complete ~30 seconds

**Note: close the Serial Monitor before you click "Burn Bootloader". Afterwards, you shouldn't close the Arduino IDE, unplug the Feather, launch Serial Monitor etc ... to abort the process. There is a high chance it will brick your device! Do this with care and caution.**
Expand All @@ -110,21 +69,13 @@ Check to make sure you can run `nrfjprog` from your terminal/command prompt
$ ln -s $HOME/prog/nordic/nrfjprog/nrfjprog /usr/local/bin/nrfjprog
```

Once the tools above have been installed and added to your system path, from the Arduino IDE:

- Select `Tools > Board > Adafruit Feather nRF52840 Express`
- Select `Tools > Programmer > J-Link for Feather52`
- Select `Tools > Burn Bootloader` with the board and J-Link connected

If you wish to modify bootloader to your own need, check out its repo here [Adafruit_nRF52_Bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader)

#### Manually Burning the Bootloader via nrfjprog

The bootloader hex file can be found at `bin/bootloader` run the command as follows:

```
$ nrfjprog -e -f nrf52
$ nrfjprog --program feather_nrf52832_bootloader.hex -f nrf52
$ nrfjprog --program arancino_volante_bootloader_s140_6.1.1.hex -f nrf52
$ nrfjprog --reset -f nrf52
```

Expand Down
Loading

0 comments on commit 92be0fa

Please sign in to comment.