SmingHub / Sming

Sming - powerful open source framework simplifying the creation of embedded C++ applications.
https://sming.readthedocs.io
GNU Lesser General Public License v3.0
1.48k stars 347 forks source link

spiffs-two-roms hardware profile fails to boot #2310

Closed kmihaylov closed 3 years ago

kmihaylov commented 3 years ago

With Sming 07ecd3bdf33f5b56ec1c32c9587df456ffaa4c07 (older too) Basic_Blink using HWCONFIG := spiffs-two-roms set in component.mk fails to run on the device. At boot this happens:

--- DTR inactive ---
--- RTS inactive ---
rd$ܾ��l�|
            �$�p�r���{���
                              c��no�$no���bp��$rdrlp�o�

                                                           �
                                                            l
                                                             

                                                              "
                                                                o�|l��
                                                                        c��no�$��d �no$`Nr���N

                                                                                                    r�l`p�N�s�����

and it continues forever.

With standard hwconfig the device boots sucessfully.

mikee47 commented 3 years ago

I've attempted to reproduce this issue as follows:

  1. Edit component.mk
HWCONFIG = standard
  1. Build and flash
make flash
  1. Edit component.mk
HWCONFIG = spiffs-two-roms
SPIFF_FILES =
  1. Clean, build and flash
make config-clean
make flash

No problem so far...

mikee47 commented 3 years ago

Note: to see that actual error above set COM_SPEED=74880

slaff commented 3 years ago

I guess you can try:

make flashinit

and then flash the application on the device.

kmihaylov commented 3 years ago

I did

make flashinit

Modified component.mk with these changes:

## Select source of content for default `spiffs` partition when built
SPIFF_FILES = 

## Refer to Basic_rBoot sample for options relating to rBoot
HWCONFIG = spiffs-two-roms

Then

make config-clean
make flash

And this is the result:

--- DTR inactive ---
--- RTS inactive ---

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 1240, room 16 
tail 8
chksum 0xc5
load 0x3ffe8000, len 640, room 0 
tail 0
chksum 0x07
csum 0x07

rBoot v1.4.2 - richardaburton@gmail.com
Flash Size:   32 Mbit
Flash Mode:   DIO
Flash Speed:  40 MHz

Resetting boot config.
Invalid rom selected, defaulting to 0.
Rom 0 at 0 is bad.
Rom -1 at 0 is bad.
Rom -1 at 0 is bad.
Rom -1 at 0 is bad.

According to this output it should have flashed the partition table...

WriteFlash 0x00000=out/Esp8266/debug/firmware/rboot.bin 0x003fa000=out/Esp8266/debug/firmware/partitions.bin 0x00002000=out/Esp8266/debug/firmware/rom0.bin 0x00108000=out/Esp8266/debug/firmware/rom1.bin 0x00200000=out/Esp8266/debug/firmware/spiff_rom.bin  0x003fc000=/opt/Sming/Sming/Arch/Esp8266/Components/esp8266/ESP8266_NONOS_SDK/bin/esp_init_data_default.bin 
python3 /opt/Sming/Sming/Components/esptool/esptool/esptool.py -p /dev/ttyUSB0 -b 115200 --chip esp8266 --before default_reset --after hard_reset write_flash -z -fs 4MB -ff 40m -fm dio 0x00000 out/Esp8266/debug/firmware/rboot.bin 0x003fa000 out/Esp8266/debug/firmware/partitions.bin 0x00002000 out/Esp8266/debug/firmware/rom0.bin 0x00108000 out/Esp8266/debug/firmware/rom1.bin 0x00200000 out/Esp8266/debug/firmware/spiff_rom.bin  0x003fc000 /opt/Sming/Sming/Arch/Esp8266/Components/esp8266/ESP8266_NONOS_SDK/bin/esp_init_data_default.bin

Btw is there a shortcut to read the partition table? make readpart PART=rom0 is for the slot, but for the partition table?

Edit:

md5sum out/Esp8266/debug/firmware/rom0.bin out/Esp8266/debug/rom0.read.bin 
034525860d2e4a88eb9d91b4cb9de626  out/Esp8266/debug/firmware/rom0.bin
de1765b14a2e381d9b11a46b0abaa5db  out/Esp8266/debug/rom0.read.bin

Also tried

make flashpart PART=rom0

without success.

===========

Edit 2:

Aaargh, here it is:

Partition map read from device:
Device            Start       End         Size        Type      SubType   Name              Filename
----------------  ----------  ----------  ----------  --------  --------  ----------------  ------------
spiFlash          0x00002000  0x000f9fff        992K  app       ota_0     rom0              
spiFlash          0x000fa000  0x00107fff         56K                      (unused)          
spiFlash          0x00108000  0x001fffff        992K  app       ota_1     rom1              
spiFlash          0x00200000  0x0027ffff        512K  data      spiffs    spiffs0           
spiFlash          0x00280000  0x003fafff       1516K                      (unused)          
spiFlash          0x003fb000  0x003fbfff          4K  data      rfcal     rf_cal            
spiFlash          0x003fc000  0x003fcfff          4K  data      phy       phy_init          
spiFlash          0x003fd000  0x003fffff         12K  data      sysparam  sys_param

And

Basic_Blink: Invoking 'map' for Esp8266 (debug) architecture
Partition map: spiffs-two-roms
options: 4m, spiffs
Device            Start       End         Size        Type      SubType   Name              Filename
----------------  ----------  ----------  ----------  --------  --------  ----------------  ------------
spiFlash          0x00000000  0x00001fff          8K                      Boot Sector       
spiFlash          0x00002000  0x000f9fff        992K  app       ota_0     rom0              $(RBOOT_ROM_0_BIN)
spiFlash          0x000fa000  0x00107fff         56K                      (unused)          
spiFlash          0x00108000  0x001fffff        992K  app       ota_1     rom1              $(RBOOT_ROM_1_BIN)
spiFlash          0x00200000  0x0027ffff        512K  data      spiffs    spiffs0           $(SPIFF_BIN_OUT)
spiFlash          0x00280000  0x003f9fff       1512K                      (unused)          
spiFlash          0x003fa000  0x003fafff          4K                      Partition Table   
spiFlash          0x003fb000  0x003fbfff          4K  data      rfcal     rf_cal            
spiFlash          0x003fc000  0x003fcfff          4K  data      phy       phy_init          $(FLASH_INIT_DATA)
spiFlash          0x003fd000  0x003fffff         12K  data      sysparam  sys_param

Why wouldn't it flash the new map?

kmihaylov commented 3 years ago

The problem was due to my (mis)use of EQT gnu23 instead of the supported gnu20 version.