[beken-72xx] Don't init everything by default, make it quiet
This commit is contained in:
@@ -94,6 +94,7 @@ env.Append(
|
||||
"-Wl,-wrap,snprintf",
|
||||
"-Wl,-wrap,sprintf",
|
||||
"-Wl,-wrap,vsnprintf",
|
||||
"-Wl,-wrap,bk_printf",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -137,6 +138,7 @@ env.AddLibrary(
|
||||
"+<arch_main.c>",
|
||||
"+<ate_app.c>",
|
||||
"+<intc.c>",
|
||||
"+<wrap.c>",
|
||||
*srcs_fixups,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -9,14 +9,15 @@
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
#include "app.h"
|
||||
#include "BkDriverFlash.h"
|
||||
#include "BkDriverWdg.h"
|
||||
#include "driver_pub.h"
|
||||
#include "func_pub.h"
|
||||
#include "include.h"
|
||||
#include "intc.h"
|
||||
#include "param_config.h"
|
||||
#include "start_type_pub.h"
|
||||
|
||||
extern void user_main_entry(void);
|
||||
|
||||
#if CFG_SUPPORT_BOOTLOADER
|
||||
void entry_set_world_flag(void) {
|
||||
*(volatile uint32_t *)0x00400000 = 1;
|
||||
@@ -24,12 +25,15 @@ void entry_set_world_flag(void) {
|
||||
#endif // CFG_SUPPORT_BOOTLOADER
|
||||
|
||||
extern void main(void);
|
||||
extern unsigned char __disable_bk_printf;
|
||||
|
||||
void entry_main(void) {
|
||||
// compatibility with BK7231S_1.0.5
|
||||
#if CFG_SUPPORT_BOOTLOADER
|
||||
entry_set_world_flag();
|
||||
#endif
|
||||
// suppress all output during initialization
|
||||
__disable_bk_printf = 1;
|
||||
// read reboot cause into bk_misc_get_start_type()
|
||||
bk_misc_init_start_type();
|
||||
// clear driver registration arrays
|
||||
@@ -37,10 +41,16 @@ void entry_main(void) {
|
||||
// reboot the board if start_type == RESET_SOURCE_CRASH_PER_XAT0
|
||||
bk_misc_check_start_type();
|
||||
// init drivers
|
||||
func_init_basic();
|
||||
func_init_extended();
|
||||
// run core initialization tasks
|
||||
app_pre_start();
|
||||
intc_init();
|
||||
hal_flash_init();
|
||||
cfg_param_init();
|
||||
// enable watchdog
|
||||
#if CFG_INT_WDG_ENABLED
|
||||
bk_wdg_initialize(CFG_INT_WDG_PERIOD_MS);
|
||||
bk_wdg_reload();
|
||||
#endif
|
||||
// enable bk_printf output again
|
||||
__disable_bk_printf = 0;
|
||||
// run the app
|
||||
main();
|
||||
}
|
||||
|
||||
8
platform/beken-72xx/fixups/inc/param_config.h
Normal file
8
platform/beken-72xx/fixups/inc/param_config.h
Normal file
@@ -0,0 +1,8 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-06-14. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include_next "param_config.h"
|
||||
|
||||
#undef WIFI_MAC_POS
|
||||
#define WIFI_MAC_POS -1 // do not use stored MAC address by default
|
||||
22
platform/beken-72xx/fixups/wrap.c
Normal file
22
platform/beken-72xx/fixups/wrap.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-06-14. */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
|
||||
extern int __wrap_vsnprintf(char *str, size_t size, const char *format, va_list args);
|
||||
extern void bk_send_string(unsigned char uport, const char *string);
|
||||
extern int uart_print_port;
|
||||
|
||||
unsigned char __disable_bk_printf = 0;
|
||||
|
||||
void __wrap_bk_printf(const char *fmt, ...) {
|
||||
if (__disable_bk_printf)
|
||||
return;
|
||||
va_list ap;
|
||||
char string[128];
|
||||
va_start(ap, fmt);
|
||||
__wrap_vsnprintf(string, sizeof(string) - 1, fmt, ap);
|
||||
string[127] = 0;
|
||||
bk_send_string(uart_print_port, string);
|
||||
va_end(ap);
|
||||
}
|
||||
Reference in New Issue
Block a user