Skip to content

Commit 880ae7c

Browse files
committed
Adding a simple example payload for testing.
1 parent fb1dfb7 commit 880ae7c

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

example_payload/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.asm
2+
*.lst
3+
*.rel
4+
*.rst
5+
*.sym

example_payload/Makefile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+

example_payload/main.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
}

0 commit comments

Comments
 (0)