diff --git a/arch/stm32/stm32wl5e.ini b/arch/stm32/stm32wl5e.ini index 440c08abc1..6866d36baa 100644 --- a/arch/stm32/stm32wl5e.ini +++ b/arch/stm32/stm32wl5e.ini @@ -1,13 +1,16 @@ [stm32wl5e_base] extends = arduino_base platform = ststm32 -platform_packages = platformio/framework-arduinoststm32 @ https://github.com/stm32duino/Arduino_Core_STM32.git#2.6.0 +platform_packages = platformio/framework-arduinoststm32 @ https://github.com/stm32duino/Arduino_Core_STM32.git#2.7.1 build_type = debug +board_build.flash_offset = 0x08000000 + build_flags = ${arduino_base.build_flags} - -Isrc/platform/stm32wl -g -flto -Wl,--gc-sections + -Isrc/platform/stm32wl -g +; -DVECT_TAB_OFFSET=0x08000000 ; -DconfigUSE_CMSIS_RTOS_V2=1 ; -DSPI_MODE_0=SPI_MODE0 @@ -19,7 +22,6 @@ upload_protocol = stlink lib_deps = ${env.lib_deps} - jgromes/RadioLib@^6.2.0 charlesbaynham/OSFS@^1.2.3 https://github.com/kokke/tiny-AES-c.git#f06ac37fc31dfdaca2e0d9bec83f90d5663c319b diff --git a/boards/generic_wl5e.json b/boards/wiscore_rak3172.json similarity index 91% rename from boards/generic_wl5e.json rename to boards/wiscore_rak3172.json index 5c4bc24a75..714e09115e 100644 --- a/boards/generic_wl5e.json +++ b/boards/wiscore_rak3172.json @@ -1,5 +1,8 @@ { "build": { + "arduino": { + "variant_h": "variant_RAK3172_MODULE.h" + }, "core": "stm32", "cpu": "cortex-m4", "extra_flags": "-DSTM32WLxx -DSTM32WLE5xx -DARDUINO_GENERIC_WLE5CCUX", diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp index f20ddf748d..21f25b50aa 100644 --- a/src/FSCommon.cpp +++ b/src/FSCommon.cpp @@ -30,19 +30,21 @@ uint16_t OSFS::startOfEEPROM = 1; uint16_t OSFS::endOfEEPROM = 2048; // 3) How do I read from the medium? -void OSFS::readNBytes(uint16_t address, unsigned int num, byte* output) { - for (uint16_t i = address; i < address + num; i++) { - *output = EEPROM.read(i); - output++; - } +void OSFS::readNBytes(uint16_t address, unsigned int num, byte *output) +{ + for (uint16_t i = address; i < address + num; i++) { + *output = EEPROM.read(i); + output++; + } } // 4) How to I write to the medium? -void OSFS::writeNBytes(uint16_t address, unsigned int num, const byte* input) { - for (uint16_t i = address; i < address + num; i++) { - EEPROM.update(i, *input); - input++; - } +void OSFS::writeNBytes(uint16_t address, unsigned int num, const byte *input) +{ + for (uint16_t i = address; i < address + num; i++) { + EEPROM.update(i, *input); + input++; + } } #endif @@ -56,30 +58,30 @@ void OSFS::writeNBytes(uint16_t address, unsigned int num, const byte* input) { bool copyFile(const char *from, const char *to) { #ifdef ARCH_STM32WL - unsigned char cbuffer[2048]; + unsigned char cbuffer[2048]; + + // Var to hold the result of actions + OSFS::result r; - // Var to hold the result of actions - OSFS::result r; + r = OSFS::getFile(from, cbuffer); - r = OSFS::getFile(from, cbuffer); + if (r == notfound) { + LOG_ERROR("Failed to open source file %s\n", from); + return false; + } else if (r == noerr) { + r = OSFS::newFile(to, cbuffer, true); + if (r == noerr) { + return true; + } else { + LOG_ERROR("OSFS Error %d\n", r); + return false; + } - if (r == notfound) { - LOG_ERROR("Failed to open source file %s\n", from); - return false; - } else if (r == noerr) { - r = OSFS::newFile(to, cbuffer, true); - if (r == noerr) { - return true; } else { - LOG_ERROR("OSFS Error %d\n", r); - return false; + LOG_ERROR("OSFS Error %d\n", r); + return false; } - - } else { - LOG_ERROR("OSFS Error %d\n", r); - return false; - } -return true; + return true; #elif defined(FSCom) unsigned char cbuffer[16]; diff --git a/src/platform/stm32wl/main-stm32wl.cpp b/src/platform/stm32wl/main-stm32wl.cpp index f57928c60b..cc0cb46a13 100644 --- a/src/platform/stm32wl/main-stm32wl.cpp +++ b/src/platform/stm32wl/main-stm32wl.cpp @@ -26,11 +26,3 @@ void getMacAddr(uint8_t *dmac) } void cpuDeepSleep(uint32_t msecToWake) {} - -/* pacify libc_nano */ -extern "C" { -int _gettimeofday(struct timeval *tv, void *tzvp) -{ - return -1; -} -} diff --git a/variants/rak3172/platformio.ini b/variants/rak3172/platformio.ini index 9e1479cbb7..7f5c6425ff 100644 --- a/variants/rak3172/platformio.ini +++ b/variants/rak3172/platformio.ini @@ -1,10 +1,10 @@ [env:rak3172] extends = stm32wl5e_base board_level = extra -board = RAK3172_MODULE_dev_board +board = wiscore_rak3172 build_flags = ${stm32wl5e_base.build_flags} - -Ivariants/wio-e5 + -Ivariants/rak3172 -DHAL_DAC_MODULE_ONLY -DSERIAL_UART_INSTANCE=1 -DPIN_SERIAL_RX=PB7 diff --git a/variants/rak3172/variant.h b/variants/rak3172/variant.h index 86e58bcb2e..dd12fe393c 100644 --- a/variants/rak3172/variant.h +++ b/variants/rak3172/variant.h @@ -1,16 +1,10 @@ -/* -Wio-E5 mini (formerly LoRa-E5 mini) -https://www.seeedstudio.com/LoRa-E5-mini-STM32WLE5JC-p-4869.html -https://www.seeedstudio.com/LoRa-E5-Wireless-Module-p-4745.html -*/ - /* This variant is a work in progress. Do not expect a working Meshtastic device with this target. */ -#ifndef _VARIANT_WIOE5_ -#define _VARIANT_WIOE5_ +#ifndef _VARIANT_RAK3172_ +#define _VARIANT_RAK3172_ #define USE_STM32WLx