📄 main.c
字号:
/*
Special Connections:
EIA-232 Serial Cable (1:1)-not a null modem
Terminal Program (i.e. Hyperterminal for Windows)
- bit rate doesn't matter
- 8-bit, no parity, 1 stop bit
- no handshake
- echo off
- do not use null modem cable
tested 115200 baud *pUART_DLL=0x1d
57600 baud *pUART_DLL=0x3a
38400 baud *pUART_DLL=0x57
19200 baud *pUART_DLL=0xaf
9600 baud *pUART_DLL=0x15e
4800 baud *pUART_DLL=0x2bf
2400 baud *pUART_DLL=0x57e
*/
#include <string.h>
#include "bios.h"
#include "uart.h"
#include "xmodem.h"
#include "command.h"
#include "utils.h"
#include "flash.h"
#include "init.h"
void main()
{
UNS8 buffer[256];
UNS8 temp;
UNS8 i;
UNS8 *ptr = (UNS8 *)0x00;
UNS32 size;
UNS32 sum;
UNS32 address;
UNS8 key;
Device_init();
my_printf("\n\r\n\r#####################################################################\n\r");
my_printf( "# ADSP-BF532's Program loader! #\n\r");
my_printf( "# Down from Uart, Baudrate is 115200bps #\n\r");
my_printf( "#####################################################################\n\r\n\r");
// put_str("Press 'd' to upload App Program!\n\r",0);
//xmodem();
while(1)
{
my_printf("\n\rPlease Send Command: ");
key = get_ch();
my_printf("\n\r");
if( key == DOWN ){
my_printf("I wait for receive file...\n\r");
size = Down_func();
my_printf("Download size is 0x%x\n\r",size);
}else if ( key == WRITE ){
Write_Flash_func(size);
}else if ( key == READ ){
Read_Flash_func();
}else if (key == ERASE ){
UNS16 *ptr= (UNS16 *)0x20000000;
Flash_sector_erase(0x00);
for( i=0;i<200;i++)
{
for( temp = 0;temp <8;temp ++)
{
my_printf("0x%04x,",*ptr);
ptr++;
}
my_printf("\n\r");
}
}else if ( key == VERIFY ){
Verify_Flash_func(size);
}else if ( key == IDread ){
Read_Flash_ID_func();
}else if ( key == GOTO ){
GoTo_func();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -