KEYMAP macro
copy, swap, set all, clear…
lz-string.js
ldscript_keymap_avr5.x
is ldscript and located at top directory. Using
Flash Memroy Map of ATMega32U4(32KB)
+--------------------+ 0x0000
| .vectors | 0xac (43vectors * 4bytes)
| .progmem | PROGMEM variables and PSTR
| .init0-9 |
| .text | code
| .fini9-0 |
| | > text region
|--------------------| _etext
| .data |
| .bss |
| .noinit |
| | > data region
|--------------------| 0x6800
| .keymap.fn_actions |
| .keymap.keymaps | > keymap region(2KB)
|--------------------| 0x7000
| bootloader | 4KB
+--------------------+ 0x7FFF
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions")))
const uint8_t keymaps[8][ROW][COL] __attribute__ ((section (".keymap.keymaps")))
These arrays are placed at fixed address in .keymap section:
actions[] -> +-------------+
| action x 32 |
keymaps[] -> |-------------|
| keymap 0 |
|-------------|
| keymap 1 |
|-------------|
| keymap 2 |
|-------------|
| keymap 3 |
|-------------|
| : : |
const uint16_t actionmaps[] __attribute__ ((section (".keymap.actionmaps")))
All key action can be defined in 16bit code. Memory usage will be about doubled size compared to keymap(8bit code).
actionmaps[] -> +-------------+
| actionmap 0 |
|-------------|
| actionmap 1 |
|-------------|
| actionmap 2 |
|-------------|
| actionmap 3 |
|-------------|
| : : |
For example of biggest ever map, PS/2 and ADB converter have 256 keys in a layer, so use 256 bytes each layer in keymap and 512 bytes in actionmap. In most cases map size of keyboard will be far smaller than that.
Firmware -24KB(with full option)
Keymapping 4KB-
Bootloader 4KB(Atmel stock) or 512B(Teensy)
Firmware -10KB
Keymapping 2KB-
Bootloader 4KB(Atmel stock) or 512B(Teensy)
':'
2 x hex(0-FF)
4 x hex(0-FFFF)
2 x hex(00-05)
00: Data record. which contains 16bit address and data.
01: End of File record. It must appear in the last line.(usually :00000001FF)
02: Extended Segment Address Record.
03: Start Segment Address Record.
04: Extended Linear Address Record. Upper two bytes of 32 bit address.
05: Start Linear Address Record.
byte_count * hex(00-FF)
a sequence of data bytes
2 x hex(00-FF)
LSB of 2’s complement of the sum of fields[ ‘Byte Count’, ‘Address’, ‘Record Type’ and ‘Data’ ]
checksum = ~(the sum of bytes)&0xff + 1 = (the sum)&0xff^0xff + 1