Skip to content

Commit 85e9b60

Browse files
committed
don't compile all the SDuino files
1 parent b1b816f commit 85e9b60

2 files changed

Lines changed: 38 additions & 11 deletions

File tree

test/pinmode/Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ BINDIR=$(SDCCBASE)/bin
77
CC=$(BINDIR)/sdcc
88
LD=$(BINDIR)/sdld
99

10-
LIBBASE=../../STM8S_StdPeriph_Driver
11-
SDUINO=../../sduino
10+
SDBASE=../../sduino/hardware/sduino/stm8
11+
LIBBASE=$(SDBASE)/STM8S_StdPeriph_Driver
12+
SDUINO=$(SDBASE)/cores/sduino
1213

1314
CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 \
14-
-I. -I$(SDUINO) -I$(LIBBASE)/inc -I/usr/share/sdcc/include/
15+
-I. -I$(SDUINO) -I$(SDBASE)/variants/standard \
16+
-I$(LIBBASE)/inc -I$(LIBBASE)/src \
17+
-I$(SDCCBASE)/share/sdcc/include/
1518
# -DSUPPORT_ALTERNATE_MAPPINGS
1619

17-
LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s103
20+
LDFLAGS=-L$(LIBBASE)/lib -L$(SDCCBASE)/share/sdcc/lib/stm8 -lSTM8S103
1821

1922
OBJECTS=$(BASENAME).rel
2023
SDOBJECTS=main.rel wiring.rel wiring_digital.rel SPI.rel \
@@ -24,8 +27,7 @@ SDOBJECTS=main.rel wiring.rel wiring_digital.rel SPI.rel \
2427

2528
#all: $(OBJECTS)
2629

27-
$(EXECUTABLE): $(OBJECTS) $(SDOBJECTS)
28-
#test.rel wiring_digital.rel
30+
$(EXECUTABLE): $(OBJECTS) #$(SDOBJECTS)
2931
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
3032

3133
$(OBJECTS) : %.rel : %.c

test/pinmode/pinmode.c

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
* test spi functions
33
*/
44

5+
#define ARDUINO_MAIN
56
#include "Arduino.h"
67
#include "wiring_private.h"
8+
#include "stm8s_it.h"
79

8-
void pinMode1(uint8_t pin, uint8_t mode)
10+
void pinMode_c(uint8_t pin, uint8_t mode)
911
{
1012
uint8_t bit = digitalPinToBitMask(pin);
1113
uint8_t port = digitalPinToPort(pin);
@@ -266,7 +268,7 @@ uint8_t checkresult(uint8_t *adr, uint8_t *data)
266268
}
267269

268270

269-
void setup(void)
271+
void main(void)
270272
{
271273
// expected result: xx xx 00 00 00
272274
pinMode_asm(PA1,INPUT);
@@ -293,7 +295,30 @@ void setup(void)
293295
checkresult(GPIOD_BaseAddress, "\x42\x02\x42");
294296
}
295297

298+
#include "stm8s_it.h"
296299

297-
void loop (void)
298-
{
299-
}
300+
/*
301+
* empty default IRQ functions to make the linker happy if the
302+
* respective module is not to linked.
303+
*/
304+
305+
void UART1_TX_IRQHandler(void) __interrupt(ITC_IRQ_UART1_TX){}
306+
void UART1_RX_IRQHandler(void) __interrupt(ITC_IRQ_UART1_RX){}
307+
308+
// define as __naked to avoid the "clr a/dix x,a" prolog
309+
#define IMPLEMENT_ISR(vect, interrupt) \
310+
void vect(void) __interrupt((interrupt)>>8) __naked { \
311+
__asm__("iret"); \
312+
}
313+
314+
IMPLEMENT_ISR(EXTI_PORTA_IRQHandler, INT_PORTA) /* EXTI PORTA */
315+
IMPLEMENT_ISR(EXTI_PORTB_IRQHandler, INT_PORTB) /* EXTI PORTB */
316+
IMPLEMENT_ISR(EXTI_PORTC_IRQHandler, INT_PORTC) /* EXTI PORTC */
317+
IMPLEMENT_ISR(EXTI_PORTD_IRQHandler, INT_PORTD) /* EXTI PORTD */
318+
IMPLEMENT_ISR(EXTI_PORTE_IRQHandler, INT_PORTE) /* EXTI PORTE */
319+
IMPLEMENT_ISR(TIM1_CAP_COM_IRQHandler, INT_TIM1_CAPCOM)
320+
//IMPLEMENT_ISR(TIM1_UPD_OVF_TRG_BRK_IRQHandler, INT_TIM1_OVF)
321+
//IMPLEMENT_ISR(TIM2_CAP_COM_IRQHandler, INT_TIM2_CAPCOM)
322+
//IMPLEMENT_ISR(TIM2_UPD_OVF_TRG_BRK_IRQHandler, INT_TIM2_OVF)
323+
324+
void TIM4_UPD_OVF_IRQHandler(void) __interrupt(ITC_IRQ_TIM4_OVF){}

0 commit comments

Comments
 (0)