Last active
November 16, 2015 06:26
-
-
Save four0four/6378ed55952203a5fa2f to your computer and use it in GitHub Desktop.
Example C8051/ec2-drv project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Homework #1 - except not really | |
*/ | |
#include <c8051_SDCC.h> | |
#include <stdio.h> | |
void main(void) | |
{ | |
// The following 2 lines MUST be the 1st executable statements in every program | |
Sys_Init(); /* Initialize UART, System clock and crossbar*/ | |
putchar(' '); /* do this because we tell you to */ | |
// do the thing | |
printf("Hello, world!\n\r"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROGRAM=hw1 | |
SOURCES=$(PROGRAM).c | |
# you should probably redefine this with an absolute path, if possible | |
INCLUDE=../headers | |
CC=sdcc | |
PORT="USB" | |
TARGET="SL51" | |
GDB=newcdb | |
all: $(PROGRAM).ihx flash run | |
$(PROGRAM).ihx: $(SOURCES) | |
$(CC) --debug -V --nogcse $(SOURCES) -I$(INCLUDE) | |
# just use newcdb to flash the current program | |
flash: $(PROGRAM).ihx | |
$(GDB) -ex="set target $(TARGET)" -ex="set target port $(PORT)" -ex="set target connect" -ex="file $(PROGRAM)" -ex="quit" | |
# call above, then use newcdb to start the current program (the uC needs a reset once flashed) | |
run: | |
$(GDB) -ex="set target $(TARGET)" -ex="set target port $(PORT)" -ex="set target connect" -ex="run" -ex="continue" -ex="quit" | |
clean: | |
rm -f *~ *.adb *.asm *.cdb *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.lk *.omf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment