Skip to content

Commit d475f25

Browse files
committed
Merge branch 'master' into fork/JuergenLeber/add-sd-s340-support
# Conflicts: # README.md
2 parents de9a9b7 + 4bce0cc commit d475f25

File tree

13 files changed

+163
-23
lines changed

13 files changed

+163
-23
lines changed

CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ set(TINYUSB_DIR ${CMAKE_CURRENT_LIST_DIR}/lib/tinyusb/src)
3434
set(UF2CONV_PY ${CMAKE_CURRENT_LIST_DIR}/lib/uf2/utils/uf2conv.py)
3535
set(UF2_FAMILY_ID_BOOTLOADER 0xd663823c)
3636

37+
if (NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
38+
set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "Build type" FORCE)
39+
endif ()
40+
3741
#-------------------
3842
# Bootloader
3943
#-------------------
@@ -131,7 +135,6 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
131135
target_include_directories(bootloader PUBLIC
132136
lib/SEGGER_RTT/RTT
133137
)
134-
135138
target_compile_definitions(bootloader PUBLIC
136139
CFG_DEBUG
137140
SEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
@@ -175,6 +178,7 @@ target_compile_options(bootloader PUBLIC
175178
)
176179
target_compile_definitions(bootloader PUBLIC
177180
SOFTDEVICE_PRESENT
181+
CONFIG_GPIO_AS_PINRESET
178182
)
179183

180184
if (TRACE_ETM STREQUAL "1")
@@ -348,4 +352,11 @@ add_custom_target(flash-mbr
348352

349353
add_custom_target(flash-erase
350354
COMMAND ${NRFJPROG} -f nrf52 --eraseall
351-
)
355+
)
356+
357+
# flash skip crc magic ( app valid = 0x0001, crc = 0x0000 )
358+
#add_custom_target(flash-skip-crc
359+
# #COMMAND ${NRFJPROG} --memwr $(BOOT_SETTING_ADDR) --val 0x00000001 -f nrf52
360+
# COMMAND ${NRFJPROG} --memwr 0xFF000 --val 0x00000001 -f nrf52
361+
# #COMMAND ${NRFJPROG} --memwr 0x7F000 --val 0x00000001 -f nrf52
362+
# )

README.md

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,20 @@ You must have have a J-Link available to "unbrick" your device.
114114
115115
### Build:
116116
117-
Firstly clone this repo with following commands
117+
Firstly clone this repo including its submodules with following command:
118118
119+
```
120+
git clone --recurse-submodules https://github.com/adafruit/Adafruit_nRF52_Bootloader
121+
```
122+
123+
For git versions before `2.13.0` you have to do that manually:
119124
```
120125
git clone https://github.com/adafruit/Adafruit_nRF52_Bootloader
121126
cd Adafruit_nRF52_Bootloader
122127
git submodule update --init
123128
```
124129
130+
#### Build using `make`
125131
Then build it with `make BOARD={board} all`, for example:
126132
127133
```
@@ -137,24 +143,36 @@ Supported boards are: feather_nrf52840_express feather_nrf52840_express pca10056
137143
Makefile:90: *** BOARD not defined. Stop
138144
```
139145
140-
#### Working with SoftDevice S340:
141-
The SoftDevice S340 is closed-source, not publicly available and is only distributed by Garmin Canada Inc.
146+
#### Build using `cmake`
147+
148+
Firstly initialize your build environment by passing your board to `cmake` via `-DBOARD={board}`:
149+
150+
```bash
151+
mkdir build
152+
cd build
153+
cmake .. -DBOARD=feather_nrf52840_express
154+
```
142155

143-
In order to be able to download the required ANT+ capable SoftDevice, you need to register an 'ANT+ Adopter' account at [thisisant.com](https://www.thisisant.com/register/). After around one business day you will receive access to the resources there. Then do the following steps:
144-
- Download the SoftDevice S340 v7.0.1 [(here)](https://www.thisisant.com/developer/components/nrf52832#tab_protocol_stacks_tab) and extract its contents
145-
- Under `lib/softdevice` in this repository there is a folder called `s340_nrf52_7.0.1`
146-
- Copy the API folder `ANT_s340_nrf52_7.0.1.API`, the license agreement `License_Agreement_ANT_Softdevice_rev3_3.pdf` and the hex file `ANT_s340_nrf52_7.0.1.hex` from the extracted contents to it.
147-
- Rename the API folder to `s340_nrf52_7.0.1_API`
148-
- Rename the hex file to `s340_nrf52_7.0.1_softdevice.hex`
149-
- Modify `lib/softdevice/s340_nrf52_7.0.1_API/include/nrf_sdm.h` on line 191 and remove the two slashes at the beginning of `//#define...` to use the *evaluation key* for the ANT SoftDevice.
150-
- **VERY IMPORTANT:** You MUST obtain a valid commercial license key BEFORE releasing a product to market that uses the ANT SoftDevice!
156+
And then build it with:
151157

152-
To add or modify a board with an ANT+ capable SoftDevice S340 the `SD_VERSION` and `SD_NAME` parameters in the corresponding `board.mk` file have to be set:
158+
```bash
159+
make
153160
```
154-
SD_VERSION = 7.0.1
155-
SD_NAME = s340
161+
162+
You can also use the generator of your choice. For example adding the `-GNinja` and then you can invoke `ninja build` instead of `make`.
163+
164+
To list all supported targets, run:
165+
166+
```bash
167+
cmake --build . --target help
168+
```
169+
170+
To build individual targets, you can specify it directly with `make` or using `cmake --build`:
171+
172+
```bash
173+
make bootloader
174+
cmake --build . --target bootloader
156175
```
157-
**Important:** When adding a new board you must add the suffix `_s340` to the folder name to exclude it from automatic builds.
158176

159177
### Flash
160178

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Working with SoftDevice S340
2+
3+
The SoftDevice S340 is closed-source, not publicly available and is only distributed by Garmin Canada Inc.
4+
5+
In order to be able to download the required ANT+ capable SoftDevice and place SoftDevice S340 v7.0.1 files here. You need to register an 'ANT+ Adopter' account at [thisisant.com](https://www.thisisant.com/register/). After around one business day you will receive access to the resources there. Then do the following steps:
6+
- Download the SoftDevice S340 v7.0.1 [(here)](https://www.thisisant.com/developer/components/nrf52832#tab_protocol_stacks_tab) and extract its contents
7+
- Under `lib/softdevice` in this repository there is a folder called `s340_nrf52_7.0.1`
8+
- Copy the API folder `ANT_s340_nrf52_7.0.1.API`, the license agreement `License_Agreement_ANT_Softdevice_rev3_3.pdf` and the hex file `ANT_s340_nrf52_7.0.1.hex` from the extracted contents to it.
9+
- Rename the API folder to `s340_nrf52_7.0.1_API`
10+
- Rename the hex file to `s340_nrf52_7.0.1_softdevice.hex`
11+
- Modify `lib/softdevice/s340_nrf52_7.0.1_API/include/nrf_sdm.h` on line 191 and remove the two slashes at the beginning of `//#define...` to use the *evaluation key* for the ANT SoftDevice.
12+
- **VERY IMPORTANT:** You MUST obtain a valid commercial license key BEFORE releasing a product to market that uses the ANT SoftDevice!
13+
14+
To add or modify a board with an ANT+ capable SoftDevice S340 the `SD_VERSION` and `SD_NAME` parameters in the corresponding `board.mk` file have to be set:
15+
```
16+
SD_VERSION = 7.0.1
17+
SD_NAME = s340
18+
```
19+
**Important:** When adding a new board you must add the suffix `_s340` to the folder name to exclude it from automatic builds.

lib/softdevice/s340_nrf52_7.0.1/readme.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

linker/nrf52833_debug.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Linker script to configure memory regions. */
22

33
SEARCH_DIR(.)
4-
GROUP(-lgcc -lc -lnosys)
4+
GROUP(-lgcc -lc)
55

66
MEMORY
77
{

linker/nrf52840_debug.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Linker script to configure memory regions. */
22

33
SEARCH_DIR(.)
4-
GROUP(-lgcc -lc -lnosys)
4+
GROUP(-lgcc -lc)
55

66
MEMORY
77
{

linker/nrf52_debug.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Linker script to configure memory regions. */
22

33
SEARCH_DIR(.)
4-
GROUP(-lgcc -lc -lnosys)
4+
GROUP(-lgcc -lc)
55

66
MEMORY
77
{
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(MCU_VARIANT nrf52840)

src/boards/omnimo_nrf52840/board.h

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2018 Ha Thach for Adafruit Industries
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
25+
#ifndef _OMNIMO_NRF52840_H
26+
#define _OMNIMO_NRF52840_H
27+
28+
#define _PINNUM(port, pin) ((port)*32 + (pin))
29+
30+
/*------------------------------------------------------------------*/
31+
/* LED
32+
*------------------------------------------------------------------*/
33+
#define LEDS_NUMBER 2
34+
#define LED_PRIMARY_PIN _PINNUM(1, 15)
35+
#define LED_SECONDARY_PIN _PINNUM(1, 10)
36+
#define LED_STATE_ON 1
37+
38+
#define LED_NEOPIXEL _PINNUM(0, 16)
39+
40+
#define NEOPIXELS_NUMBER 1
41+
#define BOARD_RGB_BRIGHTNESS 0x040404
42+
43+
/*------------------------------------------------------------------*/
44+
/* BUTTON
45+
*------------------------------------------------------------------*/
46+
#define BUTTONS_NUMBER 2
47+
#define BUTTON_1 _PINNUM(1, 02)
48+
#define BUTTON_2 _PINNUM(1, 07)
49+
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
50+
51+
//--------------------------------------------------------------------+
52+
// BLE OTA
53+
//--------------------------------------------------------------------+
54+
#define BLEDIS_MANUFACTURER "eAFAQ"
55+
#define BLEDIS_MODEL "OMNIMO nRF52840"
56+
57+
//--------------------------------------------------------------------+
58+
// USB
59+
//--------------------------------------------------------------------+
60+
61+
//Shared VID/PID with pca10056
62+
#define USB_DESC_VID 0x1209
63+
#define USB_DESC_UF2_PID 0xCECE
64+
#define USB_DESC_CDC_ONLY_PID 0xCECE
65+
66+
//------------- UF2 -------------//
67+
#define UF2_PRODUCT_NAME "Omnimo nRF52840"
68+
#define UF2_VOLUME_LABEL "OMNIn52BOOT"
69+
#define UF2_BOARD_ID "nRF52840-Omnimo"
70+
#define UF2_INDEX_URL "https://www.crowdsupply.com/eafaq/omnimo-nrf52840"
71+
72+
#endif // _OMNIMO_NRF52840_H

0 commit comments

Comments
 (0)