Skip to content

Commit

Permalink
more progress, still too big. Adding RAK3172 to the equasion
Browse files Browse the repository at this point in the history
  • Loading branch information
caveman99 committed Dec 13, 2023
1 parent 41cbf30 commit fe90751
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 50 deletions.
8 changes: 5 additions & 3 deletions arch/stm32/stm32wl5e.ini
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

Expand Down
3 changes: 3 additions & 0 deletions boards/generic_wl5e.json → boards/wiscore_rak3172.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"build": {
"arduino": {
"variant_h": "variant_RAK3172_MODULE.h"
},
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32WLxx -DSTM32WLE5xx -DARDUINO_GENERIC_WLE5CCUX",
Expand Down
60 changes: 31 additions & 29 deletions src/FSCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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];
Expand Down
8 changes: 0 additions & 8 deletions src/platform/stm32wl/main-stm32wl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
4 changes: 2 additions & 2 deletions variants/rak3172/platformio.ini
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 2 additions & 8 deletions variants/rak3172/variant.h
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit fe90751

Please sign in to comment.