Skip to content

Commit 95500e5

Browse files
committed
add the object file for main.c to the list of linked object files (needed for SDCC)
1 parent a1bc266 commit 95500e5

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

sduino/Arduino.mk

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,8 @@ ifeq ($(strip $(NO_CORE)),)
829829

830830
ifneq ($(strip $(NO_CORE_MAIN_CPP)),)
831831
CORE_CPP_SRCS := $(filter-out %main.cpp, $(CORE_CPP_SRCS))
832-
$(call show_config_info,NO_CORE_MAIN_CPP set so core library will not include main.cpp,[MANUAL])
832+
CORE_C_SRCS := $(filter-out %main.c, $(CORE_C_SRCS))
833+
$(call show_config_info,NO_CORE_MAIN_CPP set so core library will not include main.cpp or main.c,[MANUAL])
833834
endif
834835

835836
CORE_OBJ_FILES = $(CORE_C_SRCS:.c=.c.$(OBJSUFFIX)) $(CORE_CPP_SRCS:.cpp=.cpp.$(OBJSUFFIX)) $(CORE_AS_SRCS:.S=.S.$(OBJSUFFIX))
@@ -1479,7 +1480,9 @@ pre-build:
14791480
$(call runscript_if_exists,$(PRE_BUILD_HOOK))
14801481

14811482
$(TARGET_HEX): $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS)
1482-
$(CC) $(LDFLAGS) $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) $(OTHER_LIBS) -lstm8s103 -lstm8 $(LINKER_SCRIPTS) -o $@
1483+
$(CC) $(LDFLAGS) $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) \
1484+
$(filter %/core/main.c.$(OBJSUFFIX),$(CORE_OBJS)) \
1485+
$(OTHER_LIBS) -lstm8s103 -lstm8 $(LINKER_SCRIPTS) -o $@
14831486
$(call avr_size,$<,$@)
14841487
ifneq ($(strip $(HEX_MAXIMUM_SIZE)),)
14851488
@if [ `$(SIZE) $@ | awk 'FNR == 2 {print $$2}'` -le $(HEX_MAXIMUM_SIZE) ]; then touch [email protected]; fi

test/libmake/Makefile.classic

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 -DARDUINO=180 \
1919

2020
LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s103 --out-fmt-elf
2121

22-
OBJECTS=$(BASENAME).rel ssd1306.rel
22+
OBJECTS=$(BASENAME).rel
2323
#SDLIBS=I2C
2424
SDOBJECTS=main.rel wiring.rel wiring_digital.rel
2525
SDLIBOBJECTS=I2C/I2C.rel ssd1306/ssd1306.rel
@@ -38,7 +38,7 @@ $(OBJECTS) : %.rel : %.c
3838
$(SDOBJECTS) : %.rel : $(SDUINO)/%.c
3939
$(CC) -c $(CFLAGS) $^ -o $@
4040

41-
$(SDLIBOBJECTS) : %.rel : $(SDUINO)/libraries/%.c
41+
$(SDLIBOBJECTS) : %.rel : $(SDUINO)/hardware/sduino/stm8/libraries/%.c
4242
$(CC) -c $(CFLAGS) $^ -o $@
4343

4444
flash: $(EXECUTABLE)

0 commit comments

Comments
 (0)