diff --git a/embed/bootloader/messages.c b/embed/bootloader/messages.c index bdf479fa07..e9be5862e7 100644 --- a/embed/bootloader/messages.c +++ b/embed/bootloader/messages.c @@ -318,7 +318,7 @@ static bool _read_payload(pb_istream_t *stream, const pb_field_t *field, void ** static image_header hdr; -extern secbool load_vendor_header_keys(const uint8_t * const data, vendor_header * const vhdr); +secbool load_vendor_header_keys(const uint8_t * const data, vendor_header * const vhdr); secbool compare_to_current_vendor_header(const vendor_header * const new_vhdr) { diff --git a/embed/extmod/modtrezorui/display.c b/embed/extmod/modtrezorui/display.c index 7091fa5aa8..8e68966f4a 100644 --- a/embed/extmod/modtrezorui/display.c +++ b/embed/extmod/modtrezorui/display.c @@ -385,7 +385,7 @@ void display_print(const char *text, int textlen) } #ifndef TREZOR_UNIX -extern int mini_vsnprintf(char* buffer, unsigned int buffer_len, const char *fmt, va_list va); +int mini_vsnprintf(char* buffer, unsigned int buffer_len, const char *fmt, va_list va); #endif // variadic display_print diff --git a/embed/trezorhal/common.c b/embed/trezorhal/common.c index 9a6d05a7f3..ae9e716dc5 100644 --- a/embed/trezorhal/common.c +++ b/embed/trezorhal/common.c @@ -30,13 +30,6 @@ void __attribute__((noreturn)) __fatal_error(const char *expr, const char *msg, for (;;); } -uint32_t __stack_chk_guard = 0; - -void __attribute__((noreturn)) __stack_chk_fail(void) -{ - ensure(secfalse, "Stack smashing detected"); -} - #ifndef NDEBUG void __assert_func(const char *file, int line, const char *func, const char *expr) { __fatal_error(expr, "assert failed", file, line, func); @@ -59,3 +52,10 @@ void clear_otg_hs_memory(void) memset_reg((volatile void *) USB_OTG_HS_DATA_FIFO_RAM, (volatile void *) (USB_OTG_HS_DATA_FIFO_RAM + USB_OTG_HS_DATA_FIFO_SIZE), 0); __HAL_RCC_USB_OTG_HS_CLK_DISABLE(); // disable USB OTG_HS peripheral clock as the peripheral is not needed right now } + +uint32_t __stack_chk_guard = 0; + +void __attribute__((noreturn)) __stack_chk_fail(void) +{ + ensure(secfalse, "Stack smashing detected"); +} diff --git a/embed/trezorhal/common.h b/embed/trezorhal/common.h index 1bcc86ffab..7973eb7b1c 100644 --- a/embed/trezorhal/common.h +++ b/embed/trezorhal/common.h @@ -4,20 +4,20 @@ #include #include "secbool.h" -extern void memset_reg(volatile void *start, volatile void *stop, uint32_t val); - -void clear_otg_hs_memory(void); - void __attribute__((noreturn)) __fatal_error(const char *expr, const char *msg, const char *file, int line, const char *func); #define ensure(expr, msg) (((expr) == sectrue) ? (void)0 : __fatal_error(#expr, msg, __FILE__, __LINE__, __func__)) -void jump_to(uint32_t address); - void hal_delay(uint32_t ms); -void shutdown(void); +void clear_otg_hs_memory(void); extern uint32_t __stack_chk_guard; +// the following functions are defined in util.s + +void memset_reg(volatile void *start, volatile void *stop, uint32_t val); +void jump_to(uint32_t address); +void shutdown(void); + #endif diff --git a/embed/trezorhal/stm32.c b/embed/trezorhal/stm32.c index d243b967b4..7fe809ff8e 100644 --- a/embed/trezorhal/stm32.c +++ b/embed/trezorhal/stm32.c @@ -52,7 +52,7 @@ void SysTick_Handler(void) uwTick++; } -extern void shutdown(void); +void shutdown(void); void PVD_IRQHandler(void) {