loboris / MicroPython_ESP32_psRAM_LoBo

MicroPython for ESP32 with psRAM support
Other
825 stars 341 forks source link

odroid go support?!? #221

Open jedie opened 6 years ago

jedie commented 6 years ago

I have a ODROID-GO and whant to use microPython...

Specs from https://github.com/hardkernel/ODROID-GO-MicroPython :

So i guess esp32_psram_all is the best choice?!?

I made this:

MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/firmware/esp32_psram_all$ ../flash.sh

And the REPL works. But i get errors like:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 19] ENODEV

The boot output is:

ESP32: soft reboot
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5976
load:0x40078000,len:9152
ho 0 tail 12 room 4
load:0x40080000,len:6120
entry 0x40080334
I (30) boot: ESP-IDF v3.1-rc1-53509c7b 2nd stage bootloader
I (31) boot: compile time 13:16:56
I (31) boot: Enabling RNG early entropy source...
I (36) boot: SPI Speed      : 40MHz
I (40) boot: SPI Mode       : DIO
I (44) boot: SPI Flash Size : 16MB
I (49) boot: Partition Table:
I (52) boot: ## Label            Usage          Type ST Offset   Length
I (59) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (67) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (74) boot:  2 MicroPython      factory app      00 00 00010000 00220000
I (82) boot:  3 internalfs       Unknown data     01 82 00230000 00100000
I (89) boot: End of partition table
I (94) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x77898 (489624) map
I (274) esp_image: segment 1: paddr=0x000878c0 vaddr=0x3ffb0000 size=0x0574c ( 22348) load
I (283) esp_image: segment 2: paddr=0x0008d014 vaddr=0x3ffb574c size=0x00000 (     0) load
I (283) esp_image: segment 3: paddr=0x0008d01c vaddr=0x40080000 size=0x00400 (  1024) load
I (292) esp_image: segment 4: paddr=0x0008d424 vaddr=0x40080400 size=0x02bec ( 11244) load
I (305) esp_image: segment 5: paddr=0x00090018 vaddr=0x400d0018 size=0x175798 (1529752) map
I (845) esp_image: segment 6: paddr=0x002057b8 vaddr=0x40082fec size=0x1a350 (107344) load
I (890) esp_image: segment 7: paddr=0x0021fb10 vaddr=0x400c0000 size=0x00714 (  1812) load
I (891) esp_image: segment 8: paddr=0x0022022c vaddr=0x50000000 size=0x0098c (  2444) load
I (916) boot: Loaded app from partition at offset 0x10000
I (916) boot: Disabling RNG early entropy source...
I (918) spiram: SPI RAM mode: flash 40m sram 40m
I (922) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (929) cpu_start: Pro cpu up.
I (933) cpu_start: Starting app cpu, entry point is 0x400816dc
I (924) cpu_start: App cpu up.
I (1832) spiram: SPI SRAM memory test OK
I (1833) heap_init: Initializing. RAM available for dynamic allocation:
D (1833) heap_init: New heap initialised at 0x3ffae6e0
I (1838) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (1844) heap_init: New heap initialised at 0x3ffbdb28
I (1849) heap_init: At 3FFBDB28 len 000224D8 (137 KiB): DRAM
I (1856) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (1862) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (1869) heap_init: New heap initialised at 0x4009d33c
I (1874) heap_init: At 4009D33C len 00002CC4 (11 KiB): IRAM
I (1880) cpu_start: Pro cpu start user code
I (1885) spiram: Adding pool of 4096K of external SPI memory to heap allocator
D (1900) clk: RTC_SLOW_CLK calibration value: 3248832
I (122) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
D (123) heap_init: New heap initialised at 0x3ffe0440
D (127) heap_init: New heap initialised at 0x3ffe4350
D (132) MicroPython: Entry
D (1135) MicroPython: SPIRAM: Enabled
D (1145) nvs: nvs_flash_init_custom partition=nvs start=9 count=6
D (1147) MicroPython: Configure stack
D (1147) nvs: nvs_open_from_partition MPY_NVM 1
D (1149) nvs: nvs_get MPY_StackSize 4
D (1152) nvs: nvs_get_str_or_blob MpyTimeZone
D (1157) MicroPython: MPy stack: 0x3ffc126c - 0x3ffc6274 (20488)
D (1163) MicroPython: Configure heap
D (1166) nvs: nvs_get MPY_HeapSize 4
D (1170) MicroPython: MPy heap: 0x3f80001c - 0x3fb0005c (3145728)
D (1176) MicroPython: Main task exit, stack used: 1392
I (1185) MicroPython: [=== MicroPython FreeRTOS task started (sp=3ffc61c0) ===]


Internal FS (SPIFFS): Mounted on partition 'internalfs' [size: 1048576; Flash address: 0x230000]
----------------
Filesystem size: 956416 B
           Used: 512 B
           Free: 955904 B
----------------
MicroPython ESP32_LoBo_v3.2.24 - 2018-09-06 on ESP32 board with ESP32
Type "help()" for more information.
>>> 
loboris commented 6 years ago

When exactly do you get the error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 19] ENODEV

? Just waiting in the REPL, or executing some command?

jedie commented 6 years ago

e.g.: sending a file with thonny results in:

>>> %upload main.py /main.py
Traceback (most recent call last):
  File "/home/jens/repos/thonny-Env/src/thonny/thonny/plugins/micropython/__init__.py", line 860, in _check_and_upload
    self._upload(source, target)
  File "/home/jens/repos/thonny-Env/src/thonny/thonny/plugins/micropython/__init__.py", line 867, in _upload
    self._upload_via_serial(source, target)
  File "/home/jens/repos/thonny-Env/src/thonny/thonny/plugins/micropython/__init__.py", line 878, in _upload_via_serial
    self._execute_and_expect_empty_response("__upf = open(%r, 'wb')" % target)
  File "/home/jens/repos/thonny-Env/src/thonny/thonny/plugins/micropython/__init__.py", line 503, in _execute_and_expect_empty_response
    assert len(err) == 0, "Error was " + repr(err)
AssertionError: Error was bytearray(b'Traceback (most recent call last):\r\n  File "<stdin>", line 1, in <module>\r\nOSError: [Errno 19] ENODEV\r\n')
>>> 

But something like this works:

>>> import os
>>> os.listdir()
['boot.py']
>>> open("boot.py", "r").read()
"# This file is executed on every boot (including wake-boot from deepsleep)\nimport sys\nsys.path[1] = '/flash/lib'\n"
>>> open("main.py", "w").write("#test")
5
>>> open("main.py", "r").read()
'#test'

I also try to send files via rshell doesn't work:

+ rshell -p /dev/ttyUSB0 rsync -v . /pyboard
Connecting to /dev/ttyUSB0 ...
Adding /pyboard/crossbar_demo.py
timed out or error in transfer to remote

If i add --debug i can see that the timeout appears in:

----- About to send 2174 bytes of code to the pyboard -----
def recv_file_from_host(src_file, dst_filename, filesize, dst_mode='wb'):
...

How can I better find out where the problem appears?

loboris commented 6 years ago

Sorry, I've never used thonny, rshell was reported to work, but I'm not using it. I can only recommend to use FTPServer for file transfer.

jedie commented 6 years ago

Great idea. I will test it. But it would be interesting what happens in thonny. I have use ist with baseline micropython

EDIT: I also report it here: https://bitbucket.org/plas/thonny/issues/540/upload-doesnt-work-with-lobo-micropython

jedie commented 6 years ago
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 19] ENODEV

Comes from: open("/foo_bar.py", "wb") It will work, if i change the file path from '/foo_bar.py' to 'foo_bar.py'

loboris commented 6 years ago

The root of the internal FS is /flash/. So you have either to use the full path "/flash/foo_bar.py" or the relative to your current directory "/foo_bar.py".

jedie commented 6 years ago

OK... Then this can be closed... But: Is it possible to change the OSError: [Errno 19] ENODEV message to something more appropriate? e.g.: OSError: [Errno 19] Target not writable!

loboris commented 6 years ago

ENODEV is a standard error code (OS error) which means "No such device" and will be issued if some requested device (which may be file, but also something else) cannot be accessed. It would be impractical to generate more descriptive messages for all possible cases.

jedie commented 6 years ago

Ah ok! Good to know...

But can be ENODEV renamed to No such device ?