Skip to content

Commit b75a79a

Browse files
committed
use a separate build directory, better statistics
1 parent 3d13d61 commit b75a79a

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

test/pinmode/Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,23 @@ CPPFLAGS=-DF_CPU=16000000L -DSTM8S103 -Ddouble=float \
1515
-I. -I$(SDUINO) -I$(SDBASE)/variants/standard \
1616
-I$(LIBBASE)/inc -I$(LIBBASE)/src \
1717
-I$(SDCCBASE)/share/sdcc/include/
18-
CFLAGS= -mstm8 --debug
18+
CFLAGS= -mstm8 #--debug
1919
LDFLAGS=-L$(LIBBASE)/lib -L$(SDCCBASE)/share/sdcc/lib/stm8 -lSTM8S103
2020

21-
OBJECTS=pinmode-c.rel pinmode-asm.rel main.rel
21+
SRCS=pinmode-c.c pinmode-asm.c main.c
22+
23+
BUILDDIR=build
24+
OBJECTS=$(SRCS:%.c=$(BUILDDIR)/%.rel)
2225

2326
.PHONY: all clean flash statistics
2427

25-
#all: $(OBJECTS)
28+
all: $(EXECUTEABLE) statistics
2629

2730
$(EXECUTABLE): $(OBJECTS)
2831
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
2932

30-
$(OBJECTS) : %.rel : %.c
33+
$(OBJECTS) : $(BUILDDIR)/%.rel : %.c
34+
mkdir -p $(BUILDDIR)
3135
$(CC) -c $(CPPFLAGS) $(CFLAGS) $^ -o $@
3236

3337
flash: $(EXECUTABLE)
@@ -39,15 +43,15 @@ readopt:
3943

4044
# lists the length of functions and constants defined in the primary source
4145
# file
42-
statistics:
43-
awk '/ CODE/ {print FILENAME "\t" strtonum("0x"$$4)}' *.sym
46+
statistics: $(OBJECTS)
47+
cd $(BUILDDIR); awk '/ CODE/ {print FILENAME "\t" strtonum("0x"$$4)}' *.sym
4448

4549

4650
# grep "[0-9] _" $(BASENAME).rst |\
4751
# awk 'BEGIN {print "length\tfunction\n------\t----------";}{ a=strtonum("0x"$$1);if (name) print a-s "\t" name; s=a; name=$$3}'
4852

4953

5054
clean:
51-
rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \
52-
*.cdb *.adb *~ *.bak
55+
rm -rf *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \
56+
*.cdb *.adb *~ *.bak build
5357
rm -f $(EXECUTABLE)

test/pinmode/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44

55
#define ARDUINO_MAIN
66
#include "Arduino.h"
7-
#include "wiring_private.h"
87
#include "stm8s_it.h"
98

109
void pinMode_c(uint8_t pin, uint8_t mode);
1110
void pinMode_asm(uint8_t pin, uint8_t mode);
1211

1312

14-
uint8_t checkresult(uint8_t *adr, uint8_t *data)
13+
uint8_t checkresult(uint16_t adr, uint8_t *data)
1514
{
1615
uint8_t i,ok;
1716

1817
ok = 1;
1918
for (i=0; i<3; ++i) {
20-
if (adr[2+i] != data[i]) ok=0;
19+
if (((uint8_t*)adr)[2+i] != data[i]) ok=0;
2120
}
2221
return ok;
2322
}

test/pinmode/pinmode-asm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
* test spi functions
33
*/
44

5-
#include "Arduino.h"
6-
#include "wiring_private.h"
7-
5+
#include <stdint.h>
86

97
void pinMode_asm(uint8_t pin, uint8_t mode)
108
{

test/pinmode/pinmode-c.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44

55
#include "Arduino.h"
6-
#include "wiring_private.h"
76

87
void pinMode_c(uint8_t pin, uint8_t mode)
98
{

0 commit comments

Comments
 (0)