From ad2a7939ab4e22803e22db411a43a0e76876056f Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Wed, 21 May 2014 01:30:38 +0200 Subject: [PATCH] completed support for Arduino Mega 2560 (now tested) --- profiles/LoL-Shield_Mega2560 | 125 ++++++++++++++++++++++++++++++++ src/borg_hw/borg_hw_lolshield.c | 17 +++-- src/random/Makefile | 9 ++- src/random/noekeon.c | 8 +- 4 files changed, 146 insertions(+), 13 deletions(-) create mode 100644 profiles/LoL-Shield_Mega2560 diff --git a/profiles/LoL-Shield_Mega2560 b/profiles/LoL-Shield_Mega2560 new file mode 100644 index 0000000..2e60578 --- /dev/null +++ b/profiles/LoL-Shield_Mega2560 @@ -0,0 +1,125 @@ +# +# Automatically generated by make menuconfig: don't edit +# + +# +# General Setup +# +MCU=atmega2560 +FREQ=16000000 + +# +# Borg Hardware +# +NUM_ROWS=9 +NUM_COLS=14 +NUMPLANE=3 +BORG_HW=HW_LOLSHIELD + +# +# lolshield setup +# +USER_TIMER0_FOR_WAIT=1 +BRIGHTNESS=127 + +# +# Features +# +RANDOM_SUPPORT=y +# LAP_TIME_EXTENSION is not set +SCROLLTEXT_SUPPORT=y +SCROLLTEXT_FONT=FONT_C64 +SCROLLTEXT_BUFFER_SIZE=128 +SCROLL_X_SPEED=20 +SCROLL_Y_SPEED=20 +SCROLLTEXT_TEXT="> 1; // x= 6, y= 8, mapped pin D5 break; } - } + } // Enable pullups on new output pins. PORTD = pins_d; diff --git a/src/random/Makefile b/src/random/Makefile index 725498e..0597a7c 100644 --- a/src/random/Makefile +++ b/src/random/Makefile @@ -5,8 +5,13 @@ TARGET = objects_avr include $(MAKETOPDIR)/defaults.mk #for AVR -SRC = prng.c persistentCounter.c -ASRC = noekeon_asm.S memxor.S +ifeq ($(findstring atmega256,$(MCU)),atmega256) + # handmade assembler routines don't work on ATmega2560 + SRC = prng.c persistentCounter.c noekeon.c memxor_c.c +else + SRC = prng.c persistentCounter.c + ASRC = noekeon_asm.S memxor.S +endif #for simulator SRC_SIM = prng.c persistentCounter.c noekeon.c memxor_c.c diff --git a/src/random/noekeon.c b/src/random/noekeon.c index 8a4c23a..ea15f27 100644 --- a/src/random/noekeon.c +++ b/src/random/noekeon.c @@ -98,9 +98,9 @@ void noekeon_round(uint32_t* key, uint32_t* state, uint8_t const1, uint8_t const pi2(state); } -uint8_t rc_tab[] +uint8_t const rc_tab[] #ifdef __AVR__ - PROGMEM + PROGMEM #endif = { /* 0x80, */ @@ -146,7 +146,7 @@ void noekeon_enc(void* buffer, const void* key){ for(i=0; i=0; --i){ #ifdef __AVR__ - rc = pgm_read_byte(rc_tab+i); + rc = pgm_read_byte(&rc_tab[i]); #else rc = rc_tab[i]; #endif