forked from xuos/xiuos
Add four macro definitions:
#define XIUOS_FLAH_ADDRESS 0x60100000 #define BAKUP_FLAH_ADDRESS 0x60300000 #define DOWN_FLAH_ADDRESS 0x60500000 #define FLAG_FLAH_ADDRESS 0x60700000
This commit is contained in:
parent
198fabf970
commit
bbb8dd75f8
|
@ -5,10 +5,7 @@ ifeq ($(CONFIG_BSP_USING_SDIO),y)
|
|||
endif
|
||||
|
||||
ifeq ($(CONFIG_BSP_USING_OTA),y)
|
||||
SRC_FILES += fsl_romapi.c flash.c mcuboot.c
|
||||
ifeq ($(CONFIG_MCUBOOT_BOOTLOADER),y)
|
||||
SRC_FILES += common.c ymodem.c
|
||||
endif
|
||||
SRC_FILES += fsl_romapi.c flash.c mcuboot.c common.c ymodem.c
|
||||
endif
|
||||
|
||||
include $(KERNEL_ROOT)/compiler.mk
|
||||
|
|
|
@ -51,7 +51,7 @@ static void UartConfig(void)
|
|||
|
||||
static void jump_to_application(void)
|
||||
{
|
||||
SCB->VTOR = (uint32_t)0x60100000;
|
||||
SCB->VTOR = (uint32_t)XIUOS_FLAH_ADDRESS;
|
||||
|
||||
asm volatile("LDR R0, = 0x60100000");
|
||||
asm volatile("LDR R0, [R0]");
|
||||
|
@ -101,7 +101,7 @@ void BootLoaderJumpApp(void)
|
|||
break;
|
||||
case 0x32:
|
||||
FLASH_Init();
|
||||
SerialDownload();
|
||||
SerialDownload(XIUOS_FLAH_ADDRESS);
|
||||
FLASH_DeInit();
|
||||
break;
|
||||
case 0x33:
|
||||
|
|
|
@ -19,13 +19,11 @@
|
|||
* @date: 2023/3/24
|
||||
*/
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#include "ymodem.h"
|
||||
#include "string.h"
|
||||
#include "flash.h"
|
||||
|
||||
#define BL_APP_VECTOR_TABLE_ADDRESS 0x60100000
|
||||
|
||||
uint8_t tab_1024[1024] ={0};
|
||||
uint8_t FileName[FILE_NAME_LENGTH];
|
||||
|
@ -208,17 +206,17 @@ static int32_t Receive_Packet (uint8_t *data, int32_t *length, uint32_t timeout)
|
|||
|
||||
/**
|
||||
* @brief Receive a file using the ymodem protocol
|
||||
* @param buf: Address of the first byte
|
||||
* @param buf: Address of the first byte,addr:download flash start address
|
||||
* @retval The size of the file
|
||||
*/
|
||||
int32_t Ymodem_Receive (uint8_t *buf)
|
||||
int32_t Ymodem_Receive (uint8_t *buf, const uint32_t addr)
|
||||
{
|
||||
uint8_t packet_data[PACKET_1K_SIZE + PACKET_OVERHEAD], file_size[FILE_SIZE_LENGTH], *file_ptr, *buf_ptr;
|
||||
int32_t i, packet_length, session_done, file_done, packets_received, errors, session_begin, size = 0;
|
||||
uint32_t flashdestination;
|
||||
|
||||
/* Initialize flashdestination variable */
|
||||
flashdestination = BL_APP_VECTOR_TABLE_ADDRESS;
|
||||
flashdestination = addr;
|
||||
|
||||
for (session_done = 0, errors = 0, session_begin = 0; ;)
|
||||
{
|
||||
|
@ -276,7 +274,7 @@ int32_t Ymodem_Receive (uint8_t *buf)
|
|||
}
|
||||
/* erase user application area */
|
||||
|
||||
NOR_FLASH_Erase(BL_APP_VECTOR_TABLE_ADDRESS,size);
|
||||
NOR_FLASH_Erase(addr,size);
|
||||
Send_Byte(ACK);
|
||||
Send_Byte(CRC16);
|
||||
}
|
||||
|
@ -352,16 +350,16 @@ int32_t Ymodem_Receive (uint8_t *buf)
|
|||
|
||||
/**
|
||||
* @brief Download a file via serial port
|
||||
* @param None
|
||||
* @param flash start addr
|
||||
* @retval None
|
||||
*/
|
||||
void SerialDownload(void)
|
||||
void SerialDownload(const uint32_t addr)
|
||||
{
|
||||
uint8_t Number[10] = {0};
|
||||
int32_t Size = 0;
|
||||
|
||||
Serial_PutString("Waiting for the file to be sent ... (press 'a' to abort)\n\r");
|
||||
Size = Ymodem_Receive(&tab_1024[0]);
|
||||
Size = Ymodem_Receive(&tab_1024[0], addr);
|
||||
if (Size > 0)
|
||||
{
|
||||
Serial_PutString("\n\n\r Programming Completed Successfully!\n\r--------------------------------\r\n Name: ");
|
||||
|
|
|
@ -30,6 +30,11 @@
|
|||
#define FREQ_1MHz (1000000UL)
|
||||
#define FLEXSPI_DLLCR_DEFAULT (0x100UL)
|
||||
|
||||
#define XIUOS_FLAH_ADDRESS 0x60100000
|
||||
#define BAKUP_FLAH_ADDRESS 0x60300000
|
||||
#define DOWN_FLAH_ADDRESS 0x60500000
|
||||
#define FLAG_FLAH_ADDRESS 0x60700000
|
||||
|
||||
enum
|
||||
{
|
||||
kFlexSpiDelayCellUnit_Min = 75, // 75ps
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#define BL_APP_VECTOR_TABLE_ADDRESS 0x60100000 //Application start address
|
||||
#define USER_FLASH_SIZE 0x100000 //Application package size is limited to 1M
|
||||
#define PACKET_SEQNO_INDEX (1)
|
||||
#define PACKET_SEQNO_COMP_INDEX (2)
|
||||
|
@ -52,7 +51,7 @@
|
|||
#define NAK_TIMEOUT (0x100000)
|
||||
#define MAX_ERRORS (5)
|
||||
|
||||
void SerialDownload(void);
|
||||
int32_t Ymodem_Receive (uint8_t *);
|
||||
void SerialDownload(const uint32_t addr);
|
||||
int32_t Ymodem_Receive (uint8_t *buf, const uint32_t addr);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue