Not all ports have nvm_port_vwrite
kolen opened this issue · 1 comments
-
linux
-
esp
— just return-ENOSYS
(or -1?), no nvm -
esp32
— just return-ENOSYS
(or -1?), no nvm (at least other methods return -1) -
avr
— it has nvm implementation. AVR libc has only single block update function, source. If twodst_p
blocks are in the same eeprom page, they probably should be written in single "erase and write" operation, like ineeprom_soft
'svwrite_inner
. BTW, looks like nvm avr port, delegated to AVR-libc'seeprom_update_block
and so on, somewhat duplicates functionality of Simbaeeprom_soft
, so maybe it's okay to return-ENOSYS
here too and tell user to useeeprom_soft
for such complex cases.
Not sure about other architectures/MCUs: pic, spc56, stm32, xhypervisor
I'm trying to build hello world application for nodemcu
board using master
branch of Simba (351d933).
Makefile
:
NAME = hello_world
BOARD ?= nodemcu
SIMBA_ROOT = /Users/kolen/items/simba
PATH := $(PATH):/Users/kolen/.platformio/packages/toolchain-xtensa/bin/
include $(SIMBA_ROOT)/make/app.mk
main.c
:
#include "simba.h"
int main()
{
/* Initialize modules and start the scheduler. */
sys_start();
std_printf(FSTR("Hello world!\n"));
return (0);
}
I get this error when building it:
xtensa-lx106-elf-gcc -I. -Ibuild/nodemcu/gen -I/Users/kolen/items/simba/src -I/Users/kolen/items/simba/src/boards/nodemcu -I/Users/kolen/items/simba/src/mcus/esp8266 -I/Users/kolen/items/simba/3pp/ESP8266_RTOS_SDK/extra_include -I/Users/kolen/items/simba/3pp/ESP8266_RTOS_SDK/include -I/Users/kolen/items/simba/3pp/ESP8266_RTOS_SDK/include/espressif -I/Users/kolen/items/simba/3pp/ESP8266_RTOS_SDK/include/espressif/esp8266 -I/Users/kolen/items/simba/3pp/ESP8266_RTOS_SDK/include/lwip -I/Users/kolen/items/simba/3pp/ESP8266_RTOS_SDK/include/lwip/ipv4 -I/Users/kolen/items/simba/3pp/ESP8266_RTOS_SDK/include/lwip/ipv6 -I/Users/kolen/items/simba/src -I/Users/kolen/items/simba/3pp/compat -I/Users/kolen/items/simba/src/drivers/ports/esp -I/Users/kolen/items/simba/3pp/mbedtls/include -I/Users/kolen/items/simba/src/kernel/ports/esp/gnu -I/Users/kolen/items/simba/src/oam/ports/esp -I/Users/kolen/items/simba/3pp/spiffs-0.3.5/src -I/Users/kolen/items/simba/3pp/atto -I/Users/kolen/items/simba/3pp/atto/curses -DARCH_ESP -DFAMILY_ESP -DMCU_ESP8266 -DBOARD_NODEMCU -DVERSION=master -DMBEDTLS_USER_CONFIG_FILE="\"mbedtls/user_config.h\"" -DF_CPU=80000000UL -DICACHE_FLASH -D__STRICT_ANSI__ -D__ets__ -Os -Werror -nostdlib -mlongcalls -mtext-section-literals -ffunction-sections -fno-inline-functions -fsingle-precision-constant -fdata-sections -c -Wall -funsigned-bitfields -std=gnu99 -Wno-error=unused-variable -Wno-error=deprecated-declarations -o build/nodemcu/obj/Users/kolen/items/simba/src/oam/nvm.o /Users/kolen/items/simba/src/oam/nvm.c
/Users/kolen/items/simba/src/oam/nvm.c: In function 'nvm_vwrite':
/Users/kolen/items/simba/src/oam/nvm.c:209:5: error: implicit declaration of function 'nvm_port_vwrite' [-Werror=implicit-function-declaration]
return (nvm_port_vwrite(dst_p, src_p, length));
^
cc1: all warnings being treated as errors
make[1]: *** [build/nodemcu/obj/Users/kolen/items/simba/src/oam/nvm.o] Error 1
The same happens for nodemcu
, esp01
, esp12e
boards.
That probably means that "nvm" functionality is not supported on esp8266 (does it refer to some memory that is persistent after power off, but not main flash memory?). I was able to build using following defines (in config.h
):
#define CONFIG_NVM_EEPROM_SOFT 1
#define CONFIG_NVM_EEPROM_SOFT_CHUNK_SIZE 4
#define CONFIG_NVM_EEPROM_SOFT_BLOCK_0_SIZE 4096
#define CONFIG_NVM_EEPROM_SOFT_BLOCK_1_SIZE 32
I don't know the right values of these parameters; just setting CONFIG_NVM_EEPROM_SOFT 1
causes section `.bss' is not within region `dram0_0_seg'
linker error, I found these chunk and block sizes experimentally and not yet tested such configuration on device.
So,
- What are "sane defaults" of
*NVM_EEPROM_SOFT*
defines for esp8266? Looks like "soft nvm" uses RAM and flash ROM, and esp8266 has 80kB of user-usable RAM, and flash memory might be different on different boards but common block size is 4kB. - Can these defaults be added to default config?
Might be related to #146 (but there's runtime problem, not compile-time).
I recently added the nvm_vwrite()
function, but didn't make updates to all ports as I'm not using them and I didn't think anyone else did either.
This should be added to https://github.com/eerimoq/simba/blob/master/src/oam/ports/esp/nvm_port.i, but just as other functions in that file return a a negative error code. You can return -1.