update makefile/cmake for softdevice macro. Remove the _s340 filter in ci
This commit is contained in:
parent
d475f25154
commit
31c3081668
5 changed files with 29 additions and 50 deletions
2
.github/workflows/githubci.yml
vendored
2
.github/workflows/githubci.yml
vendored
|
|
@ -21,7 +21,7 @@ jobs:
|
|||
id: set-matrix
|
||||
working-directory: src/boards
|
||||
run: |
|
||||
MATRIX_JSON=$(ls -d */ | sed 's/\/$//' | grep -vE '_s340$' | jq -R -s -c 'split("\n")[:-1]')
|
||||
MATRIX_JSON=$(ls -d */ | sed 's/\/$//' | jq -R -s -c 'split("\n")[:-1]')
|
||||
echo "matrix=$MATRIX_JSON"
|
||||
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
|
||||
|
||||
|
|
|
|||
|
|
@ -225,47 +225,29 @@ if (MCU_VARIANT STREQUAL "nrf52")
|
|||
set(SD_NAME s132)
|
||||
set(DFU_DEV_REV 0xADAF)
|
||||
set(DFU_APP_DATA_RESERVED 7*4096)
|
||||
target_compile_definitions(bootloader PUBLIC
|
||||
NRF52
|
||||
NRF52832_XXAA
|
||||
S132
|
||||
)
|
||||
target_compile_definitions(bootloader PUBLIC NRF52 NRF52832_XXAA)
|
||||
elseif (MCU_VARIANT STREQUAL "nrf52833")
|
||||
set(DFU_DEV_REV 52833)
|
||||
set(DFU_APP_DATA_RESERVED 7*4096)
|
||||
if (SD_NAME STREQUAL "s340")
|
||||
target_compile_definitions(bootloader PUBLIC
|
||||
NRF52833_XXAA
|
||||
S340
|
||||
)
|
||||
else ()
|
||||
target_compile_definitions(bootloader PUBLIC NRF52833_XXAA)
|
||||
if (NOT DEFINED SD_NAME)
|
||||
set(SD_NAME s140)
|
||||
target_compile_definitions(bootloader PUBLIC
|
||||
NRF52833_XXAA
|
||||
S140
|
||||
)
|
||||
endif ()
|
||||
elseif (MCU_VARIANT STREQUAL "nrf52840")
|
||||
set(DFU_DEV_REV 52840)
|
||||
# App reserved 40KB (8+32) to match circuitpython for 840
|
||||
set(DFU_APP_DATA_RESERVED 10*4096)
|
||||
if (SD_NAME STREQUAL "s340")
|
||||
target_compile_definitions(bootloader PUBLIC
|
||||
NRF52840_XXAA
|
||||
S340
|
||||
)
|
||||
else ()
|
||||
target_compile_definitions(bootloader PUBLIC NRF52840_XXAA)
|
||||
if (NOT DEFINED SD_NAME)
|
||||
set(SD_NAME s140)
|
||||
target_compile_definitions(bootloader PUBLIC
|
||||
NRF52840_XXAA
|
||||
S140
|
||||
)
|
||||
endif ()
|
||||
|
||||
else ()
|
||||
message(FATAL_ERROR "MCU_VARIANT ${MCU_VARIANT} is unknown")
|
||||
endif ()
|
||||
|
||||
string(TOUPPER ${SD_NAME} SD_NAME_UPPER)
|
||||
target_compile_definitions(bootloader PUBLIC ${SD_NAME_UPPER})
|
||||
|
||||
set(SD_FILENAME ${SD_NAME}_nrf52_${SD_VERSION})
|
||||
set(SD_HEX ${SOFTDEVICE_DIR}/${SD_FILENAME}/${SD_FILENAME}_softdevice.hex)
|
||||
|
||||
|
|
|
|||
23
Makefile
23
Makefile
|
|
@ -104,33 +104,32 @@ BIN = _bin/$(BOARD)
|
|||
|
||||
# MCU_SUB_VARIANT can be nrf52 (nrf52832), nrf52833, nrf52840
|
||||
ifeq ($(MCU_SUB_VARIANT),nrf52)
|
||||
CFLAGS += -DNRF52 -DNRF52832_XXAA
|
||||
SD_NAME = s132
|
||||
DFU_DEV_REV = 0xADAF
|
||||
CFLAGS += -DNRF52 -DNRF52832_XXAA -DS132
|
||||
DFU_APP_DATA_RESERVED=7*4096
|
||||
else ifeq ($(MCU_SUB_VARIANT),nrf52833)
|
||||
ifeq ($(SD_NAME),s340)
|
||||
CFLAGS += -DNRF52833_XXAA -DS340
|
||||
else
|
||||
SD_NAME = s140
|
||||
CFLAGS += -DNRF52833_XXAA -DS140
|
||||
endif
|
||||
CFLAGS += -DNRF52833_XXAA
|
||||
DFU_DEV_REV = 52833
|
||||
DFU_APP_DATA_RESERVED=7*4096
|
||||
else ifeq ($(MCU_SUB_VARIANT),nrf52840)
|
||||
ifeq ($(SD_NAME),s340)
|
||||
CFLAGS += -DNRF52840_XXAA -DS340
|
||||
else
|
||||
ifndef SD_NAME
|
||||
SD_NAME = s140
|
||||
CFLAGS += -DNRF52840_XXAA -DS140
|
||||
endif
|
||||
else ifeq ($(MCU_SUB_VARIANT),nrf52840)
|
||||
CFLAGS += -DNRF52840_XXAA
|
||||
DFU_DEV_REV = 52840
|
||||
# App reserved 40KB (8+32) to match circuitpython for 840
|
||||
DFU_APP_DATA_RESERVED=10*4096
|
||||
ifndef SD_NAME
|
||||
SD_NAME = s140
|
||||
endif
|
||||
else
|
||||
$(error Sub Variant $(MCU_SUB_VARIANT) is unknown)
|
||||
endif
|
||||
|
||||
SD_NAME_UPPER = $(subst s,S,${SD_NAME})
|
||||
CFLAGS += -D$(SD_NAME_UPPER)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# SOURCE FILES
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -16,4 +16,3 @@ To add or modify a board with an ANT+ capable SoftDevice S340 the `SD_VERSION` a
|
|||
SD_VERSION = 7.0.1
|
||||
SD_NAME = s340
|
||||
```
|
||||
**Important:** When adding a new board you must add the suffix `_s340` to the folder name to exclude it from automatic builds.
|
||||
15
src/main.c
15
src/main.c
|
|
@ -157,9 +157,8 @@ static void mbr_init_sd(void) {
|
|||
sd_mbr_command(&com);
|
||||
}
|
||||
|
||||
// Helper function to disable the SoftDevice with upfront check if it is enabled.
|
||||
// Especially SoftDevice S340 locks up when calling sd_softdevice_disable() and it's not enabled.
|
||||
static void sd_disable(void) {
|
||||
// Disable the SoftDevice if it is enabled.
|
||||
static void disable_softdevice(void) {
|
||||
uint8_t sd_enabled = 0;
|
||||
sd_softdevice_is_enabled(&sd_enabled);
|
||||
if (sd_enabled == 1) {
|
||||
|
|
@ -216,7 +215,7 @@ int main(void) {
|
|||
if (!_sd_inited) mbr_init_sd();
|
||||
|
||||
// Make sure SD is disabled
|
||||
sd_disable();
|
||||
disable_softdevice();
|
||||
}
|
||||
|
||||
// clear in case we kept DFU_DBL_RESET_APP there
|
||||
|
|
@ -317,7 +316,7 @@ static void check_dfu_mode(void) {
|
|||
}
|
||||
|
||||
if (_ota_dfu) {
|
||||
sd_disable();
|
||||
disable_softdevice();
|
||||
} else {
|
||||
usb_teardown();
|
||||
}
|
||||
|
|
@ -337,10 +336,10 @@ static uint32_t ble_stack_init(void) {
|
|||
.rc_temp_ctiv = 2,
|
||||
.accuracy = NRF_CLOCK_LF_ACCURACY_250_PPM
|
||||
};
|
||||
#ifndef ANT_LICENSE_KEY
|
||||
sd_softdevice_enable(&clock_cfg, app_error_fault_handler);
|
||||
#else
|
||||
#ifdef ANT_LICENSE_KEY
|
||||
sd_softdevice_enable(&clock_cfg, app_error_fault_handler, ANT_LICENSE_KEY);
|
||||
#else
|
||||
sd_softdevice_enable(&clock_cfg, app_error_fault_handler);
|
||||
#endif
|
||||
sd_nvic_EnableIRQ(SD_EVT_IRQn);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue