4 posts / 0 new
Last post
GGQ_in
Offline
Last seen:2 months 3 weeks ago
加入:2019-07-23 04:41
SPOTA中二次引导的地址设置问题

你好,

在Secondary Bootloader 工程中,将image加载到SRAM时为何SUPPORT_AN_B_001不使能,如果使能就是从OTP中加载吗?

从spi flash中加载和使能SUPPORT_AN_B_001有何不同?

如果我想把image header 和 product header 的地址改变不使用0x7052 0x7051的话是否能实现?

/************** AN-B-001 based image /fast bootloader section **************/
// Define it if
// if AN-B-001 based image is burned in SPI flash and the bootloader is running from the OTP
#undef SUPPORT_AN_B_001 //Enable it for the secondary bootloader

//从spi flash 中加载函数如下:

int spi_loadActiveImage(void)
{
//Initiate the SPI interface
spi_flash_peripheral_init(); //spi GPIO接口引脚 初始化
spi_flash_release_from_power_down(); //required if the flash has been set to power down by the application

#ifdef SUPPORT_AN_B_001
uint8 AN001Header[AN001_SPI_HEADER_SIZE];
// check for AN-B-001 header
SpiFlashRead((unsigned long)&AN001Header, (unsigned long) 0, (unsigned long)AN001_SPI_HEADER_SIZE);
if (AN001Header[0]==0x70 && AN001Header[1]==0x50) { //it must be disabled if the bootloader runs from the SPI flash
SpiFlashRead(SYSRAM_BASE_ADDRESS, (unsigned long)AN001_SPI_STARTCODE_POSITION, (unsigned long) (AN001Header[6]<<8 | AN001Header[7]));
return 0;
}
else
{

#if defined(ALLOW_NO_HEADER)

// Load 0x7F00 bytes from memory offset 0.
SpiFlashRead(SYSRAM_BASE_ADDRESS, 0, 0x7F00);
return 0;

#endif // defined(ALLOW_NO_HEADER)
}

// No AN-B-001 valid image has been found in SPI flash. Return error.
return -1;
#else
spi_flash_size_init(); //读取设备id,配置spi flash 大小
返回loadActiveImage(); //加载img
#endif
}

Device:
CYibin
Offline
Last seen:4 months 5 days ago
Staff
加入:2017-12-14 02:48
你好,

你好,

580 芯片内部有一个 ROM BOOT,

ROM BOOT 的功能是会判断 OTP 中是否有有效固件,有则将代码加载到 RAM 中执行,无则会去各个口(uart, spi slave, spi master, iic 等)去重新加载

我们可将 secondary bootloader 放在 OTP(flash 也行) 中,则

芯片上电后,将 secondary bootloader 加载到 ram 中运行,功能是:

1. 到指定的地址(该地址可自定义)找到 product header

2. 解析 product header, 获知 image 1 header 和 image 2 header 的信息

3. 将有效的 image 加载到 ram 中执行

使能了 AN-B-001 和不使能的区别,仅是加载固件的方式不同,去深究没有什么意义;建议按照默认的,不使能即可。

product header, image headers,image 的起始地址等的修改,都可通过修改 secondary bootloader 的源码来实现。

GGQ_in
Offline
Last seen:2 months 3 weeks ago
加入:2019-07-23 04:41
谢谢您的解答

谢谢您的解答

CYibin
Offline
Last seen:4 months 5 days ago
Staff
加入:2017-12-14 02:48
不客气~

不客气~

Topic locked