Skip to content

Commit

Permalink
adds support for PLATFORM=electron2
Browse files Browse the repository at this point in the history
  • Loading branch information
technobly authored and avtolstoy committed Jan 14, 2025
1 parent f77b7b1 commit 658ff11
Show file tree
Hide file tree
Showing 67 changed files with 1,014 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .buildpackrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export BUILDPACK_VARIATION=manifest
export RELEASE_PLATFORMS=( )

# Platforms for which this firmware is considered experimental
export PRERELEASE_PLATFORMS=( argon boron bsom b5som tracker esomx p2 trackerm msom)
export PRERELEASE_PLATFORMS=( argon boron bsom b5som tracker esomx p2 trackerm msom electron2)
# Note: a single platform should be only in release or prerelease list. If
# added to both it will be considered a prerelease

# Platforms which require modules to be prebuilt
export MODULAR_PLATFORMS=( argon boron bsom b5som tracker esomx p2 trackerm msom)
export MODULAR_PLATFORMS=( argon boron bsom b5som tracker esomx p2 trackerm msom electron2)

4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ orbs:

aliases:
- &tasks ["compile:all clean:all", "compile:user clean:user", "compile:debug clean:debug"]
- &platforms ["argon", "boron", "esomx", "bsom", "b5som", "tracker", "p2", "trackerm", "msom"]
- &platforms ["argon", "boron", "esomx", "bsom", "b5som", "tracker", "p2", "trackerm", "msom", "electron2"]

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
Expand Down Expand Up @@ -478,7 +478,7 @@ workflows:
- particle-ci-private
matrix:
parameters:
platform: ["argon", "boron", "esomx", "bsom", "b5som", "tracker", "p2", "trackerm", "msom", "unit-test newhal gcc"]
platform: ["argon", "boron", "esomx", "bsom", "b5som", "tracker", "p2", "trackerm", "msom", "electron2", "unit-test newhal gcc"]
- combine-binaries:
requires:
- build-and-test
Expand Down
2 changes: 1 addition & 1 deletion .workbench/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "1.0.0",
"toolchains": [
{
"platforms": [12, 13, 15, 23, 25, 26, 28, 32, 35],
"platforms": [12, 13, 15, 23, 25, 26, 28, 32, 35, 37],
"firmware": "deviceOS@source",
"compilers": "[email protected]",
"tools": "[email protected]",
Expand Down
2 changes: 2 additions & 0 deletions bootloader/src/electron2/include.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INCLUDE_DIRS += $(BOOTLOADER_MODULE_PATH)/src/$(PLATFORM_NAME)
include $(BOOTLOADER_MODULE_PATH)/src/nRF52840/include.mk
2 changes: 2 additions & 0 deletions bootloader/src/electron2/sources.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BOOTLOADER_SRC_PATH = $(BOOTLOADER_MODULE_PATH)/src/${PLATFORM_NAME}
include $(BOOTLOADER_MODULE_PATH)/src/nRF52840/sources.mk
2 changes: 2 additions & 0 deletions bootloader/src/nRF52840/usbd_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ class NrfDevice : public Device {
# define USBD_PRODUCT_NAME "B5-SoM"
#elif PLATFORM_ID == PLATFORM_TRACKER
# define USBD_PRODUCT_NAME "Tracker"
#elif PLATFORM_ID == PLATFORM_ELECTRON2
# define USBD_PRODUCT_NAME "Electron 2"
#endif
#define USBD_PRODUCT_STRING USBD_PRODUCT_NAME " " "DFU Mode"
#define USBD_CONFIGURATION_STRING USBD_PRODUCT_STRING
Expand Down
3 changes: 2 additions & 1 deletion build/create_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Platform(IntEnum):
TRACKERM = 28
P2 = 32
MSOM = 35
ELECTRON2 = 37

class StructSerializable(struct.Struct):
def __init__(self, fmt):
Expand Down Expand Up @@ -237,7 +238,7 @@ def parse_dependency(dep):
return ModuleDependency(func, version, index)
return ModuleDependency()

GEN3_PLATFORMS = [Platform.ARGON, Platform.BORON, Platform.ASOM, Platform.BSOM, Platform.B5SOM, Platform.TRACKER, Platform.ESOMX]
GEN3_PLATFORMS = [Platform.ARGON, Platform.BORON, Platform.ASOM, Platform.BSOM, Platform.B5SOM, Platform.TRACKER, Platform.ESOMX, Platform.ELECTRON2]
GEN3_RADIO_STACK_VERSION_OFFSET = 0x300c
GEN3_RADIO_STACK_MBR_OFFSET = 0x1000
GEN3_RADIO_STACK_FLAGS = ModuleFlags.DROP_MODULE_INFO
Expand Down
6 changes: 4 additions & 2 deletions build/make_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function display_help ()
usage: make_release.sh [--debug] [--help]
[--output-directory=<binary_output_directory>]
[--platform=<all|argon|asom|boron|bsom...
|b5som|tracker|esomx|p2>]
|b5som|tracker|esomx|p2|msom|electron2>]
[--publish=<semantic_version_string>] [--tests]
Generate the binaries for a versioned release of the Device OS. This utility
Expand Down Expand Up @@ -131,7 +131,8 @@ function valid_platform()
# Validate platform (result of expression returned to caller)
[ "$platform" = "all" ] || [ "$platform" = "argon" ] || [ "$platform" = "asom" ] || \
[ "$platform" = "boron" ] || [ "$platform" = "bsom" ] || [ "$platform" = "b5som" ] || \
[ "$platform" = "esomx" ] || [ "$platform" = "tracker" ] || [ "$platform" = "p2" ] || [ "$platform" = "trackerm" ] || [ "$platform" = "msom" ]
[ "$platform" = "esomx" ] || [ "$platform" = "tracker" ] || [ "$platform" = "p2" ] || \
[ "$platform" = "trackerm" ] || [ "$platform" = "msom" ] || [ "$platform" = "electron2" ]
}

if !(valid_platform $PLATFORM); then
Expand All @@ -157,6 +158,7 @@ if [ $PLATFORM = "all" ]; then
release_platform "p2"
release_platform "trackerm"
release_platform "msom"
release_platform "electron2"
else
release_platform "$PLATFORM"
fi
Expand Down
2 changes: 1 addition & 1 deletion build/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SOURCE_PATH ?= $(MODULE_PATH)
include $(MODULE_PATH)/import.mk

# FIXME: find a better place for this
ifneq (,$(filter $(PLATFORM_ID),12 13 15 22 23 25 26))
ifneq (,$(filter $(PLATFORM_ID),12 13 15 22 23 25 26 37))
ifneq ("$(BOOTLOADER_MODULE)","1")
export SOFTDEVICE_PRESENT=y
CFLAGS += -DSOFTDEVICE_PRESENT=1
Expand Down
22 changes: 22 additions & 0 deletions build/platform-id.mk
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ ifeq ("$(PLATFORM)","msom")
PLATFORM_ID=35
endif

ifeq ("$(PLATFORM)","electron2")
PLATFORM_ID=37
endif

ifeq ("$(PLATFORM)","newhal")
PLATFORM_ID=60000
endif
Expand Down Expand Up @@ -298,6 +302,24 @@ MODULE_SUFFIX_PRODUCT_DATA_OFFSET_FROM_END=42
BOOTLOADER_USE_LTO=n
endif

ifeq ("$(PLATFORM_ID)","37")
PLATFORM=electron2
PLATFORM_NAME=electron2
PLATFORM_GEN=3
PLATFORM_MCU=nRF52840
PLATFORM_NET=QUECTEL
PLATFORM_WIZNET=W5500
MCU_DEVICE=nRF52840
PRODUCT_DESC=Production Electron 2
USBD_VID_PARTICLE=0x2B04
USBD_PID_DFU=0xD025
USBD_PID_CDC=0xC025
DEFAULT_PRODUCT_ID=$(PLATFORM_ID)
PLATFORM_DYNALIB_MODULES=$(PLATFORM_NAME)
ARM_CPU=cortex-m4
PLATFORM_THREADING=1
endif

ifeq ("$(PLATFORM_ID)","60000")
PLATFORM=newhal
# needed for conditional compilation of some MCU specific files
Expand Down
2 changes: 1 addition & 1 deletion build/release-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function valid_platform()
[ "$platform" = "argon" ] || [ "$platform" = "asom" ] || [ "$platform" = "boron" ] || \
[ "$platform" = "bsom" ] || [ "$platform" = "b5som" ] || [ "$platform" = "tracker" ] || \
[ "$platform" = "esomx" ] || [ "$platform" = "p2" ] || [ "$platform" = "trackerm" ] || \
[ "$platform" = "msom" ]
[ "$platform" = "msom" ] || [ "$platform" = "electron2" ]
}

# Identify the absolute directory
Expand Down
7 changes: 5 additions & 2 deletions build/release-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ usage: release-tests.sh [--dryrun] [--help]
[--filename=<test_parameter_file.json>]
--output-directory=<binary_output_directory>
--platform=<argon|asom|boron|bsom...
|b5som|tracker|esomx|p2>
|b5som|tracker|esomx|p2|msom|electron2>
--version=<semver_version_string>
Generate the testing binaries belonging to a given platform.
Expand Down Expand Up @@ -110,7 +110,7 @@ function valid_platform ()
[ "$platform" = "argon" ] || [ "$platform" = "asom" ] || [ "$platform" = "boron" ] || \
[ "$platform" = "bsom" ] || [ "$platform" = "b5som" ] || [ "$platform" = "tracker" ] || \
[ "$platform" = "esomx" ] || [ "$platform" = "p2" ] || [ "$platform" = "trackerm" ] || \
[ "$platform" = "msom" ]
[ "$platform" = "msom" ] || [ "$platform" = "electron2" ]
}

# Handle invalid arguments
Expand Down Expand Up @@ -163,6 +163,9 @@ case "$PLATFORM" in
"msom")
PLATFORM_ID="35"
;;
"electron2")
PLATFORM_ID="37"
;;
*)
echo "ERROR: No rules to release platform: \"$PLATFORM\"!"
exit 9
Expand Down
14 changes: 11 additions & 3 deletions build/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function display_help ()
echo '
usage: release.sh [--output-directory=<binary_output_directory>]
(--platform=<argon|asom|boron|bsom...
|b5som|esomx|p2>...
| --platform-id=<12|13|15|22|23|25|26|32>)
|b5som|esomx|p2|msom|electron2>...
| --platform-id=<12|13|15|22|23|25|26|32|35|37>)
[--debug] [--help] [--tests]
Generate the binaries for a versioned release of the Device OS. This utility
Expand Down Expand Up @@ -250,6 +250,10 @@ elif [ ! -z $PLATFORM ]; then
PLATFORM_ID="35"
GEN3=true
;;
"electron2")
PLATFORM_ID="37"
GEN3=true
;;
*)
echo "ERROR: No rules to release platform: \"$PLATFORM\"!"
exit 6
Expand Down Expand Up @@ -297,6 +301,10 @@ else
PLATFORM="msom"
GEN3=true
;;
37)
PLATFORM="electron2"
GEN3=true
;;
*)
echo "ERROR: No rules to release platform id: $PLATFORM_ID!"
exit 7
Expand Down Expand Up @@ -337,7 +345,7 @@ rm -rf $ABSOLUTE_TARGET_DIRECTORY/
#########################

# GEN3
if [ $PLATFORM_ID -eq 12 ] || [ $PLATFORM_ID -eq 13 ] || [ $PLATFORM_ID -eq 15 ] || [ $PLATFORM_ID -eq 22 ] || [ $PLATFORM_ID -eq 23 ] || [ $PLATFORM_ID -eq 25 ] || [ $PLATFORM_ID -eq 26 ] || [ $PLATFORM_ID -eq 28 ] || [ $PLATFORM_ID -eq 32 ] || [ $PLATFORM_ID -eq 35 ]; then
if [ $PLATFORM_ID -eq 12 ] || [ $PLATFORM_ID -eq 13 ] || [ $PLATFORM_ID -eq 15 ] || [ $PLATFORM_ID -eq 22 ] || [ $PLATFORM_ID -eq 23 ] || [ $PLATFORM_ID -eq 25 ] || [ $PLATFORM_ID -eq 26 ] || [ $PLATFORM_ID -eq 28 ] || [ $PLATFORM_ID -eq 32 ] || [ $PLATFORM_ID -eq 35 ] || [ $PLATFORM_ID -eq 37 ]; then
# Configure
if [ $DEBUG = true ]; then
cd ../main
Expand Down
2 changes: 1 addition & 1 deletion ci/cf_generate_message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ EOF
)

fields=""
for p in MSoM; do
for p in MSoM Electron2; do
if echo -e "${failures}" | grep -q "PLATFORM=\"${p,,}\""; then
msg=":scrum_closed: $p\\n"
else
Expand Down
8 changes: 4 additions & 4 deletions ci/enumerate_build_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ MAKE=runmake
# define build matrix dimensions
# "" means execute execute the $MAKE command without that var specified
DEBUG_BUILD=( y n )
PLATFORM=( argon boron asom bsom b5som esomx p2 trackerm msom )
PLATFORM=( argon boron asom bsom b5som esomx p2 trackerm msom electron2 )
# All modules are now built by release scripts instead, skip
# Only building applications and tests here
# PLATFORM_BOOTLOADER=( argon boron asom bsom b5som tracker esomx p2 )
# PLATFORM_BOOTLOADER=( argon boron asom bsom b5som tracker esomx p2 trackerm msom electron2 )
# PLATFORM_PREBOOTLOADER=( p2 trackerm msom )
PLATFORM_BOOTLOADER=()
PLATFORM_PREBOOTLOADER=()
APP=( "" product_id_and_version )
TEST=( wiring/api )

MODULAR_PLATFORM=( argon boron asom bsom b5som tracker esomx p2 trackerm msom )
MODULAR_PLATFORM=( argon boron asom bsom b5som tracker esomx p2 trackerm msom electron2 )

filterPlatform PLATFORM
filterPlatform MODULAR_PLATFORM
Expand Down Expand Up @@ -159,7 +159,7 @@ do
do
# Gen 3 overflows with modular DEBUG_BUILD=y, so skip those
if [[ "$db" = "y" ]]; then
if [[ "$p" = "argon" ]] || [[ "$p" = "boron" ]] || [[ "$p" = "asom" ]] || [[ "$p" = "bsom" ]] || [[ "$p" = "b5som" ]] || [[ "$p" = "tracker" ]] || [[ "$p" = "esomx" ]] || [[ "$p" = "p2" ]] || [[ "$p" = "trackerm" ]] || [[ "$p" = "msom" ]]; then
if [[ "$p" = "argon" ]] || [[ "$p" = "boron" ]] || [[ "$p" = "asom" ]] || [[ "$p" = "bsom" ]] || [[ "$p" = "b5som" ]] || [[ "$p" = "tracker" ]] || [[ "$p" = "esomx" ]] || [[ "$p" = "p2" ]] || [[ "$p" = "trackerm" ]] || [[ "$p" = "msom" ]] || [[ "$p" = "electron2" ]]; then
continue
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion communication/src/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ CPPSRC += $(TARGET_SRC_PATH)/v2/coap_api.cpp
ASRC +=

# if PLATFORM_ID matches 13 23 25 or 26, and not DEBUG_BUILD=y, set LOG_LEVEL_ERROR
ifneq (,$(filter $(PLATFORM_ID), 13 15 23 25 26))
ifneq (,$(filter $(PLATFORM_ID), 13 15 23 25 26 37))
ifneq ($(DEBUG_BUILD),y)
CFLAGS += -DLOG_COMPILE_TIME_LEVEL=LOG_LEVEL_ERROR
endif
Expand Down
2 changes: 1 addition & 1 deletion hal/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(call rwildcard,$(HAL_PLATFORM_SRC_PATH)/,sources.mk)

LOG_MODULE_CATEGORY = hal

ifneq (,$(filter $(PLATFORM_ID),13 15 23 25 26))
ifneq (,$(filter $(PLATFORM_ID),13 15 23 25 26 37))
ifneq ($(DEBUG_BUILD),y)
CFLAGS += -DLOG_COMPILE_TIME_LEVEL=LOG_LEVEL_ERROR
endif
Expand Down
1 change: 1 addition & 0 deletions hal/shared/platforms.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define PLATFORM_TRACKERM 28
#define PLATFORM_P2 32
#define PLATFORM_MSOM 35
#define PLATFORM_ELECTRON2 37
#define PLATFORM_NEWHAL 60000

#endif /* PLATFORMS_H */
Expand Down
Loading

0 comments on commit 658ff11

Please sign in to comment.