Skip to content
Snippets Groups Projects
Commit 60f2196b authored by Erik Strand's avatar Erik Strand
Browse files

DICE tests

parent fd9a459f
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ MCU_DEFINE := __SAMD51J19A__ ...@@ -9,7 +9,7 @@ MCU_DEFINE := __SAMD51J19A__
# Flags # Flags
LFLAGS += -mthumb -mabi=aapcs-linux -mlong-calls -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DSAMD51 LFLAGS += -mthumb -mabi=aapcs-linux -mlong-calls -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DSAMD51
CFLAGS += -x c -DDEBUG -Os -ffunction-sections -g3 -Wall -c -std=gnu99 $(LFLAGS) CFLAGS += -x c -DDEBUG -ffunction-sections -g3 -Wall -c -std=gnu99 $(LFLAGS)
INCLUDES += -I"samd51" -I"samd51/CMSIS/Include" -I"samd51/include" -I"samd51/startup" INCLUDES += -I"samd51" -I"samd51/CMSIS/Include" -I"samd51/include" -I"samd51/startup"
# List the subdirectories for creating object files # List the subdirectories for creating object files
......
...@@ -3,23 +3,49 @@ ...@@ -3,23 +3,49 @@
int main (void) { int main (void) {
int i; int i;
// red led is 17, green led is 19 // red led is A17, green led is A19 (lit when low)
REG_PORT_DIR0 = (1u << 17) | (1u << 19); REG_PORT_DIR0 = (1u << 17) | (1u << 19);
// green led // make sure they start off
//REG_PORT_DIR0 |= (1u<<19); REG_PORT_OUTSET0 = (1u << 17) | (1u << 19);
//REG_PORT_OUTCLR0 = (1u << 19); // Prepare output signals (A5, A22)
//REG_PORT_OUTSET0 = (1u << 17); REG_PORT_DIR0 |= (1u << 5) | (1u << 22);
// make sure they start low
REG_PORT_OUTSET0 = (1u << 5) | (1u << 22);
// Prepare input signals (A8, B13)
/*
PORT->Group[0].PINCFG[8].bit.INEN = 1;
PORT->Group[0].PINCFG[8].bit.PULLEN = 1;
PORT->Group[1].PINCFG[13].bit.INEN = 1;
PORT->Group[1].PINCFG[13].bit.PULLEN = 1;
*/
while(1) { while(1) {
REG_PORT_OUTSET0 = (1u << 17); // Listeners
REG_PORT_OUTCLR0 = (1u << 19); /*
if ((REG_PORT_IN0 & (1u << 8)) || (REG_PORT_IN1 & (1u << 13))) {
// Turn on the LED.
REG_PORT_OUTCLR0 = (1u << 17) | (1u << 19);
// Raise the signal wires.
REG_PORT_OUTSET0 = (1u << 5) | (1u << 22);
} else {
// Turn off the LED.
REG_PORT_OUTSET0 = (1u << 17) | (1u << 19);
// Lower the signal wires.
REG_PORT_OUTCLR0 = (1u << 5) | (1u << 22);
}
*/
// Director
REG_PORT_OUTCLR0 = (1u << 17) | (1u << 19);
REG_PORT_OUTSET0 = (1u << 5) | (1u << 22);
for (i=0; i<1000000; i++) { for (i=0; i<1000000; i++) {
__asm("nop"); __asm("nop");
} }
REG_PORT_OUTCLR0 = (1u << 17); REG_PORT_OUTSET0 = (1u << 17) | (1u << 19);
REG_PORT_OUTSET0 = (1u << 19); REG_PORT_OUTCLR0 = (1u << 5) | (1u << 22);
for (i=0; i<1000000; i++) { for (i=0; i<1000000; i++) {
__asm("nop"); __asm("nop");
} }
......
...@@ -5,3 +5,4 @@ transport select swd ...@@ -5,3 +5,4 @@ transport select swd
# Chip info # Chip info
set CHIPNAME at91samd51j18 set CHIPNAME at91samd51j18
source [find target/atsame5x.cfg] source [find target/atsame5x.cfg]
reset
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment