cyberman54 / ESP32-Paxcounter

Wifi & BLE driven passenger flow metering with cheap ESP32 boards
https://cyberman54.github.io/ESP32-Paxcounter/
Other
1.72k stars 401 forks source link

min_spiffs.csv partition table not selected any more, causing flash mem shortage #438

Closed netmonk closed 4 years ago

netmonk commented 5 years ago

I just received the latest lilygo tbeam board t22-v1.0 20190612. Seems you merged your sources tree to support this board.

When using plateformio with Code on linux, i get this message :

Retrieving maximum program size .pio/build/usb/firmware_ttgobeam10_v1.8.02.elf
Building .pio/build/usb/firmware_ttgobeam10_v1.8.02.bin
Checking size .pio/build/usb/firmware_ttgobeam10_v1.8.02.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [=         ]   5.3% (used 70120 bytes from 1310720 bytes)
PROGRAM: [====Error: The program size (1674946 bytes) is greater than maximum allowed (1310720 bytes)
======]  12*** [checkprogsize] Explicit exit, status 1
7.8% (used 1674946 bytes from 1310720 bytes)

I tried to change the board value in the plateformio.ini to ttgo-t-beam with board def you can find in .platformio/platforms/espressif32/boards This time it uploads correctly, but screen not working although i declared it in ttgobeam10.h

// display (if connected)
#define HAS_DISPLAY U8X8_SSD1306_128X64_NONAME_HW_I2C
#define MY_OLED_SDA 21
#define MY_OLED_SCL 22
#define MY_OLED_RST 5
//#define DISPLAY_FLIP  1 // use if display is rotated

Several time i had also some error with vbat sensor :

And i got this error to :

Compiling .pio/build/usb/lib951/MCCI LoRaWAN LMIC library/hal/getpinmap_ttgo_lora32_v1.cpp.o
.pio/libdeps/usb/MCCI LoRaWAN LMIC library/src/hal/getpinmap_thisboard.cpp: In function 'const Arduino_LMIC::HalPinmap_t* Arduino_LMIC::GetPinmap_ThisBoard()':
.pio/libdeps/usb/MCCI LoRaWAN LMIC library/src/hal/getpinmap_thisboard.cpp:61:72: note: #pragma message: Board not supported -- use an explicit pinmap
         #pragma message("Board not supported -- use an explicit pinmap")

Can you help ?

cyberman54 commented 5 years ago

I cannot reproduce this, i see 87,5% memory utilization. Which platformio version do you have in use?

Building .pio\build\usb\firmware_ttgobeam10_v1.8.03.bin esptool.py v2.6 Memory Usage -> http://bit.ly/pio-memory-usage DATA: [ ] 4.1% (used 54016 bytes from 1310720 bytes) PROGRAM: [========= ] 87.5% (used 1147398 bytes from 1310720 bytes)

I tried to change the board value in the plateformio.ini to ttgo-t-beam with board def you can find in .platformio/platforms/espressif32/boards This time it uploads correctly, but screen not working although i declared it in ttgobeam10.h

This way you are using the original T-Beam pin definitions, served by pins_arduino.h from the esp32-arduino library. This won't work, because definitions for paxcounter are missing then.

pragma message("Board not supported -- use an explicit pinmap")

This is normal (and intentional by the author of the lib), doesn't affect anything here. You can ignore this.

netmonk commented 5 years ago

Plateformio ide 1.8.3 into vscode. I just tried to do the same on my laptop from a fresh install, got same result :

Linking .pio/build/usb/firmware_ttgobeam10_v1.8.02.elf
Building .pio/build/usb/firmware_ttgobeam10_v1.8.02.bin
Retrieving maximum program size .pio/build/usb/firmware_ttgobeam10_v1.8.02.elf
Checking size .pio/build/usb/firmware_ttgobeam10_v1.8.02.elf
Memory Usage -> http://bit.ly/pio-memory-usage
Error: The program size (1661078 bytes) is greater than maximum allowed (1310720 bytes)
DATA:    [=         ]   5.3% (used 69864 bytes from 1310720 bytes)
*** [checkprogsize] Explicit exit, status 1
PROGRAM: [==========]  126.7% (used 1661078 bytes from 1310720 bytes)
esptool.py v2.6
=============================================== [FAILED] Took 96.19 seconds ===============================================

Environment    Status    Duration
-------------  --------  ------------
ota            IGNORED
usb            FAILED    00:01:36.188
dev            IGNORED
========================================== 1 failed, 0 succeeded in 00:01:36.188 ==========================================
The terminal process terminated with exit code: 1
cyberman54 commented 5 years ago

We need the pio version number, this is either 3.6.x (which can't work) or 4.x (which we need to know). Open console any type pio --version

netmonk commented 5 years ago

plonky@nanonetmonk:~/work$ pio --version PlatformIO, version 4.0.3

cyberman54 commented 5 years ago

Same here, can't reproduce it yet. Maybe depending on Linux / Windows.

netmonk commented 5 years ago

So where should i look ?

cyberman54 commented 5 years ago

@netmonk There is some dirty magic happening in https://github.com/cyberman54/ESP32-Paxcounter/blob/master/build.py#L67 which defines the target board during platformio pre-compile phase. I guess this could cause the issue seen here.

Goal was to give the user a single point of selecting the target board in platformio.ini .This is realized with the above build.py script. Of course you can create own platformio.ini tailored by hand to your needed settings. If you find a working solution to keep this somehow automated, your PR for this would be highly welcome.

Before i had recurring "issues" by end user who did not understand platformio and were not able to tailor suitable platformio.ini file for their needs.

netmonk commented 5 years ago

What would be the command line if i wanted to flash myself the memory ? I tried

sudo python esptool.py --port /dev/ttyUSB0 write_flash 0x10000 ~/work/ESP32-Paxcounter/.pio/build/usb/firmware_ttgobeam10_v1.8.02.bin 
esptool.py v2.7
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 80:7d:3a:d4:43:4c
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 1675200 bytes to 967069...
Wrote 1675200 bytes (967069 compressed) at 0x00010000 in 85.4 seconds (effective 156.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

but nothing happens (no oled neither led lighting)

netmonk commented 5 years ago

Well you are right, i admit i discovered PIO just since last saturday...basically was doing stuff on arduino IDE. But, if a project says it support a board, well i expect it to compile, produce a firmware and flash it without trouble. Else, it's just partial support or not support. i tend to always check twice on my side before asking for support, or help, always fearing to look like an idiot, but i have to admi this issue is quite troublesome. I have an ttn-mapper working ok on the other board, it tooks me like 15 minutes from git clone to have something working. (but it was arduino-ide).

netmonk commented 5 years ago

Did you try to build with BLE activated ? without BLE i have not ISSUE to upload. Now it doesn't display anything but at least firmware is uploaded.

cyberman54 commented 5 years ago

The min_spiffs.csv partition was not selected. You should see 1966080 bytes of usable Flash.

cyberman54 commented 5 years ago

@netmonk this is open source software, free and you don't pay a penny. If you find errors, don't complain, but solve them, contributing to the project. If you want support, please select commercial software and pay for it.

netmonk commented 5 years ago

What i mean is in platformio.ini min_spiffs.csv is defined. Didnt touch about this parameter. Why then it's loading default and not min_spiffs.csv ?

cyberman54 commented 5 years ago

Maybe you can find out, find solution and make PR? I think it's the build script which rewrites the board setting

cyberman54 commented 4 years ago

Fixed.

https://github.com/cyberman54/ESP32-Paxcounter/pull/441

cyberman54 commented 4 years ago

@netmonk I found a workaround to ensure selection of partition table. Could you please re-test? Thanks.

netmonk commented 4 years ago

i'm checking

netmonk commented 4 years ago

it works ! i didnt test lora part cause i dont have lora gw currently, but gps/wifi/ble/screen is working nice no more upload issue