Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ as some modifications in the library itself.

This repository is work-in-progress.

This library uses too much storage space and dynamic memory to run
on the ATmega328 (Arduino Uno). It has been tested on Teensy 3.1 and
Teensy LC.
This library uses most of the storage space from an ATmega328 based
Arduino (UNO for example) and is therefore not very usable on these platform.
It has been tested on Teensy 3.1 and Teensy LC.

Connections
-----------
Expand Down
13 changes: 7 additions & 6 deletions src/lmic/aes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
*******************************************************************************/

#include "oslmic.h"
#include <avr/pgmspace.h>

#define AES_MICSUB 0x30 // internal use only

static const u4_t AES_RCON[10] = {
static PROGMEM const u4_t AES_RCON[10] = {
0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000,
0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000
};

static const u1_t AES_S[256] = {
static PROGMEM const u1_t AES_S[256] = {
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
Expand All @@ -37,7 +38,7 @@ static const u1_t AES_S[256] = {
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16,
};

static const u4_t AES_E1[256] = {
static PROGMEM const u4_t AES_E1[256] = {
0xC66363A5, 0xF87C7C84, 0xEE777799, 0xF67B7B8D, 0xFFF2F20D, 0xD66B6BBD, 0xDE6F6FB1, 0x91C5C554,
0x60303050, 0x02010103, 0xCE6767A9, 0x562B2B7D, 0xE7FEFE19, 0xB5D7D762, 0x4DABABE6, 0xEC76769A,
0x8FCACA45, 0x1F82829D, 0x89C9C940, 0xFA7D7D87, 0xEFFAFA15, 0xB25959EB, 0x8E4747C9, 0xFBF0F00B,
Expand Down Expand Up @@ -72,7 +73,7 @@ static const u4_t AES_E1[256] = {
0x824141C3, 0x299999B0, 0x5A2D2D77, 0x1E0F0F11, 0x7BB0B0CB, 0xA85454FC, 0x6DBBBBD6, 0x2C16163A,
};

static const u4_t AES_E2[256] = {
static PROGMEM const u4_t AES_E2[256] = {
0xA5C66363, 0x84F87C7C, 0x99EE7777, 0x8DF67B7B, 0x0DFFF2F2, 0xBDD66B6B, 0xB1DE6F6F, 0x5491C5C5,
0x50603030, 0x03020101, 0xA9CE6767, 0x7D562B2B, 0x19E7FEFE, 0x62B5D7D7, 0xE64DABAB, 0x9AEC7676,
0x458FCACA, 0x9D1F8282, 0x4089C9C9, 0x87FA7D7D, 0x15EFFAFA, 0xEBB25959, 0xC98E4747, 0x0BFBF0F0,
Expand Down Expand Up @@ -107,7 +108,7 @@ static const u4_t AES_E2[256] = {
0xC3824141, 0xB0299999, 0x775A2D2D, 0x111E0F0F, 0xCB7BB0B0, 0xFCA85454, 0xD66DBBBB, 0x3A2C1616,
};

static const u4_t AES_E3[256] = {
static PROGMEM const u4_t AES_E3[256] = {
0x63A5C663, 0x7C84F87C, 0x7799EE77, 0x7B8DF67B, 0xF20DFFF2, 0x6BBDD66B, 0x6FB1DE6F, 0xC55491C5,
0x30506030, 0x01030201, 0x67A9CE67, 0x2B7D562B, 0xFE19E7FE, 0xD762B5D7, 0xABE64DAB, 0x769AEC76,
0xCA458FCA, 0x829D1F82, 0xC94089C9, 0x7D87FA7D, 0xFA15EFFA, 0x59EBB259, 0x47C98E47, 0xF00BFBF0,
Expand Down Expand Up @@ -142,7 +143,7 @@ static const u4_t AES_E3[256] = {
0x41C38241, 0x99B02999, 0x2D775A2D, 0x0F111E0F, 0xB0CB7BB0, 0x54FCA854, 0xBBD66DBB, 0x163A2C16,
};

static const u4_t AES_E4[256] = {
static PROGMEM const u4_t AES_E4[256] = {
0x6363A5C6, 0x7C7C84F8, 0x777799EE, 0x7B7B8DF6, 0xF2F20DFF, 0x6B6BBDD6, 0x6F6FB1DE, 0xC5C55491,
0x30305060, 0x01010302, 0x6767A9CE, 0x2B2B7D56, 0xFEFE19E7, 0xD7D762B5, 0xABABE64D, 0x76769AEC,
0xCACA458F, 0x82829D1F, 0xC9C94089, 0x7D7D87FA, 0xFAFA15EF, 0x5959EBB2, 0x4747C98E, 0xF0F00BFB,
Expand Down
12 changes: 7 additions & 5 deletions src/lmic/lmic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

//! \file
#include "lmic.h"
#include <avr/pgmspace.h>


#if !defined(MINRX_SYMS)
#define MINRX_SYMS 5
Expand Down Expand Up @@ -228,7 +230,7 @@ const u1_t _DR2RPS_CRC[] = {
ILLEGAL_RPS
};

static const s1_t TXPOWLEVELS[] = {
static PROGMEM const s1_t TXPOWLEVELS[] = {
20, 14, 11, 8, 5, 2, 0,0, 0,0,0,0, 0,0,0,0
};
#define pow2dBm(mcmd_ladr_p1) (TXPOWLEVELS[(mcmd_ladr_p1&MCMD_LADR_POW_MASK)>>MCMD_LADR_POW_SHIFT])
Expand Down Expand Up @@ -261,7 +263,7 @@ const u1_t _DR2RPS_CRC[] = {

#endif // ================================================

static const u1_t SENSITIVITY[7][3] = {
static PROGMEM const u1_t SENSITIVITY[7][3] = {
// ------------bw----------
// 125kHz 250kHz 500kHz
{ 141-109, 141-109, 141-109 }, // FSK
Expand Down Expand Up @@ -345,7 +347,7 @@ extern inline int sameSfBw (rps_t r1, rps_t r2);
// Adjust DR for TX retries
// - indexed by retry count
// - return steps to lower DR
static const u1_t DRADJUST[2+TXCONF_ATTEMPTS] = {
static PROGMEM const u1_t DRADJUST[2+TXCONF_ATTEMPTS] = {
// normal frames - 1st try / no retry
0,
// confirmed frames
Expand All @@ -364,7 +366,7 @@ static const u1_t DRADJUST[2+TXCONF_ATTEMPTS] = {
//
// Times for half symbol per DR
// Per DR table to minimize rounding errors
static const ostime_t DR2HSYM_osticks[] = {
static PROGMEM const ostime_t DR2HSYM_osticks[] = {
#if defined(CFG_eu868)
#define dr2hsym(dr) (DR2HSYM_osticks[(dr)])
us2osticksRound(128<<7), // DR_SF12
Expand Down Expand Up @@ -528,7 +530,7 @@ void LMIC_setPingable (u1_t intvExp) {
// BEG: EU868 related stuff
//
enum { NUM_DEFAULT_CHANNELS=6 };
static const u4_t iniChannelFreq[12] = {
static PROGMEM const u4_t iniChannelFreq[12] = {
// Join frequencies and duty cycle limit (0.1%)
EU868_F1|BAND_MILLI,
EU868_F2|BAND_MILLI,
Expand Down
6 changes: 4 additions & 2 deletions src/lmic/radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*******************************************************************************/

#include "lmic.h"
#include <avr/pgmspace.h>


// ----------------------------------------
// Registers Mapping
Expand Down Expand Up @@ -520,7 +522,7 @@ static void starttx () {

enum { RXMODE_SINGLE, RXMODE_SCAN, RXMODE_RSSI };

static const u1_t rxlorairqmask[] = {
static PROGMEM const u1_t rxlorairqmask[] = {
[RXMODE_SINGLE] = IRQ_LORA_RXDONE_MASK|IRQ_LORA_RXTOUT_MASK,
[RXMODE_SCAN] = IRQ_LORA_RXDONE_MASK,
[RXMODE_RSSI] = 0x00,
Expand Down Expand Up @@ -717,7 +719,7 @@ u1_t radio_rssi () {
return r;
}

static const u2_t LORA_RXDONE_FIXUP[] = {
static PROGMEM const u2_t LORA_RXDONE_FIXUP[] = {
[FSK] = us2osticks(0), // ( 0 ticks)
[SF7] = us2osticks(0), // ( 0 ticks)
[SF8] = us2osticks(1648), // ( 54 ticks)
Expand Down