File tree Expand file tree Collapse file tree 3 files changed +101
-0
lines changed Expand file tree Collapse file tree 3 files changed +101
-0
lines changed Original file line number Diff line number Diff line change 1+ * .asm
2+ * .lst
3+ * .rel
4+ * .rst
5+ * .sym
Original file line number Diff line number Diff line change 1+ #
2+ # CC Debugger - Example Payload
3+ # Fergus Noble (c) 2011
4+ #
5+
6+ CC = sdcc
7+
8+ CFLAGS = --model-small --opt-code-speed
9+
10+ # NOTE: code-loc should be the same as the value specified for
11+ # USER_CODE_BASE in the bootloader!
12+ LDFLAGS_FLASH = \
13+ --out-fmt-ihx \
14+ --code-loc 0x1000 --code-size 0x8000 \
15+ --xram-loc 0xf000 --xram-size 0x300 \
16+ --iram-size 0x100
17+
18+ ifdef DEBUG
19+ CFLAGS += --debug
20+ endif
21+
22+ SRC = main.c
23+
24+ ADB=$(SRC:.c =.adb)
25+ ASM=$(SRC:.c =.asm)
26+ LNK=$(SRC:.c =.lnk)
27+ LST=$(SRC:.c =.lst)
28+ REL=$(SRC:.c =.rel)
29+ RST=$(SRC:.c =.rst)
30+ SYM=$(SRC:.c =.sym)
31+
32+ PROGS =example_payload.hex
33+ PCDB=$(PROGS:.hex =.cdb)
34+ PLNK=$(PROGS:.hex =.lnk)
35+ PMAP=$(PROGS:.hex =.map)
36+ PMEM=$(PROGS:.hex =.mem)
37+ PAOM=$(PROGS:.hex =)
38+
39+ % .rel : % .c
40+ $(CC ) -c $(CFLAGS ) -o$* .rel $<
41+
42+ all : $(PROGS )
43+
44+ example_payload.hex : $(REL ) Makefile
45+ $(CC ) $(LDFLAGS_FLASH ) $(CFLAGS ) -o example_payload.hex $(REL )
46+
47+ clean :
48+ rm -f $(ADB ) $(ASM ) $(LNK ) $(LST ) $(REL ) $(RST ) $(SYM )
49+ rm -f $(PROGS ) $(PCDB ) $(PLNK ) $(PMAP ) $(PMEM ) $(PAOM )
50+
Original file line number Diff line number Diff line change 1+ /*
2+ * CC Bootloader - Example Payload
3+ *
4+ * Fergus Noble (c) 2011
5+ *
6+ * This program is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; version 2 of the License.
9+ *
10+ * This program is distributed in the hope that it will be useful, but
11+ * WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+ * General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License along
16+ * with this program; if not, write to the Free Software Foundation, Inc.,
17+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18+ */
19+
20+ #include "../src/cc1111.h"
21+
22+ #define nop () __asm nop __endasm;
23+
24+ void delay (unsigned char n ) {
25+ unsigned char i = 0 ;
26+ unsigned char j = 0 ;
27+
28+ n <<= 1 ;
29+ while (-- n != 0 )
30+ while (-- i != 0 )
31+ while (-- j != 0 )
32+ nop ();
33+ }
34+
35+ void main ()
36+ {
37+ // Setup LED and turn it off
38+ P1DIR |= 2 ;
39+ P1_1 = 0 ;
40+
41+ while (1 )
42+ {
43+ P1_1 ^= 1 ;
44+ delay (3 );
45+ }
46+ }
You can’t perform that action at this time.
0 commit comments