HUGE AVR RAM optimization (~28%).

- It's possible to get even more, but this is probably as far as I'll go
- PROGMEM is really annoying to use, and makes the code look like ass
- Now the Teensy 2++ should have enough RAM to use PartialMap easily
This commit is contained in:
Jacob Alexander 2014-10-02 22:09:34 -07:00
parent 22abefcf1e
commit 6e4c28ef84
10 changed files with 152 additions and 72 deletions

View file

@ -38,13 +38,44 @@
#define CLIEntryTabAlign 13
// ----- Macros -----
// AVR CLI Dictionary definitions (has to deal with the annoying PROGMEM
// Only using PROGMEM with descriptions (all the string comparison tools need to be re-written otherwise)
#if defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR
#define CLIDict_Def(name,description) \
const PROGMEM char name##Name[] = description; \
const CLIDictItem name[]
#define CLIDict_Item(name) \
{ #name, name##CLIDict_DescEntry, (const void (*)(char*))cliFunc_##name }
#define CLIDict_Entry(name,description) \
const PROGMEM char name##CLIDict_DescEntry[] = description;
// ARM is easy :P
#elif defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) // ARM
#define CLIDict_Def(name,description) \
const char name##Name[] = description; \
const CLIDictItem name[]
#define CLIDict_Item(name) \
{ #name, name##CLIDict_DescEntry, (const void (*)(char*))cliFunc_##name }
#define CLIDict_Entry(name,description) \
const char name##CLIDict_DescEntry[] = description;
#endif
// ----- Structs -----
// Each item has a name, description, and function pointer with an argument for arguments
typedef struct CLIDictItem {
char* name;
char* description;
void (*function)(char*);
const char* name;
const char* description;
const void (*function)(char*);
} CLIDictItem;