Skip to content

Commit 0e985f1

Browse files
committed
[embedded] Add comment about UART emulator usage, drop unneccessary attribute((used))
1 parent 8620a99 commit 0e985f1

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

utils/embedded-test-support/arm-qemu-stm32f1/support.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ void qemu_exit() {
5454
}
5555

5656
int putchar(int c) {
57+
// This is only valid in an emulator (QEMU), and it's skipping a proper configuration of the UART device
58+
// and waiting for a "ready to transit" state.
59+
5760
// STM32F1 specific location of USART1 and its DR register
5861
*(volatile uint32_t *)(0x40013800 + 0x04) = c;
5962
return c;

utils/embedded-test-support/arm-qemu-stm32f4/support.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ void qemu_exit() {
5454
}
5555

5656
int putchar(int c) {
57+
// This is only valid in an emulator (QEMU), and it's skipping a proper configuration of the UART device
58+
// and waiting for a "ready to transit" state.
59+
5760
// STM32F4 specific location of USART1 and its DR register
5861
*(volatile uint32_t *)(0x40011000 + 0x04) = c;
5962
return c;

utils/embedded-test-support/avr-qemu-atmega2560/support.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ void usart_init() {
3232
*((volatile char *)0xc1) = 1 << 3; // enable TX on UART0
3333
}
3434

35-
__attribute__((used))
36-
static inline void *memcpy_flash_to_sram(void *restrict dst, const void __attribute__((__address_space__(1))) *restrict src, size_t n) {
35+
void *memcpy_flash_to_sram(void *restrict dst, const void __attribute__((__address_space__(1))) *restrict src, size_t n) {
3736
for (int i = 0; i < n; i++) {
3837
((char *)dst)[i] = ((char __attribute__((__address_space__(1))) *)src)[i];
3938
}
@@ -46,6 +45,9 @@ void copy_data_from_flash_to_sram() {
4645
}
4746

4847
int putchar(int c) {
48+
// This is only valid in an emulator (QEMU), and it's skipping a proper configuration of the UART device
49+
// and waiting for a "ready to transit" state.
50+
4951
// AVR's UART0 DR register
5052
*((volatile char *)0xc6) = c;
5153
return c;

0 commit comments

Comments
 (0)