RSL10读取Flash数据方法

1.RSL10的ROM MAP图

2.从Main Flash中读取4k数据并存入PRAM2后打印的程序

void FLASH_COPY_IRQHandler(void)
{
    flash_copier_complete = 1;
}

uint8_t Flash_Read_nBytes_To_Ram(uint32_t flash_addr,uint32_t ram_temp,uint32_t data_leng)
{
	
	 /* Enable the flash copier interrupt */
    NVIC_EnableIRQ(FLASH_COPY_IRQn);
	
	    /* Clear the program flag */
    flash_copier_complete = 0;

    PRINTF("DEVICE INITIALIZED\n");
    /* 1. The first 4 KB of the flash is copied into the CRC block and
     *    the value is stored in crc_flash_result */

    /* Configure the CRC engine */
    Sys_CRC_Set_Config(CRC_32 | CRC_LITTLE_ENDIAN);

    /* Reset the CRC engine */
    CRC->VALUE = CRC_32_INIT_VALUE;
		
		    /* Set the flash copier to copy to PRAM;
     * wait for the copy to complete before continuing */
    Sys_Flash_Copy(FLASH_MAIN_BASE, PRAM2_BASE, 1024, COPY_TO_MEM_BITBAND);
		
		while (flash_copier_complete == 0);	

		
    PRINTF("\n**@Flash_Read_nBytes_To_Ram\r\n");//printf one frame		
	  for(uint32_t i=0;i<data_leng;i++)
	  {
				PRINTF("%08x ",p_pram2[i]);//OTA_STM32_Bin_File_Buf[i]);//printf data		
			  if(i%16==15) PRINTF("\r\n");
		} 
		PRINTF("\r\n");
		return true;
 }

3.从J-Flash读取函数烧录的代码

4.从J-Link RTT Viewer中查看打印输出内容

按4组显示方式:

按16组显示方式:

5.把从J-Flash读取函数烧录的代码与从J-Link RTT Viewer中查看打印输出内容做对照

6.数据分析举例:

从J-Flash读取函数烧录的代码:                   00 60 00 20  65 01 10 00  75 01 10 00   77 01 10 00

从J-Link RTT Viewer中查看打印输出内容: 20006000     00100165     00100175       00100177

从以上对照可以知道:Flash是按字读出,即每次读出是4个字节,而且在Flash中的4个字节是高字节在后,低字节在前面。比如0x12345678,在flash中的依次存储内容为:0x78 0x56 0x34 0x12,也就是所谓的小端存储模式。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值