Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all ports have nvm_port_vwrite #205

Open
1 of 4 tasks
kolen opened this issue Jan 10, 2019 · 1 comment
Open
1 of 4 tasks

Not all ports have nvm_port_vwrite #205

kolen opened this issue Jan 10, 2019 · 1 comment

Comments

@kolen
Copy link

kolen commented Jan 10, 2019

  • 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 two dst_p blocks are in the same eeprom page, they probably should be written in single "erase and write" operation, like in eeprom_soft's vwrite_inner. BTW, looks like nvm avr port, delegated to AVR-libc's eeprom_update_block and so on, somewhat duplicates functionality of Simba eeprom_soft, so maybe it's okay to return -ENOSYS here too and tell user to use eeprom_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,

  1. 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.
  2. Can these defaults be added to default config?

Might be related to #146 (but there's runtime problem, not compile-time).

@eerimoq
Copy link
Owner

eerimoq commented Jan 10, 2019

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.

@kolen kolen changed the title Default configuration for esp8266 does not build: no nvm_port_vwrite Not all ports have nvm_port_vwrite Jan 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants