diff --git a/.gitmodules b/.gitmodules index b1d534f..6aad40b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "builder/frameworks/arduino"] path = builder/frameworks/arduino - url = https://github.com/platformio/builder-framework-arduino-nrf5.git + url = https://github.com/maxgerhardt/builder-framework-arduino-nrf5.git diff --git a/boards/xiaoble.json b/boards/xiaoble.json new file mode 100644 index 0000000..3957da4 --- /dev/null +++ b/boards/xiaoble.json @@ -0,0 +1,60 @@ +{ + "build": { + "arduino": { + "ldscript": "linker_script.ld" + }, + "core": "arduino", + "cpu": "cortex-m4", + "extra_flags": "-DSEEED_XIAO_NRF52840 -DARDUINO_ARCH_NRF52840", + "f_cpu": "64000000L", + "hwids": [ + [ + "0x2886", + "0x0045" + ], + [ + "0x2886", + "0x8045" + ] + ], + "mcu": "nrf52840", + "variant": "SEEED_XIAO_NRF52840", + "softdevice": { + "sd_flags": "-DS140", + "sd_name": "s140", + "sd_version": "7.3.0", + "sd_fwid": "0x0123" + } + }, + "connectivity": [ + "bluetooth" + ], + "debug": { + "jlink_device": "nRF52840_xxAA", + "openocd_target": "nrf52.cfg", + "svd_path": "nrf52840.svd" + }, + "frameworks": [ + "arduino" + ], + "name": "Seeed XIAO BLE nRF52840", + "upload": { + "maximum_ram_size": 237568, + "maximum_size": 811008, + "protocol": "nrfutil", + "speed": 115200, + "protocols": [ + "jlink", + "nrfjprog", + "nrfutil", + "cmsis-dap", + "sam-ba", + "blackmagic" + ], + "use_1200bps_touch": true, + "require_upload_port": true, + "wait_for_upload_port": true + }, + "url": "https://wiki.seeedstudio.com/XIAO_BLE", + "vendor": "Seeed Studio" +} diff --git a/boards/xiaoble_adafruit.json b/boards/xiaoble_adafruit.json new file mode 100644 index 0000000..5bdbc1e --- /dev/null +++ b/boards/xiaoble_adafruit.json @@ -0,0 +1,64 @@ +{ + "build": { + "arduino": { + "ldscript": "nrf52840_s140_v7.ld" + }, + "core": "nRF5", + "cpu": "cortex-m4", + "extra_flags": "-DARDUINO_Seeed_XIAO_nRF52840 -DNRF52840_XXAA", + "f_cpu": "64000000L", + "hwids": [ + [ + "0x2886", + "0x8044" + ], + [ + "0x2886", + "0x0044" + ] + ], + "mcu": "nrf52840", + "variant": "Seeed_XIAO_nRF52840", + "softdevice": { + "sd_flags": "-DS140", + "sd_name": "s140", + "sd_version": "7.3.0", + "sd_fwid": "0x0123" + }, + "bsp": { + "name": "adafruit" + }, + "usb_product": "XIAO nRF52840" + }, + "connectivity": [ + "bluetooth" + ], + "debug": { + "jlink_device": "nRF52840_xxAA", + "openocd_target": "nrf52.cfg", + "svd_path": "nrf52840.svd" + }, + "frameworks": [ + "arduino" + ], + "name": "Seeed XIAO BLE nRF52840", + "upload": { + "maximum_ram_size": 237568, + "maximum_size": 811008, + "protocol": "nrfutil", + "speed": 115200, + "protocols": [ + "jlink", + "nrfjprog", + "nrfutil", + "cmsis-dap", + "sam-ba", + "blackmagic" + ], + "use_1200bps_touch": true, + "require_upload_port": true, + "wait_for_upload_port": true + }, + "url": "https://wiki.seeedstudio.com/XIAO_BLE", + "vendor": "Seeed" +} diff --git a/boards/xiaoblesense.json b/boards/xiaoblesense.json new file mode 100644 index 0000000..8652c45 --- /dev/null +++ b/boards/xiaoblesense.json @@ -0,0 +1,60 @@ +{ + "build": { + "arduino": { + "ldscript": "linker_script.ld" + }, + "core": "arduino", + "cpu": "cortex-m4", + "extra_flags": "-DSEEED_XIAO_NRF52840_SENSE -DARDUINO_ARCH_NRF52840", + "f_cpu": "64000000L", + "hwids": [ + [ + "0x2886", + "0x0045" + ], + [ + "0x2886", + "0x8045" + ] + ], + "mcu": "nrf52840", + "variant": "SEEED_XIAO_NRF52840_SENSE", + "softdevice": { + "sd_flags": "-DS140", + "sd_name": "s140", + "sd_version": "7.3.0", + "sd_fwid": "0x0123" + } + }, + "connectivity": [ + "bluetooth" + ], + "debug": { + "jlink_device": "nRF52840_xxAA", + "openocd_target": "nrf52.cfg", + "svd_path": "nrf52840.svd" + }, + "frameworks": [ + "arduino" + ], + "name": "Seeed XIAO BLE Sense", + "upload": { + "maximum_ram_size": 237568, + "maximum_size": 811008, + "protocol": "nrfutil", + "speed": 115200, + "protocols": [ + "jlink", + "nrfjprog", + "nrfutil", + "cmsis-dap", + "sam-ba", + "blackmagic" + ], + "use_1200bps_touch": true, + "require_upload_port": true, + "wait_for_upload_port": true + }, + "url": "https://wiki.seeedstudio.com/XIAO_BLE", + "vendor": "Seeed Studio" +} diff --git a/boards/xiaoblesense_adafruit.json b/boards/xiaoblesense_adafruit.json new file mode 100644 index 0000000..1f68b1c --- /dev/null +++ b/boards/xiaoblesense_adafruit.json @@ -0,0 +1,64 @@ +{ + "build": { + "arduino": { + "ldscript": "nrf52840_s140_v7.ld" + }, + "core": "nRF5", + "cpu": "cortex-m4", + "extra_flags": "-DARDUINO_Seeed_XIAO_nRF52840_Sense -DNRF52840_XXAA", + "f_cpu": "64000000L", + "hwids": [ + [ + "0x2886", + "0x8045" + ], + [ + "0x2886", + "0x0045" + ] + ], + "mcu": "nrf52840", + "variant": "Seeed_XIAO_nRF52840_Sense", + "softdevice": { + "sd_flags": "-DS140", + "sd_name": "s140", + "sd_version": "7.3.0", + "sd_fwid": "0x0123" + }, + "bsp": { + "name": "adafruit" + }, + "usb_product": "XIAO nRF52840 Sense" + }, + "connectivity": [ + "bluetooth" + ], + "debug": { + "jlink_device": "nRF52840_xxAA", + "openocd_target": "nrf52.cfg", + "svd_path": "nrf52840.svd" + }, + "frameworks": [ + "arduino" + ], + "name": "Seeed XIAO BLE Sense", + "upload": { + "maximum_ram_size": 237568, + "maximum_size": 811008, + "protocol": "nrfutil", + "speed": 115200, + "protocols": [ + "jlink", + "nrfjprog", + "nrfutil", + "cmsis-dap", + "sam-ba", + "blackmagic" + ], + "use_1200bps_touch": true, + "require_upload_port": true, + "wait_for_upload_port": true + }, + "url": "https://wiki.seeedstudio.com/XIAO_BLE", + "vendor": "Seeed" +} diff --git a/builder/frameworks/arduino b/builder/frameworks/arduino index 9e9dd6e..cc60b35 160000 --- a/builder/frameworks/arduino +++ b/builder/frameworks/arduino @@ -1 +1 @@ -Subproject commit 9e9dd6e8cf81e0d0000748f15172c487e7907f56 +Subproject commit cc60b35642984f2244491086664463784f90da06 diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index 3f01755..d0ef637 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -43,3 +43,23 @@ platform = nordicnrf52 framework = arduino board = stct_nrf52_minidev build_flags = -DNRF52_S132 + +[env:xiaoblesense] +platform = nordicnrf52 +framework = arduino +board = xiaoblesense + +[env:xiaoble] +platform = nordicnrf52 +framework = arduino +board = xiaoble + +[env:xiaoblesense_adafruit] +platform = nordicnrf52 +framework = arduino +board = xiaoblesense_adafruit + +[env:xiaoble_adafruit] +platform = nordicnrf52 +framework = arduino +board = xiaoble_adafruit \ No newline at end of file diff --git a/examples/arduino-bluefruit-bleuart/platformio.ini b/examples/arduino-bluefruit-bleuart/platformio.ini index 955918b..5c80bde 100644 --- a/examples/arduino-bluefruit-bleuart/platformio.ini +++ b/examples/arduino-bluefruit-bleuart/platformio.ini @@ -48,3 +48,15 @@ platform = nordicnrf52 framework = arduino board = adafruit_ledglasses_nrf52840 monitor_speed = 115200 + +[env:xiaoblesense_adafruit] +platform = nordicnrf52 +framework = arduino +board = xiaoblesense_adafruit +monitor_speed = 115200 + +[env:xiaoble_adafruit] +platform = nordicnrf52 +framework = arduino +board = xiaoble_adafruit +monitor_speed = 115200 diff --git a/platform.json b/platform.json index 11e3249..6e61b1a 100644 --- a/platform.json +++ b/platform.json @@ -55,6 +55,12 @@ "owner": "platformio", "version": "~1.10500.0" }, + "framework-arduinoadafruitnrf52-seeed": { + "type": "framework", + "optional": true, + "owner": "platformio", + "version": "https://github.com/maxgerhardt/framework-arduinoadafruitnrf52-seeed.git" + }, "framework-arduinonordicnrf5": { "type": "framework", "optional": true, @@ -67,6 +73,11 @@ "owner": "platformio", "version": "~4.0.2" }, + "framework-arduino-mbed-seeed": { + "type": "framework", + "optional": true, + "version": "https://github.com/maxgerhardt/framework-mbed-seeed.git" + }, "framework-cmsis": { "type": "framework", "optional": true, diff --git a/platform.py b/platform.py index e477696..d8c0730 100644 --- a/platform.py +++ b/platform.py @@ -37,8 +37,12 @@ def configure_default_packages(self, variables, targets): if self.board_config(board).get("build.bsp.name", "nrf5") == "adafruit": - self.frameworks["arduino"][ - "package"] = "framework-arduinoadafruitnrf52" + if board in ("xiaoblesense_adafruit", "xiaoble_adafruit"): + self.frameworks["arduino"][ + "package"] = "framework-arduinoadafruitnrf52-seeed" + else: + self.frameworks["arduino"][ + "package"] = "framework-arduinoadafruitnrf52" self.packages["framework-cmsis"]["optional"] = False self.packages["tool-adafruit-nrfutil"]["optional"] = False @@ -53,9 +57,14 @@ def configure_default_packages(self, variables, targets): if not IS_WINDOWS: self.packages["tool-gperf"]["optional"] = False - if board in ("nano33ble", "nicla_sense_me"): + if board in ("nano33ble", "nicla_sense_me", "xiaoblesense", "xiaoble"): self.packages["toolchain-gccarmnoneeabi"]["version"] = "~1.80201.0" - self.frameworks["arduino"]["package"] = "framework-arduino-mbed" + if board in ("xiaoblesense", "xiaoble"): + self.frameworks["arduino"]["package"] = "framework-arduino-mbed-seeed" + # needed to build the ZIP file + self.packages["tool-adafruit-nrfutil"]["optional"] = False + else: + self.frameworks["arduino"]["package"] = "framework-arduino-mbed" self.frameworks["arduino"][ "script" ] = "builder/frameworks/arduino/mbed-core/arduino-core-mbed.py"