cpu/native: Add file-backed simulated EEPROM to native cpu.
This patch removes a defunct EEPROM implementation from the native platform and provides a new EEPROM implementation for the native cpu. The previous implementation appears to be vestigal. This is useful for testing code which uses the EEPROM without running the code on the actual hardware. By default the code will create a new temporary file as the EEPROM backing, reinitializing each time. If you would like to preserve the EEPROM contents or specify a specific EEPROM file to use, you can set the `CONTIKI_EEPROM` environment variable to the name of the EEPROM file you wish to use instead. If it already exists, its contents will be used. If it does not already exist, it will be created and initialized by filling it with `0xFF`---just like a real EEPROM. A new example is also included, which was used to verify the correctness of the implementation. It can easily be used to verify the EEPROM implementations of other targets.
This commit is contained in:
parent
5af6540980
commit
b8c0f2de6c
10 changed files with 298 additions and 69 deletions
|
@ -55,7 +55,20 @@
|
|||
#define __EEPROM_H__
|
||||
|
||||
typedef unsigned short eeprom_addr_t;
|
||||
#define EEPROM_NULL 0
|
||||
|
||||
#define EEPROM_NULL 0
|
||||
|
||||
#ifdef EEPROM_CONF_SIZE
|
||||
#define EEPROM_SIZE (EEPROM_CONF_SIZE)
|
||||
#else
|
||||
#define EEPROM_SIZE 0 /* Default to no EEPROM */
|
||||
#endif
|
||||
|
||||
#ifdef EEPROM_CONF_END_ADDR
|
||||
#define EEPROM_END_ADDR (EEPROM_CONF_END_ADDR)
|
||||
#else
|
||||
#define EEPROM_END_ADDR (EEPROM_SIZE - 1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Write a buffer into EEPROM.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue