From 8a81489e3c0bc3c20a623336972333490c696649 Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Tue, 22 Aug 2023 13:51:35 +0300 Subject: [PATCH 1/4] Keep OpenOCD package available in debug mode Resolves #213 --- platform.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform.py b/platform.py index 7aa54b2..e2dfef4 100644 --- a/platform.py +++ b/platform.py @@ -91,6 +91,9 @@ def configure_default_packages(self, variables, targets): self.packages["tool-gperf"]["optional"] = False for name in disabled_pkgs: + # OpenOCD should be available when debugging + if name == "tool-openocd" and variables.get("build_type", "") == "debug": + continue del self.packages[name] return super().configure_default_packages(variables, targets) From 66ac38de3f14fe66a64248a1888509746aeebdef Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 16 Feb 2024 17:58:43 +0200 Subject: [PATCH 2/4] Drop support for abandoned Briki boards --- boards/briki_abc_samd21.json | 60 -------- boards/briki_mbcwb_samd21.json | 60 -------- builder/frameworks/arduino.py | 7 +- builder/main.py | 18 --- .../arduino-briki-internal-libs/.gitignore | 1 - .../arduino-briki-internal-libs/README.md | 27 ---- .../include/README | 39 ----- .../arduino-briki-internal-libs/lib/README | 46 ------ .../platformio.ini | 19 --- .../src/BarometricPressureSensor.ino | 143 ------------------ .../arduino-briki-internal-libs/test/README | 11 -- platform.json | 11 -- platform.py | 6 - 13 files changed, 1 insertion(+), 447 deletions(-) delete mode 100644 boards/briki_abc_samd21.json delete mode 100644 boards/briki_mbcwb_samd21.json delete mode 100644 examples/arduino-briki-internal-libs/.gitignore delete mode 100644 examples/arduino-briki-internal-libs/README.md delete mode 100644 examples/arduino-briki-internal-libs/include/README delete mode 100644 examples/arduino-briki-internal-libs/lib/README delete mode 100644 examples/arduino-briki-internal-libs/platformio.ini delete mode 100644 examples/arduino-briki-internal-libs/src/BarometricPressureSensor.ino delete mode 100644 examples/arduino-briki-internal-libs/test/README diff --git a/boards/briki_abc_samd21.json b/boards/briki_abc_samd21.json deleted file mode 100644 index 3d1456e..0000000 --- a/boards/briki_abc_samd21.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "build": { - "arduino": { - "ldscript": "flash_with_bootloader.ld" - }, - "core": "mbcwb", - "cpu": "cortex-m0plus", - "board": "briki_abc_samd21", - "extra_flags": "-DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DBRIKI_ABC -DBRIKI_MBC_WB_SAMD -w", - "f_cpu": "48000000L", - "hwids": [ - [ - "0x3112", - "0x0001" - ], - [ - "0x3112", - "0x0002" - ] - ], - "system": "samd", - "mcu": "samd21g18a", - "usb_product": "Briki", - "variant": "briki_mbcwb_samd21" - }, - "bootloader": { - "tool": "openocd", - "file": "briki_mbc-wb/samd21_sam_ba.hex" - }, - "debug": { - "jlink_device": "ATSAMD21G18", - "openocd_chipname": "at91samd21g18", - "openocd_target": "at91samdXX", - "svd_path": "ATSAMD21G18A.svd" - }, - "frameworks": [ - "arduino" - ], - "name": "Briki ABC (MBC-WB) - Samd21", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "mbctool", - "protocols": [ - "sam-ba", - "stk500v2", - "blackmagic", - "jlink", - "atmel-ice", - "mbctool" - ], - "require_upload_port": true, - "speed": 57600, - "wait_for_upload_port": true, - "native_usb": true - }, - "url": "http://briki.org", - "vendor": "meteca" -} diff --git a/boards/briki_mbcwb_samd21.json b/boards/briki_mbcwb_samd21.json deleted file mode 100644 index 4b9ac26..0000000 --- a/boards/briki_mbcwb_samd21.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "build": { - "arduino": { - "ldscript": "flash_with_bootloader.ld" - }, - "core": "mbcwb", - "cpu": "cortex-m0plus", - "board": "briki_mbcwb_samd21", - "extra_flags": "-DARDUINO_SAMD_ZERO -D__SAMD21G18A__ -DBRIKI_MBC_WB -DBRIKI_MBC_WB_SAMD -w", - "f_cpu": "48000000L", - "hwids": [ - [ - "0x3112", - "0x0001" - ], - [ - "0x3112", - "0x0002" - ] - ], - "system": "samd", - "mcu": "samd21g18a", - "usb_product": "Briki", - "variant": "briki_mbcwb_samd21" - }, - "bootloader": { - "tool": "openocd", - "file": "briki_mbc-wb/samd21_sam_ba.hex" - }, - "debug": { - "jlink_device": "ATSAMD21G18", - "openocd_chipname": "at91samd21g18", - "openocd_target": "at91samdXX", - "svd_path": "ATSAMD21G18A.svd" - }, - "frameworks": [ - "arduino" - ], - "name": "Briki MBC-WB - Samd21", - "upload": { - "disable_flushing": true, - "maximum_ram_size": 32768, - "maximum_size": 262144, - "protocol": "mbctool", - "protocols": [ - "sam-ba", - "stk500v2", - "blackmagic", - "jlink", - "atmel-ice", - "mbctool" - ], - "require_upload_port": true, - "speed": 57600, - "wait_for_upload_port": true, - "native_usb": true - }, - "url": "http://briki.org", - "vendor": "meteca" -} diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index 990fdc8..4e0d34a 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -34,9 +34,4 @@ MCU_FAMILY = board.get( "build.system", "sam" if build_mcu.startswith("at91") else "samd") -if env.BoardConfig().get("build.core", "").lower() == "mbcwb": - env.SConscript( - os.path.join(env.PioPlatform().get_package_dir( - "framework-arduino-mbcwb"), "tools", "platformio-samd-build.py")) -else: - env.SConscript(os.path.join("arduino", "arduino-%s.py" % MCU_FAMILY)) +env.SConscript(os.path.join("arduino", "arduino-%s.py" % MCU_FAMILY)) diff --git a/builder/main.py b/builder/main.py index 3ce4945..3adf70b 100644 --- a/builder/main.py +++ b/builder/main.py @@ -261,24 +261,6 @@ def _jlink_cmd_script(env, source): env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE") ] -elif upload_protocol == "mbctool": - env.Replace( - UPLOADER=join( - platform.get_package_dir("tool-mbctool") or "", "bin", "mbctool"), - UPLOADERFLAGS=[ - "--device", "samd", - "--speed", "1500000", - "--port", '"$UPLOAD_PORT"', - "--upload", "$SOURCES", - ], - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS' - ) - upload_actions = [ - env.VerboseAction(env.AutodetectUploadPort, - "Looking for upload port..."), - env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE") - ] - elif upload_protocol in debug_tools: openocd_args = [ "-d%d" % (2 if int(ARGUMENTS.get("PIOVERBOSE", 0)) else 1) diff --git a/examples/arduino-briki-internal-libs/.gitignore b/examples/arduino-briki-internal-libs/.gitignore deleted file mode 100644 index aeaebb2..0000000 --- a/examples/arduino-briki-internal-libs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.pio \ No newline at end of file diff --git a/examples/arduino-briki-internal-libs/README.md b/examples/arduino-briki-internal-libs/README.md deleted file mode 100644 index e62b03e..0000000 --- a/examples/arduino-briki-internal-libs/README.md +++ /dev/null @@ -1,27 +0,0 @@ -How to build PlatformIO based project -===================================== - -1. [Install PlatformIO Core](https://docs.platformio.org/page/core.html) -2. Download [development platform with examples](https://github.com/platformio/platform-atmelsam/archive/develop.zip) -3. Extract ZIP archive -4. Run these commands: - -```shell -# Change directory to example -$ cd platform-atmelsam/examples/arduino-briki-internal-libs - -# Build project -$ pio run - -# Upload firmware -$ pio run --target upload - -# Build specific environment -$ pio run -e briki_mbcwb_samd21 - -# Upload firmware for the specific environment -$ pio run -e briki_mbcwb_samd21 --target upload - -# Clean build files -$ pio run --target clean -``` diff --git a/examples/arduino-briki-internal-libs/include/README b/examples/arduino-briki-internal-libs/include/README deleted file mode 100644 index 194dcd4..0000000 --- a/examples/arduino-briki-internal-libs/include/README +++ /dev/null @@ -1,39 +0,0 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the usual convention is to give header files names that end with `.h'. -It is most portable to use only letters, digits, dashes, and underscores in -header file names, and at most one dot. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/examples/arduino-briki-internal-libs/lib/README b/examples/arduino-briki-internal-libs/lib/README deleted file mode 100644 index 6debab1..0000000 --- a/examples/arduino-briki-internal-libs/lib/README +++ /dev/null @@ -1,46 +0,0 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into executable file. - -The source code of each library should be placed in a an own separate directory -("lib/your_library_name/[here are source files]"). - -For example, see a structure of the following two libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/examples/arduino-briki-internal-libs/platformio.ini b/examples/arduino-briki-internal-libs/platformio.ini deleted file mode 100644 index ced7d64..0000000 --- a/examples/arduino-briki-internal-libs/platformio.ini +++ /dev/null @@ -1,19 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter, extra scripting -; Upload options: custom port, speed and extra flags -; Library options: dependencies, extra library storages -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - - -[env:briki_abc_samd21] -platform = atmelsam -board = briki_abc_samd21 -framework = arduino - -[env:briki_mbcwb_samd21] -platform = atmelsam -board = briki_mbcwb_samd21 -framework = arduino diff --git a/examples/arduino-briki-internal-libs/src/BarometricPressureSensor.ino b/examples/arduino-briki-internal-libs/src/BarometricPressureSensor.ino deleted file mode 100644 index 8104fcb..0000000 --- a/examples/arduino-briki-internal-libs/src/BarometricPressureSensor.ino +++ /dev/null @@ -1,143 +0,0 @@ -/* - SCP1000 Barometric Pressure Sensor Display - - Shows the output of a Barometric Pressure Sensor on a - Uses the SPI library. For details on the sensor, see: - http://www.sparkfun.com/commerce/product_info.php?products_id=8161 - http://www.vti.fi/en/support/obsolete_products/pressure_sensors/ - - This sketch adapted from Nathan Seidle's SCP1000 example for PIC: - http://www.sparkfun.com/datasheets/Sensors/SCP1000-Testing.zip - - Circuit: - SCP1000 sensor attached to pins 6, 7, 10 - 13: - DRDY: pin 6 - CSB: pin 7 - MOSI: pin 11 - MISO: pin 12 - SCK: pin 13 - - created 31 July 2010 - modified 14 August 2010 - by Tom Igoe - */ - -// the sensor communicates using SPI, so include the library: -#include - -//Sensor's memory register addresses: -const int PRESSURE = 0x1F; //3 most significant bits of pressure -const int PRESSURE_LSB = 0x20; //16 least significant bits of pressure -const int TEMPERATURE = 0x21; //16 bit temperature reading -const byte READ = 0b11111100; // SCP1000's read command -const byte WRITE = 0b00000010; // SCP1000's write command - -// pins used for the connection with the sensor -// the other you need are controlled by the SPI library): -const int dataReadyPin = 6; -const int chipSelectPin = 7; - -void setup() { - Serial.begin(9600); - - // start the SPI library: - SPI.begin(); - - // initalize the data ready and chip select pins: - pinMode(dataReadyPin, INPUT); - pinMode(chipSelectPin, OUTPUT); - - //Configure SCP1000 for low noise configuration: - writeRegister(0x02, 0x2D); - writeRegister(0x01, 0x03); - writeRegister(0x03, 0x02); - // give the sensor time to set up: - delay(100); -} - -void loop() { - //Select High Resolution Mode - writeRegister(0x03, 0x0A); - - // don't do anything until the data ready pin is high: - if (digitalRead(dataReadyPin) == HIGH) { - //Read the temperature data - int tempData = readRegister(0x21, 2); - - // convert the temperature to celsius and display it: - float realTemp = (float)tempData / 20.0; - Serial.print("Temp[C]="); - Serial.print(realTemp); - - - //Read the pressure data highest 3 bits: - byte pressure_data_high = readRegister(0x1F, 1); - pressure_data_high &= 0b00000111; //you only needs bits 2 to 0 - - //Read the pressure data lower 16 bits: - unsigned int pressure_data_low = readRegister(0x20, 2); - //combine the two parts into one 19-bit number: - long pressure = ((pressure_data_high << 16) | pressure_data_low) / 4; - - // display the temperature: - Serial.println("\tPressure [Pa]=" + String(pressure)); - } -} - -//Read from or write to register from the SCP1000: -unsigned int readRegister(byte thisRegister, int bytesToRead ) { - byte inByte = 0; // incoming byte from the SPI - unsigned int result = 0; // result to return - Serial.print(thisRegister, BIN); - Serial.print("\t"); - // SCP1000 expects the register name in the upper 6 bits - // of the byte. So shift the bits left by two bits: - thisRegister = thisRegister << 2; - // now combine the address and the command into one byte - byte dataToSend = thisRegister & READ; - Serial.println(thisRegister, BIN); - // take the chip select low to select the device: - digitalWrite(chipSelectPin, LOW); - // send the device the register you want to read: - SPI.transfer(dataToSend); - // send a value of 0 to read the first byte returned: - result = SPI.transfer(0x00); - // decrement the number of bytes left to read: - bytesToRead--; - // if you still have another byte to read: - if (bytesToRead > 0) { - // shift the first byte left, then get the second byte: - result = result << 8; - inByte = SPI.transfer(0x00); - // combine the byte you just got with the previous one: - result = result | inByte; - // decrement the number of bytes left to read: - bytesToRead--; - } - // take the chip select high to de-select: - digitalWrite(chipSelectPin, HIGH); - // return the result: - return(result); -} - - -//Sends a write command to SCP1000 - -void writeRegister(byte thisRegister, byte thisValue) { - - // SCP1000 expects the register address in the upper 6 bits - // of the byte. So shift the bits left by two bits: - thisRegister = thisRegister << 2; - // now combine the register address and the command into one byte: - byte dataToSend = thisRegister | WRITE; - - // take the chip select low to select the device: - digitalWrite(chipSelectPin, LOW); - - SPI.transfer(dataToSend); //Send register location - SPI.transfer(thisValue); //Send value to record into register - - // take the chip select high to de-select: - digitalWrite(chipSelectPin, HIGH); -} - diff --git a/examples/arduino-briki-internal-libs/test/README b/examples/arduino-briki-internal-libs/test/README deleted file mode 100644 index df5066e..0000000 --- a/examples/arduino-briki-internal-libs/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PIO Unit Testing and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PIO Unit Testing: -- https://docs.platformio.org/page/plus/unit-testing.html diff --git a/platform.json b/platform.json index 76b28fe..b737029 100644 --- a/platform.json +++ b/platform.json @@ -115,12 +115,6 @@ "~1.1.0" ] }, - "framework-arduino-mbcwb": { - "type": "framework", - "optional": true, - "owner": "meteca", - "version": ">=2.1.1" - }, "framework-zephyr": { "type": "framework", "optional": true, @@ -142,11 +136,6 @@ "~1.10900.0" ] }, - "tool-mbctool": { - "optional": true, - "owner": "meteca", - "version": ">=2.0.0" - }, "tool-openocd": { "type": "uploader", "optional": true, diff --git a/platform.py b/platform.py index e2dfef4..3d5208f 100644 --- a/platform.py +++ b/platform.py @@ -35,8 +35,6 @@ def configure_default_packages(self, variables, targets): upload_tool = "tool-avrdude" elif upload_protocol == "jlink": upload_tool = "tool-jlink" - elif upload_protocol == "mbctool": - upload_tool = "tool-mbctool" if upload_tool: for name, opts in self.packages.items(): @@ -57,10 +55,6 @@ def configure_default_packages(self, variables, targets): if build_core != "arduino": framework_package += "-" + build_core - if build_core == "mbcwb": - self.packages["tool-mbctool"]["type"] = "uploader" - self.packages["tool-mbctool"]["optional"] = False - framework_package = "framework-arduino-mbcwb" self.frameworks["arduino"]["package"] = framework_package if not board.get("build.mcu", "").startswith("samd"): From f3e02fcdd193df339b941d41ca84506b4829522e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 16 Feb 2024 18:04:54 +0200 Subject: [PATCH 3/4] Drop support for abandoned Briki boards --- .github/workflows/examples.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 317a4e2..0c834a0 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -10,7 +10,6 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] example: - "examples/arduino-blink" - - "examples/arduino-briki-internal-libs" - "examples/arduino-external-libs" - "examples/arduino-internal-libs" - "examples/arduino-web-thing-led" From 9ec259c2b913e86147816feb301a1572b38671e9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 16 Feb 2024 21:28:13 +0200 Subject: [PATCH 4/4] Bump version to 8.2.1 --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index b737029..de71835 100644 --- a/platform.json +++ b/platform.json @@ -20,7 +20,7 @@ "type": "git", "url": "https://github.com/platformio/platform-atmelsam.git" }, - "version": "8.2.0", + "version": "8.2.1", "frameworks": { "arduino": { "package": "framework-arduino-sam",