不能调用 sbl_printf 的地方可以使用函数指针来调用

This commit is contained in:
2024-11-01 19:16:40 +08:00
parent 16714f4caa
commit ff1d8f698a
4 changed files with 24 additions and 5 deletions

View File

@@ -9,8 +9,15 @@
c_cpp_properties.json 中指定了编译器路径之后 如果此编译器不在path路径中 c_cpp_properties.json 中指定了编译器路径之后 如果此编译器不在path路径中
则会出现类似找不到 stdarg.h 的问题 则会出现类似找不到 stdarg.h 的问题
指定了 riscv 的编译器之后 clear_csr write_csr 宏可以正常找到 指定了 riscv 的编译器之后 clear_csr write_csr 宏可以正常找到
2024.410.27 2024.10.27
要解决 oem分区空间不够的问题 要解决 oem分区空间不够的问题
如果把超出的部分添加在fw分区后面 应该是需要修改 ram.bin 的, 如果把超出的部分添加在fw分区后面 应该是需要修改 ram.bin 的,
因为ram.bin 写入数据的长度是读取的分区size 这个size不能动 因为解压也需要使用这个参数 因为ram.bin 写入数据的长度是读取的分区size 这个size不能动 因为解压也需要使用这个参数
或者考虑添加在未压缩的ht.bin 文件后面? 或者考虑添加在未压缩的ht.bin 文件后面?
2024.11.1
如果函数在库中被调用 则这个函数不能使用 extern 到链接脚本的函数
例如 gpio_pin_select 函数在 driver 库中被调用 则不能使用 sbl_parintf
但 board_load_oem_cfg 没有在库中被调用 可以使用 sbl_parintf
要解决个问题 可以用一个函数指针来强行定位到这个函数的地址 调用这个函数指针即可
2024.11.1
layout_index 并不最终决定使用的layout 获取layout时会根据 flash psram 来重新指定

View File

@@ -21,6 +21,7 @@ Information is free from patent or copyright infringement.
#include "pin_rf.h" #include "pin_rf.h"
#include "gpio_mtx_hw.h" #include "gpio_mtx_hw.h"
#include "apb.h" #include "apb.h"
#include "iot_config.h"
#define GPIO_MTX_CHECK(a) \ #define GPIO_MTX_CHECK(a) \
if (!(a)) { \ if (!(a)) { \
@@ -118,7 +119,9 @@ void gpio_pin_oinv(uint32_t pin, uint32_t val)
PIN_RF_WRITE_REG(offset, tmp); PIN_RF_WRITE_REG(offset, tmp);
} }
void gpio_pin_select(uint32_t pin, uint32_t func) static_printf_def(0x10001b9e)
void gpio_pin_select(uint32_t pin , uint32_t func)
{ {
uint32_t tmp; uint32_t tmp;
uint32_t offset; uint32_t offset;
@@ -127,7 +130,8 @@ void gpio_pin_select(uint32_t pin, uint32_t func)
offset = PIN_GET_OFFSET(pin); offset = PIN_GET_OFFSET(pin);
tmp = PIN_RF_READ_REG(offset); tmp = PIN_RF_READ_REG(offset);
REG_FIELD_SET(GPIO_FUNC_SEL, tmp, func); REG_FIELD_SET(GPIO_FUNC_SEL, tmp, func);
PIN_RF_WRITE_REG(offset, tmp); PIN_RF_WRITE_REG(offset , tmp);
sbl_printf("gpio pin=%d , fun=%d\n" , pin , func);
} }
uint8_t gpio_pin_get_select(uint32_t pin) uint8_t gpio_pin_get_select(uint32_t pin)

View File

@@ -142,4 +142,11 @@ Information is free from patent or copyright infringement.
/* FTM configuration end ******************************************************/ /* FTM configuration end ******************************************************/
// 定义本地用于打印的函数指针
#define static_printf_def(addr) \
typedef int32_t (*static_printf)(const char *fmt, ...);\
static static_printf sbl_printf= (static_printf)addr;
#endif /* IOT_CONFIG_H */ #endif /* IOT_CONFIG_H */

View File

@@ -210,7 +210,8 @@ void ramImageTableUpgrade(uint8_t flash_size, uint8_t psram_flag,
} }
} }
void ramReloadFlashBurnImageTable(uint8_t flash_size, uint8_t psram_flag, // 这个函数会根据实际配置重新指定layout_index
void ramReloadFlashBurnImageTable(uint8_t flash_size , uint8_t psram_flag ,
uint8_t pkt_type, uint8_t layout_index) uint8_t pkt_type, uint8_t layout_index)
{ {
if (layout_index != FLASH_LAYOUT_INDEX_INVALID_VALUE) { if (layout_index != FLASH_LAYOUT_INDEX_INVALID_VALUE) {