Commit graph

38 commits

Author SHA1 Message Date
Robert Quattlebaum 28a1e40ebd core/lib/settings: Generalized Settings Manager to work on any platform
This commit moves the Settings Manager from the AVR codebase
into the Contiki core library. Any platform that implements
the Contiki EEPROM API can now use the Settings Manager's
key-value store for storing their persistent configuration info.

The Settings Manager is a EEPROM-based key-value store. Keys
are 16-bit integers and values may be up to 16,383 bytes long.
It is intended to be used to store configuration-related information,
like network settings, radio channels, etc.

 * Robust data format which requires no initialization.
 * Supports multiple values with the same key.
 * Data can be appended without erasing EEPROM.
 * Max size of settings data can be easily increased in the future,
   as long as it doesn't overlap with application data.

The format was inspired by the [OLPC manufacturing data format][].

Since the beginning of EEPROM often contains application-specific
information, the best place to store settings is at the end of EEPROM
(the "top"). Because we are starting at the end of EEPROM, it makes
sense to grow the list of key-value pairs downward, toward the start of
EEPROM.

Each key-value pair is stored in memory in the following format:

Order    | Size     | Name         | Description
--------:|---------:|--------------|-------------------------------
       0 |        2 | `key`        | 16-bit key
      -2 |        1 | `size_check` | One's-complement of next byte
      -3 |   1 or 2 | `size`       | The size of `value`, in bytes
-4 or -5 | variable | `value`      | Value associated with `key`

The end of the key-value pairs is denoted by the first invalid entry.
An invalid entry has any of the following attributes:

 * The `size_check` byte doesn't match the one's compliment of the
   `size` byte (or `size_low` byte).
 * The key has a value of 0x0000.

[OLPC manufacturing data format]: http://wiki.laptop.org/go/Manufacturing_data
2013-03-20 11:57:13 -07:00
Robert Quattlebaum 67a39618eb cpu/avr: Make sure that GCC removes all unused symbols.
This magic comes from the `--gc-sections` linker flag, which turns on garbage collection for unused input sections. The compiler flags `-ffunction-sections` and `-fdata-sections` make sure that each function and each static data definition have their own section. The result is that GCC can prune away all unused symbols, reducing the size of the resulting executable.

These optimizations may be disabled by setting the Makefile variable
`SMALL` to zero.
2013-02-28 21:59:19 -08:00
David Kopf d6dc216e02 Reorder includes to prefer platform routines. Remove redundant RPL define. 2012-04-27 16:54:09 -04:00
Ilya Dmitrichenko 9c99d46e24 Simplified host OS platform detection in Makefiles 2012-02-25 10:09:33 -05:00
David Kopf 470887eddd Print elf size if ELF_SIZE is defined 2011-08-31 11:50:14 -04:00
David Kopf 5f2b2074f0 Implement WITH_RPL option in makefile 2011-08-28 16:11:48 -04:00
maniacbug 0990896f54 Added an .eu target to upload only the eeprom for AVR cpu. 2011-08-16 14:10:48 -04:00
maniacbug 8f0bb86c02 No strict aliasing for AVR
AVR build generates numerous aliasing errors.  This -f switch silences them.
2011-08-16 14:07:06 -04:00
David Kopf e2ad2acde4 Add stk500 platform and changes suggested by Daniel Willmann 2011-08-03 11:18:55 -04:00
Oliver Schmidt f83fb3704b Replaced make-empty-symbols with empty-symbols.[c|h]
The symbol generation shell scripts cause CRLF issues on Windows/Cygwin again and again. Instead of fixing this yet again I opted to remove the symbol generation script at least for the "no symbols" scenario with two C source files to be copied.
2011-04-03 13:24:58 +02:00
dak664 de7bcda99f avrdude and makefile changes suggested by Georg von Zengen 2011-03-08 13:07:00 -05:00
dak664 95982b40ba $make will show avr-size once and only once whether or not a build needs to occur. 2010-12-22 21:13:09 +00:00
dak664 9e94ba9803 Allow non-ipv6 build, e.g. Hello World 2010-11-12 17:15:00 +00:00
dak664 110bc0242e Merge CDC-ECM, RNG, DFU bootloader, watchdog, settings manager, energy scan routines of Robert Quattlebaum 2010-09-17 21:59:09 +00:00
dak664 898c00b812 Remove usually extra avr-size command 2010-06-22 17:11:38 +00:00
dak664 972e2f5d4f Add MCU to avr-size command; Remove fuse and signature from .hex; Give bootloader more memory 2010-05-04 14:14:49 +00:00
dak664 0265f09a5c Add RS232 port option to jackdaw USB stick 2010-03-15 18:52:55 +00:00
dak664 b0930cf2ec Move rtimer-arch.c inclusion from platform to cpu 2010-02-16 21:56:15 +00:00
dak664 0f59ba3187 Add rtimers, allow Jackdaw to use RF230BB driver 2010-02-16 21:48:38 +00:00
adamdunkels dea4826f94 Added watchdog.c to the USB stick code 2010-02-07 23:05:20 +00:00
adamdunkels 091483c150 Added dummy watchdog functions for all AVR platforms 2010-02-07 07:43:35 +00:00
joxe 8890904aa2 moved radio specifics out of avr Makefile and added some rs232 defs in order to get MicaZ platform working 2009-09-07 12:02:58 +00:00
dak664 283d288f1a Allow hello-world to build, fix makefile ignoring rf230bb 2009-07-26 12:10:38 +00:00
dak664 c1b7375a5a *** empty log message *** 2009-07-23 16:13:48 +00:00
dak664 49989dbe45 Add rf230bb radio driver with conditional make on RF230BB=1 2009-07-08 15:26:17 +00:00
nifi 1c6264fddc reordered build path to use cpu files before core 2009-04-06 13:10:14 +00:00
c_oflynn a520fe4646 Lots of changes / commits! This allows ravenusbstick example to build at least. 2008-10-14 19:06:51 +00:00
adamdunkels cdb6226598 Changes to support the Atmel AVR Raven port 2008-10-14 09:44:12 +00:00
oliverschmidt 604a9c2bf0 Removed (now obsolete) PROCESS_LOADABLE. 2008-02-07 19:56:56 +00:00
fros4943 3a0ba03407 added experimental avr rtimer-arch implementation
8 seconds wraparound
2007-11-29 02:44:05 +00:00
fros4943 2564882015 only create full symbols list if SYMBOLS is defined 2007-11-23 06:22:52 +00:00
fros4943 53ea3cd7bf removed symbols from .elf output (but always included with .out)
+ uncommented unused %.ce target (check Makefile.include to enable it)
2007-11-16 09:19:22 +00:00
fros4943 559e3eb6ea removed platform specific definitions
+
changed default linker to gcc (as for the default linker arguments)
2007-11-01 16:26:31 +00:00
barner 265f45feba - Fix build of contiki-2.x AVR port.
- Generate symbol tables for loadable modules.
2006-12-22 16:54:36 +00:00
fros4943 93714fc39f updated reference to "elfloader-tmp" 2006-12-18 15:17:47 +00:00
adamdunkels 8ee4f7fc3d Removed out-commented stuff from Makefiles 2006-06-24 06:23:47 +00:00
adamdunkels 62e32d2b23 Added missing includes and made Ethernut 1 & 2 ports to compile again 2006-06-20 21:23:09 +00:00
adamdunkels 710b372a2d AVR makefile 2006-06-18 07:44:59 +00:00