MicroPython on ESP32 with SPIRAM support
Re: MicroPython on ESP32 with SPIRAM support
I'm not shure how 32-bit toolchain ended in repository, sorry about that.
The 64-bit is now pushed, you can update using git pull.
After the update just delete your Tools/xtensa-esp32-elf directory, the new one (64-bit) will be unpacked on first run of BUILD.sh.
I have also uploaded the 32-bit toolchain (Tools/Linux/xtensa-esp32-elf_32bit.tar.xz), if anyone is using 32-bit Linux.
Later, I'll update the BUILD.sh script to automatically unpack the right toolchain depending on the Linux version.
The 64-bit is now pushed, you can update using git pull.
After the update just delete your Tools/xtensa-esp32-elf directory, the new one (64-bit) will be unpacked on first run of BUILD.sh.
I have also uploaded the 32-bit toolchain (Tools/Linux/xtensa-esp32-elf_32bit.tar.xz), if anyone is using 32-bit Linux.
Later, I'll update the BUILD.sh script to automatically unpack the right toolchain depending on the Linux version.
Re: MicroPython on ESP32 with SPIRAM support
It looks there is a bug in spi initialization, I'm working on it, hope to push the fix shortly.OutoftheBOTS_ wrote: ↑Fri Jan 05, 2018 8:52 amI tried to use my program that was running on last firmware and it wouldn't run on the new firmware. The SPI threw an error
Edit: The fix is pushed, but Im still working on adding some more funstions to SPI module...
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: MicroPython on ESP32 with SPIRAM support
In menuconfig use both core for MiroPython tasks is unchecked. I should leave this unchecked for psRAM boards but checked for non psRAM boards??
Re: MicroPython on ESP32 with SPIRAM support
It makes almost no difference at the moment, it is there for the future development. I'll add the comment about that.OutoftheBOTS_ wrote: ↑Fri Jan 05, 2018 7:45 pmIn menuconfig use both core for MiroPython tasks is unchecked. I should leave this unchecked for psRAM boards but checked for non psRAM boards??
It is in no way related to psRAM.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: MicroPython on ESP32 with SPIRAM support
There is also a bug in the deint() for the SPI it throws this error
Code: Select all
OSError: error at deinitialization
Re: MicroPython on ESP32 with SPIRAM support
How do I add a custom C-module?
I added it to SRC_C in components/microphython/component.mk.
It compiles, but does not get included in the firmware.
Code (with probably more headers than I need):
I added it to SRC_C in components/microphython/component.mk.
It compiles, but does not get included in the firmware.
Code (with probably more headers than I need):
Code: Select all
#include <stdio.h>
#include <sys/time.h>
#include <time.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "rom/uart.h"
#include "esp_task_wdt.h"
#include "py/nlr.h"
#include "py/obj.h"
#include "py/mpstate.h"
#include "py/mphal.h"
#include "extmod/misc.h"
#include "lib/utils/pyexec.h"
#include "uart.h"
#include "sdkconfig.h"
//-----------------------------------
// does nothing for now ...
STATIC mp_obj_t iot49_sleep_us(mp_obj_t arg) {
mp_int_t us = mp_obj_get_int(arg);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(iot49_sleep_us_obj, iot49_sleep_us);
//===============================================================
STATIC const mp_rom_map_elem_t iot49_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_iot49) },
{ MP_ROM_QSTR(MP_QSTR_sleep_us), MP_ROM_PTR(&iot49_sleep_us_obj) },
};
STATIC MP_DEFINE_CONST_DICT(
iot49_module_globals,
iot49_module_globals_table
);
//=========================================
const mp_obj_module_t mp_module_iot49 = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&iot49_module_globals,
};
Re: MicroPython on ESP32 with SPIRAM support
If you look at the end of mpconfigport.h, there is a section where the modules a listed. You may add your module there, taking one of the existing definitions as template.
Re: MicroPython on ESP32 with SPIRAM support
To add your c-module mp_module_iot49 to the built-in modeles edit the mpconfigport.h:
Add before #define MICROPY_PORT_BUILTIN_MODULES
Code: Select all
extern const struct _mp_obj_module_t mp_module_iot49;
#define BUILTIN_MODULE_IOT49 { MP_OBJ_NEW_QSTR(MP_QSTR_iot49), (mp_obj_t)&mp_module_iot49 },
Code: Select all
BUILTIN_MODULE_IOT49 \
Code: Select all
./BUILD.sh clean all
Re: MicroPython on ESP32 with SPIRAM support
@roberthh and @loboris: Thanks a million, everything works now as expected!
Bernhard Boser