Skip to content

Commit a1bc266

Browse files
committed
started to move the Makefiles into the main sduino directory
1 parent 1959098 commit a1bc266

7 files changed

Lines changed: 89 additions & 42 deletions

File tree

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,8 @@ endif
14621462
# Explicit targets start here
14631463

14641464
#all: $(TARGET_EEP) $(TARGET_HEX)
1465-
all: size
1465+
#all: size
1466+
all: $(TARGET_HEX)
14661467
#$(TARGET_HEX) $(SIZE)
14671468

14681469
# Rule to create $(OBJDIR) automatically. All rules with recipes that
@@ -1479,6 +1480,13 @@ pre-build:
14791480

14801481
$(TARGET_HEX): $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS)
14811482
$(CC) $(LDFLAGS) $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) $(OTHER_LIBS) -lstm8s103 -lstm8 $(LINKER_SCRIPTS) -o $@
1483+
$(call avr_size,$<,$@)
1484+
ifneq ($(strip $(HEX_MAXIMUM_SIZE)),)
1485+
@if [ `$(SIZE) $@ | awk 'FNR == 2 {print $$2}'` -le $(HEX_MAXIMUM_SIZE) ]; then touch [email protected]; fi
1486+
else
1487+
@$(ECHO) "Maximum flash memory of $(BOARD_TAG) is not specified. Make sure the size of $@ is less than $(BOARD_TAG)\'s flash memory"
1488+
1489+
endif
14821490
# $(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) $(OTHER_LIBS) -lc -lm $(LINKER_SCRIPTS)
14831491

14841492
$(TARGET_ELF): $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS)
File renamed without changes.

sduino/sduino.mk

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
MCU_FLAG_NAME = m
3+
4+
OVERRIDE_EXECUTABLES=yes
5+
SDCC_PATH=/opt/sdcc/bin
6+
CC = $(SDCC_PATH)/sdcc
7+
AS = $(SDCC_PATH)/sdasstm8
8+
AR = $(SDCC_PATH)/sdar
9+
SIZE = /usr/bin/size
10+
11+
#ALTERNATE_CORE = sduino
12+
#ARDUINO_VAR_PATH = ../../sduino
13+
#ARDUINO_CORE_PATH = ../../sduino
14+
15+
16+
all:
17+
18+
########################################################################
19+
# Makefile distribution path
20+
21+
ifndef ARDMK_DIR
22+
# presume it's the same path to our own file
23+
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
24+
else
25+
# show_config_variable macro is defined in Common.mk file and is not available yet.
26+
# Let's define a variable to know that user specified ARDMK_DIR
27+
ARDMK_DIR_MSG = USER
28+
endif
29+
30+
ifndef ARDUINO_DIR
31+
# presume it's the same path to our own file
32+
ARDUINO_DIR = $(ARDMK_DIR)
33+
else
34+
#FIXME: this message is not yet implemented
35+
# show_config_variable macro is defined in Common.mk file and is not available yet.
36+
# Let's define a variable to know that user specified ARDUINO_DIR
37+
ARDUINO_DIR_MSG = USER
38+
endif
39+
40+
41+
#ARDUINO_DIR = .
42+
ARDUINO_SKETCHBOOK = /tmp # temporarly, to prevent usage of the real libs
43+
ARDMK_VENDOR = sduino
44+
ARCHITECTURE = stm8
45+
CPPFLAGS = -DSTM8S103 -I$(ARDUINO_DIR)/../STM8S_StdPeriph_Driver/inc -I/opt/sdcc/share/sdcc/include/
46+
#CFLAGS = -I ../STM8S_StdPeriph_Driver/inc
47+
#LDFLAGS = --out-fmt-elf
48+
LDFLAGS = -L $(ARDUINO_DIR)/../STM8S_StdPeriph_Driver/src -L/opt/sdcc/share/sdcc/lib/stm8
49+
50+
51+
52+
# include Common.mk now we know where it is
53+
include $(ARDMK_DIR)/Arduino.mk
54+
55+
56+
STM8FLASH = stm8flash
57+
STM8FLASH_COM_OPTS =
58+
STM8FLASH_ARD_OPTS = -c$(AVRDUDE_ARD_PROGRAMMER) -p$(AVRDUDE_MCU)
59+
STM8FLASH_UPLOAD_HEX = -s flash -w $(TARGET_HEX)
60+
STM8FLASH_UPLOAD_EEP = -s eeprom -w $(TARGET_EEP)
61+
62+
63+
upload: $(TARGET_HEX) verify_size
64+
$(STM8FLASH) $(STM8FLASH_COM_OPTS) $(STM8FLASH_ARD_OPTS) \
65+
$(STM8FLASH_UPLOAD_HEX)

test/libmake/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
BOARD_TAG = stm8sblue
22

3-
include sduino.mk
3+
include ../../sduino/sduino.mk

test/libmake/libmake.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ All text above, and the splash screen must be included in any redistribution
4747

4848
// empty IRQ handler just to keep the linker happy as we are not using the
4949
// Hardware_Serial library
50-
void UART1_RX_IRQHandler(void) __interrupt(ITC_IRQ_UART1_RX){}
51-
void UART1_TX_IRQHandler(void) __interrupt(ITC_IRQ_UART1_TX){}
50+
//void UART1_RX_IRQHandler(void) __interrupt(ITC_IRQ_UART1_RX){}
51+
//void UART1_TX_IRQHandler(void) __interrupt(ITC_IRQ_UART1_TX){}
5252

5353

5454
void setup()
@@ -63,6 +63,8 @@ void setup()
6363
// Since the buffer is intialized with an Adafruit splashscreen
6464
// internally, this will display the splashscreen.
6565
// display_display();
66+
67+
while (1) loop();
6668
}
6769

6870

test/libmake/sduino.mk

Lines changed: 0 additions & 38 deletions
This file was deleted.

test/libmake/stat.awk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/bin/gawk -f
22

3+
# text data bss dec hex filename
4+
# 0 4673 0 4673 1241 build-stm8sblue/libmake.ihx
5+
6+
37
/ [ls]_/ {
48
v=strtonum("0x"$1);
59
type=substr($2,1,1);
@@ -9,6 +13,9 @@
913
}
1014

1115
END {
16+
bss = arr["DATA"]["l"]+arr["INITIALIZED"]["l"];
17+
rom = arr["CODE"]["l"]+arr["INITIALIZER"]["l"];
18+
1219
for (n in arr)
1320
print arr[n]["l"] "\t" n;
1421
# print n, arr[n]["s"],arr[n]["l"];
@@ -19,4 +26,7 @@ END {
1926
for (n in arr) printf("%s\t",n);
2027
for (n in arr) print arr[n]["l"] "\t";
2128

29+
print " text\t data\t bss\t dec\t hex\tfilename";
30+
printf ("%7i\t%7i\t%7i\t%7i\t%7x\t%s\n",0,rom,bss,rom,rom,FILENAME);
31+
2232
}

0 commit comments

Comments
 (0)