Skip to content

Commit b70a20f

Browse files
Some bug fixes..
1 parent 80749ac commit b70a20f

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

simavr/sim/avr/avr_mcu_section.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ struct avr_mmcu_vcd_trace_t {
143143
#define AVR_MCU_LONGLONG(_tag, _val) \
144144
const struct avr_mmcu_longlong_t DO_CONCAT(DO_CONCAT(_, _tag), __LINE__) _MMCU_ = {\
145145
.tag = _tag,\
146-
.len = sizeof(struct avr_mmcu_long_t) - 2,\
146+
.len = sizeof(struct avr_mmcu_longlong_t) - 2,\
147147
.val = _val,\
148148
}
149149

simavr/sim/avr_spi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ static avr_cycle_count_t avr_spi_raise(struct avr_t * avr, avr_cycle_count_t whe
3434
}
3535
// the last received byte will be echoed back the next time, unless user overrides it
3636
p->output_data_register = p->input_data_register;
37+
if (p->flags & AVR_SPI_FLAG_BITBANG_ON)
38+
p->bit_bang.data = p->output_data_register;
3739
}
3840
return 0;
3941
}

simavr/sim/sim_elf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ avr_load_firmware(
117117
}
118118
if ((firmware->bitbang_on_mask & BITBANG_ON_SPI(name - '0')) != 0) {
119119
uint32_t f = 0;
120-
avr_ioctl(avr, AVR_IOCTL_SPI_GET_FLAGS(name), &f);
120+
avr_ioctl(avr, AVR_IOCTL_SPI_GET_FLAGS(name - '0'), &f);
121121
f |= AVR_SPI_FLAG_BITBANG_ON;
122-
avr_ioctl(avr, AVR_IOCTL_SPI_SET_FLAGS(name), &f);
122+
avr_ioctl(avr, AVR_IOCTL_SPI_SET_FLAGS(name - '0'), &f);
123123
}
124124
if ((firmware->bitbang_on_mask & BITBANG_ON_UART(name)) != 0) {
125125
//TODO: implement bitbang mode for UART modeule

0 commit comments

Comments
 (0)