mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-02 02:41:28 +00:00
trezorhal: reorder stuff in common.{c,h}; remove unnecessary externs for functions
This commit is contained in:
parent
d9574bf131
commit
879a3e85bd
@ -318,7 +318,7 @@ static bool _read_payload(pb_istream_t *stream, const pb_field_t *field, void **
|
|||||||
|
|
||||||
static image_header hdr;
|
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)
|
secbool compare_to_current_vendor_header(const vendor_header * const new_vhdr)
|
||||||
{
|
{
|
||||||
|
@ -385,7 +385,7 @@ void display_print(const char *text, int textlen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TREZOR_UNIX
|
#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
|
#endif
|
||||||
|
|
||||||
// variadic display_print
|
// variadic display_print
|
||||||
|
@ -30,13 +30,6 @@ void __attribute__((noreturn)) __fatal_error(const char *expr, const char *msg,
|
|||||||
for (;;);
|
for (;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t __stack_chk_guard = 0;
|
|
||||||
|
|
||||||
void __attribute__((noreturn)) __stack_chk_fail(void)
|
|
||||||
{
|
|
||||||
ensure(secfalse, "Stack smashing detected");
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
void __assert_func(const char *file, int line, const char *func, const char *expr) {
|
void __assert_func(const char *file, int line, const char *func, const char *expr) {
|
||||||
__fatal_error(expr, "assert failed", file, line, func);
|
__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);
|
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
|
__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");
|
||||||
|
}
|
||||||
|
@ -4,20 +4,20 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "secbool.h"
|
#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);
|
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__))
|
#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 hal_delay(uint32_t ms);
|
||||||
|
|
||||||
void shutdown(void);
|
void clear_otg_hs_memory(void);
|
||||||
|
|
||||||
extern uint32_t __stack_chk_guard;
|
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
|
#endif
|
||||||
|
@ -52,7 +52,7 @@ void SysTick_Handler(void)
|
|||||||
uwTick++;
|
uwTick++;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void shutdown(void);
|
void shutdown(void);
|
||||||
|
|
||||||
void PVD_IRQHandler(void)
|
void PVD_IRQHandler(void)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user