Compare commits

...

6 commits

Author SHA1 Message Date
Stephan I. Böttcher
6cc29ed1b7 make %.id %.verify: -qq 2024-04-07 17:45:42 +02:00
Stephan I. Böttcher
20c0bd18e5 text_calib to SEND_HEX 2024-04-07 12:25:20 +02:00
Stephan I. Böttcher
6af21a6fe2 uart: send*(): pointers to const payload 2024-04-07 11:53:22 +02:00
Stephan I. Böttcher
0e31489bff %.s: depend on %.o to capture dependencies from %.d 2024-04-07 11:52:03 +02:00
Stephan I. Böttcher
ec4e0c23ed make %.verify 2024-04-07 11:34:31 +02:00
Stephan I. Böttcher
47aab1d6b0 make bate.config, individual vars 2024-04-07 10:54:10 +02:00
4 changed files with 28 additions and 10 deletions

View file

@ -31,7 +31,7 @@ CFLAGS = $($*_CFLAGS) $(DEBUG) -I. -DSN="$(SN)"
C_FILES = $(C_FILES_$(PROJ)) C_FILES = $(C_FILES_$(PROJ))
OBJS = $(patsubst %.c, %.o, $(C_FILES)) OBJS = $(patsubst %.c, %.o, $(C_FILES))
%.s: %.c %.s: %.c %.o
$(CC) $(CFLAGS) -S $< $(CC) $(CFLAGS) -S $<
%.o: %.c %.o: %.c
@ -96,9 +96,11 @@ AVRDUDE_PORT = /dev/ttyUSB1
AD = $(AVRDUDE) -p $(pMCU-$(MCU)) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) AD = $(AVRDUDE) -p $(pMCU-$(MCU)) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
sig_bate = 0x1e 0x92 0x2c
id: $(PROJ).id id: $(PROJ).id
%.id: %.id:
$(AD) -B 5 -U fuses:v:"$(fuses_$*)":m $(AD) -qq -U signature:v:"$(sig_$*)":m
ad: $(PROJ).ad ad: $(PROJ).ad
%.ad: %.ad:
@ -107,6 +109,11 @@ ad: $(PROJ).ad
%.burn: %.hex %.burn: %.hex
$(AD) -U flash:w:$< $(AD) -U flash:w:$<
%.verify: %.hex
-$(AD) -qq -U fuses:v:"$(fuses_$*)":m
-$(AD) -qq -U userrow:v:"$(BATE_CONFIG)":m
-$(AD) -qq -U flash:v:$<
fuse: $(PROJ).fuse$F fuse: $(PROJ).fuse$F
%.fuse$F: %.fuse$F:
@ -114,7 +121,18 @@ fuse: $(PROJ).fuse$F
[ -n "$(fuse$F_$*)" ] && $(AD) -B 5 -U fuse$F:w:$(fuse$F_$*):m [ -n "$(fuse$F_$*)" ] && $(AD) -B 5 -U fuse$F:w:$(fuse$F_$*):m
# see bate.c: Configuration in USERROW # see bate.c: Configuration in USERROW
BATE_CONFIG=0xba 0x01 0x00 0x07 0x08 0x00 32 0xff 0x00 0x00 4 BC_MAGIC = 0xba
BC_VERS = 1
BC_PWR = 0x00
BC_SEND = 0x0f
BC_TRIG = 0x08
BC_MCLK = 0
BC_MDEL = 32
BC_PIT = 0xff
BC_BAUD = 0 0
BC_TEST = 4
BATE_CONFIG = $(BC_MAGIC) $(BC_VERS) $(BC_PWR) $(BC_SEND) $(BC_TRIG) \
$(BC_MCLK) $(BC_MDEL) $(BC_PIT) $(BC_BAUD) $(BC_TEST)
bate.config: bate.config:
$(AD) -U userrow:v:"$(BATE_CONFIG)":m \ $(AD) -U userrow:v:"$(BATE_CONFIG)":m \
|| $(AD) -U userrow:w:"$(BATE_CONFIG)":m || $(AD) -U userrow:w:"$(BATE_CONFIG)":m

View file

@ -454,12 +454,12 @@ int main()
send_hex_byte(trigger); send_hex_byte(trigger);
send_char_sleep('\n'); send_char_sleep('\n');
} }
const union bate *b = &bate;
if (test_calib)
b = testdata + (--test_calib & 3);
if (config->send & SEND_HEX) if (config->send & SEND_HEX)
send_hex('B', bate.b, sizeof(bate)); send_hex('B', b->b, sizeof(union bate));
if (config->send & SEND_CALIB) { if (config->send & SEND_CALIB) {
const union bate *b = &bate;
if (test_calib)
b = testdata+(--test_calib&3);
bate_calib(b, &pressure); bate_calib(b, &pressure);
send_str("P "); send_str("P ");
send_str(decimal_str(pressure.p, 1)); send_str(decimal_str(pressure.p, 1));

View file

@ -178,7 +178,7 @@ void send_hex_long(uint32_t b)
} }
__attribute__ ((noinline, noclone)) __attribute__ ((noinline, noclone))
void send_hex(uint8_t header, uint8_t *s, uint8_t n) void send_hex(uint8_t header, const uint8_t *s, uint8_t n)
{ {
send_char_sleep(header); send_char_sleep(header);
send_char_sleep(' '); send_char_sleep(' ');

View file

@ -24,7 +24,7 @@ uint8_t uart_break_p()
void send_hex_byte(uint8_t b); void send_hex_byte(uint8_t b);
void send_hex_word(uint16_t b); void send_hex_word(uint16_t b);
void send_hex_long(uint32_t b); void send_hex_long(uint32_t b);
void send_hex(uint8_t header, uint8_t *s, uint8_t n); void send_hex(uint8_t header, const uint8_t *s, uint8_t n);
void send_decimal(uint16_t b, uint8_t dec); void send_decimal(uint16_t b, uint8_t dec);
@ -36,7 +36,7 @@ void send_char_sleep(uint8_t c)
} }
static inline static inline
void send_str(char *s) void send_str(const char *s)
{ {
while (*s) while (*s)
send_char_sleep(*s++); send_char_sleep(*s++);