[update] init psram before kmem_init

This commit is contained in:
jzlv 2023-03-06 10:37:40 +08:00
parent 765a5d5a51
commit eb7afedb20
5 changed files with 48 additions and 30 deletions

View file

@ -19,6 +19,7 @@ ENTRY(__start)
StackSize = 0x1000; /* 4KB */
HeapMinSize = 0x1000; /* 4KB */
psram_min_size = 0x1000;
__EM_SIZE = DEFINED(btble_controller_init) ? 32K : 0K;
__RFTLV_SIZE_OFFSET = 1K;
@ -279,6 +280,18 @@ SECTIONS
__psram_data_end__ = .;
} > ram_code
.psram_heap (NOLOAD):
{
. = ALIGN(4);
__psram_heap_base = .;
KEEP(*(.psram_heap*))
. = ALIGN(4);
__psram_heap_end = .;
} > ram_code
__psram_limit = ORIGIN(ram_code) + LENGTH(ram_code);
ASSERT(__psram_limit - __psram_heap_base >= psram_min_size, "psram heap region overflow")
.wifibss (NOLOAD) :
{
PROVIDE( __wifi_bss_start = ADDR(.wifibss) );

View file

@ -215,16 +215,21 @@ void board_init(void)
bflb_irq_initialize();
console_init();
size_t heap_len = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
kmem_init((void *)&__HeapBase, heap_len);
bl_show_log();
if (ret != 0) {
printf("flash init fail!!!\r\n");
}
bl_show_flashinfo();
#ifdef CONFIG_PSRAM
board_psram_x8_init();
Tzc_Sec_PSRAMB_Access_Release();
#endif
size_t heap_len = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
kmem_init((void *)&__HeapBase, heap_len);
printf("dynamic memory init success,heap size = %d Kbyte \r\n", ((size_t)&__HeapLimit - (size_t)&__HeapBase) / 1024);
printf("sig1:%08x\r\n", BL_RD_REG(GLB_BASE, GLB_UART_CFG1));
@ -237,11 +242,6 @@ void board_init(void)
rtc = bflb_device_get_by_name("rtc");
#endif
#ifdef CONFIG_PSRAM
board_psram_x8_init();
Tzc_Sec_PSRAMB_Access_Release();
#endif
bflb_irq_restore(flag);
}
@ -463,9 +463,11 @@ void board_i2s_gpio_init()
void board_iso11898_gpio_init()
{
// struct bflb_device_s *gpio;
struct bflb_device_s *gpio;
// gpio = bflb_device_get_by_name("gpio");
gpio = bflb_device_get_by_name("gpio");
bflb_gpio_iso11898_init(gpio, GPIO_PIN_14, GPIO_ISO11898_FUNC_TX);
bflb_gpio_iso11898_init(gpio, GPIO_PIN_15, GPIO_ISO11898_FUNC_RX);
}
#ifdef CONFIG_BFLOG

View file

@ -236,15 +236,19 @@ void board_init(void)
console_init();
size_t heap_len = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
kmem_init((void *)&__HeapBase, heap_len);
bl_show_log();
if (ret != 0) {
printf("flash init fail!!!\r\n");
}
bl_show_flashinfo();
#ifdef CONFIG_PSRAM
board_psram_init();
#endif
size_t heap_len = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
kmem_init((void *)&__HeapBase, heap_len);
printf("dynamic memory init success,heap size = %d Kbyte \r\n", ((size_t)&__HeapLimit - (size_t)&__HeapBase) / 1024);
printf("cgen1:%08x\r\n", getreg32(BFLB_GLB_CGEN1_BASE));
@ -253,9 +257,6 @@ void board_init(void)
#if defined(CONFIG_BFLOG)
rtc = bflb_device_get_by_name("rtc");
#endif
#ifdef CONFIG_PSRAM
board_psram_init();
#endif
bflb_irq_restore(flag);
}

View file

@ -22,7 +22,7 @@ HeapMinSize = 0x1000; /* 4KB */
MEMORY
{
fw_header_memory0 (rx) : ORIGIN = 0x58020000 - 0x1000, LENGTH = 4K
fw_header_memory (rx) : ORIGIN = 0x58020000 - 0x1000, LENGTH = 4K
xip_memory (rx) : ORIGIN = 0x58020000, LENGTH = 1M
itcm_memory (rx) : ORIGIN = 0x2202C000, LENGTH = 16K
dtcm_memory (rx) : ORIGIN = 0x22030000, LENGTH = 16K
@ -36,7 +36,7 @@ SECTIONS
.fw_header :
{
KEEP(*(.fw_header))
} > fw_header_memory0
} > fw_header_memory
.text :
{

View file

@ -245,15 +245,21 @@ void board_init(void)
console_init();
size_t heap_len = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
kmem_init((void *)&__HeapBase, heap_len);
bl_show_log();
if (ret != 0) {
printf("flash init fail!!!\r\n");
}
bl_show_flashinfo();
#ifdef CONFIG_PSRAM
if (uhs_psram_init() < 0) {
while (1) {
}
}
#endif
size_t heap_len = ((size_t)&__HeapLimit - (size_t)&__HeapBase);
kmem_init((void *)&__HeapBase, heap_len);
printf("dynamic memory init success,heap size = %d Kbyte \r\n", ((size_t)&__HeapLimit - (size_t)&__HeapBase) / 1024);
printf("sig1:%08x\r\n", BL_RD_REG(GLB_BASE, GLB_UART_CFG1));
@ -265,12 +271,6 @@ void board_init(void)
rtc = bflb_device_get_by_name("rtc");
#endif
#ifdef CONFIG_PSRAM
if (uhs_psram_init() < 0) {
while (1) {
}
}
#endif
/* set CPU D0 boot XIP address and flash address */
Tzc_Sec_Set_CPU_Group(GLB_CORE_ID_D0, 1);
/* D0 boot from 0x58000000 */
@ -554,9 +554,11 @@ void board_csi_gpio_init(void)
void board_iso11898_gpio_init()
{
// struct bflb_device_s *gpio;
struct bflb_device_s *gpio;
// gpio = bflb_device_get_by_name("gpio");
gpio = bflb_device_get_by_name("gpio");
bflb_gpio_iso11898_init(gpio, GPIO_PIN_14, GPIO_ISO11898_FUNC_TX);
bflb_gpio_iso11898_init(gpio, GPIO_PIN_15, GPIO_ISO11898_FUNC_RX);
}
#ifdef CONFIG_BFLOG