查閱了很多資料,關於這個28377芯片的貢獻實在有點少,可能大師們自己知道並不願意分享吧!第一次發帖,很緊張。。>_<。
本人使用的編譯器爲CCS v8.3.0 ,關於W5500的資料早已爛大街了,這裏主要對官方tftp傳輸稍作修改(個人官方tftp狀態機很亂,詳細參考:https://w5500.com/code.html) , 話不多說,上代碼:
#include "tftp.h"
#include "env.h"
#ifdef OPTION_ENABLE
static TFTP_OPTION default_tftp_opt;//=
{
.code = (uint8_t *)"timeout",
.value = (uint8_t *)"3"
};
#endif
// return 0:IP匹配完成 ,1:IP 匹配失敗
int ip_addr_comp(uint8_t *src ,uint8_t *comp)
{
uint8_t i=0;
for(i=0;i<4;i++)
{
if(src[i]!=comp[i]) return 1;
}
return 0;
}
int open_tftp_socket(uint8_t sock)
{
uint8_t sd, sck_state;
uint8_t retry =0;
he: sd = socket(sock, Sn_MR_UDP, 5100,0);
if(sd != 1)
{
return -1;
}
sck_state=getSn_SR(sock);
if(sck_state != SOCK_UDP)
{
if(++retry>10)
{
return -1;
}
goto he;
}
return sock;
}
uint16_t recv_udp_packet(int socket, uint8_t *packet, uint32_t len, uint8_t *ip, uint16_t *port)
{
// int ret;
uint8_t sck_state;
uint16_t recv_len;
/* Receive Packet Process */
sck_state=getSn_SR(socket);
if(sck_state == SOCK_UDP)
{
if(getSn_IR(socket) & Sn_IR_RECV)
{
setSn_IR(socket, Sn_IR_RECV);// Sn_IR的RECV位置1
}
recv_len=getSn_RX_RSR(socket);
if(recv_len)
{
recv_len = recvfrom(socket, packet, recv_len, (uint8_t *)ip, port);
return recv_len;
}
}
return 0;
}
static const char *error_string[8] =
{"Not defined error!", // 0
"File not found!", // 1
"Access denied!", // 2
"Disk full or allocation exceeded!", // 3
"Illegal TFTP operation!", // 4
"Unknown transfer ID!", // 5
"File already exists!", // 6
"No such user!" // 7
};
static uint8_t tmp_buffer[MAX_MTU_SIZE];
// tftp 獲取文件
// return 0:fail ,1:ok
int tftp_get(struct tty *ptty ,char *filename,uint32_t *getbuf,uint32_t *getlen,uint32_t getmax)
{
char *typestr;
int Socket;
uint8_t server_ip[4];
uint8_t *pkt = tmp_buffer;
uint32_t len;
#ifdef OPTION_ENABLE
TFTP_OPTION *opt =&default_tftp_opt;//選項字節
#endif
uint32_t pos=0; //全局存儲長度
uint16_t flgst=0;
uint16_t from_port;
uint8_t from_ip[4]; //
uint16_t cur_tick,last_tick,det_tick;
uint16_t opcode,current_pack,last_pack;
if((Socket=open_tftp_socket(SOCK_TFTP))<0)
{
ptty->printf("[%s] socket error\r\n", __func__);
goto err;
}
typestr = env_get("serverip");
inet_addr_((uint8_t*)typestr,server_ip);
pkt[0] =0;
pkt[1] = TFTP_RRQ; //2019-9-20 add
pkt += 2;
strcpy((char *)pkt, (const char *)filename);
pkt += strlen((char *)filename) + 1;
strcpy((char *)pkt, (const char *)TRANS_BINARY);
pkt += strlen((char *)TRANS_BINARY) + 1;
#ifdef OPTION_ENABLE
for(i = 0 ; i < 1 ; i++) {
strcpy((char *)pkt, (const char *)opt[i].code);
pkt += strlen((char *)opt[i].code) + 1;
strcpy((char *)pkt, (const char *)opt[i].value);
pkt += strlen((char *)opt[i].value) + 1;
}
#endif
len = pkt - tmp_buffer;
sendto(Socket, tmp_buffer, len, server_ip, TFTP_SERVER_PORT);
last_pack = 0;
offset_len =0;
flgst =0;
while(1)
{
/* Receive Packet Process */
len = recv_udp_packet(Socket, tmp_buffer, MAX_MTU_SIZE, from_ip, &from_port);
if(len < 1)
{
if(flgst==0)
{
flgst=1;
last_tick =mde_stc_GetTick();
}
cur_tick = mde_stc_GetTick();
det_tick=cur_tick >= last_tick ? (cur_tick - last_tick): (Sysms_time_MAX + cur_tick - last_tick);
if(det_tick>3000)
{
ptty->printf("recv_udp_packet timeout\r\n");
goto err;
}
}
else//Normal
{
last_tick =mde_stc_GetTick(); //time tick
if(ip_addr_comp(server_ip,from_ip)) /* Verify Server IP */
{
ptty->printf("Server IP faults\r\n");
goto err;
}
opcode =(uint16_t )tmp_buffer[0]<<8;
opcode|=tmp_buffer[1];
switch(opcode)
{
case TFTP_DATA :
current_pack =(uint16_t )tmp_buffer[2]<<8;
current_pack|=tmp_buffer[3];
if ((last_pack + 1) != current_pack)
{
ptty->printf("\ntftp: packet err!\n");
goto err;
}
last_pack = current_pack;
if (pos + len - 4 > getmax)
{
ptty->printf("\ntftp: mem is over\n");
goto err;
}
//TODO: 由於我的單板有SDRAM,這裏開始將數據寫入外部SDRAM中 。。。
//
//if(0==tftp_data_save(&tmp_buffer[4],len,getbuf,&pos))
//{
// ptty->printf("offset_len>=4???\n");
// }
/* make ACK */
tmp_buffer[0] = 0;
tmp_buffer[1] = TFTP_ACK; /* opcode */
/* send ACK */
sendto(Socket, tmp_buffer, 4, from_ip, from_port);
//
if (pos % 50 == 0) ptty->printf("*");
if (len != 516) goto ok;
break;
case TFTP_ERROR:
current_pack =(uint16_t )tmp_buffer[2]<<8;
current_pack|=tmp_buffer[3];
if(current_pack>7) current_pack=0;
ptty->printf("err: %s\n", error_string[current_pack]);
goto err;
default:
ptty->printf("unknow error! \n");
goto err;
}
}
}
ok: ptty->printf("\ndone \n");
close(Socket);
getlen[0] = pos;
return 1;
err:
close(Socket);
return 0;
}
// 發送文件
//return 0:fail ,1:ok
int tftp_send(struct tty *ptty , uint32_t *mem , char *filename , unsigned long setlen)
{
char *typestr;
int Socket;
uint8_t server_ip[4];
uint8_t *pkt = tmp_buffer;
uint32_t i, len,remainLenth;
#ifdef OPTION_ENABLE
TFTP_OPTION *opt =&default_tftp_opt;//選項字節
#endif
uint16_t flgst=0;
uint32_t pos=0;
uint16_t from_port;
uint8_t from_ip[4]; //
uint16_t cnt = 0;
uint16_t cur_tick,last_tick,det_tick;
uint16_t opcode,current_pack,last_pack;
uint16_t half_num =0;
uint32_t data_temp =0;
if((Socket=open_tftp_socket(SOCK_TFTP))<0)
{
ptty->printf("[%s] socket error\r\n", __func__);
goto err;
}
typestr = env_get("serverip");
inet_addr_((uint8_t*)typestr,server_ip);
/*協議開始*/
/*操作碼*/
pkt[0] =0;
pkt[1] = TFTP_WRQ;
pkt += 2;
strcpy((char *)pkt, (const char *)filename);
pkt += strlen((char *)filename) + 1;
strcpy((char *)pkt, (const char *)TRANS_BINARY);
pkt += strlen((char *)TRANS_BINARY) + 1;
#ifdef OPTION_ENABLE
for(i = 0 ; i < 1 ; i++) {
strcpy((char *)pkt, (const char *)opt[i].code);
pkt += strlen((char *)opt[i].code) + 1;
strcpy((char *)pkt, (const char *)opt[i].value);
pkt += strlen((char *)opt[i].value) + 1;
}
#endif
len = pkt - tmp_buffer;
sendto(Socket, tmp_buffer, len, server_ip, TFTP_SERVER_PORT);
last_pack = 0;
offset_len =0;
remainLenth = setlen;
pos=0;
flgst =0;
while(1)
{
/* Receive Packet Process */
cnt++;
len = recv_udp_packet(Socket, tmp_buffer, MAX_MTU_SIZE, from_ip, &from_port);
if(len < 1)
{
if(flgst==0)
{
flgst=1;
last_tick =mde_stc_GetTick();
}
cur_tick = mde_stc_GetTick();
det_tick=cur_tick >= last_tick ? (cur_tick - last_tick): (Sysms_time_MAX + cur_tick - last_tick);
if(det_tick>3000)
{
ptty->printf("recv_udp_packet timeout\r\n");
goto err;
}
}
else//Normal
{
last_tick =mde_stc_GetTick(); //time tick
if(ip_addr_comp(server_ip,from_ip)) /* Verify Server IP */
{
ptty->printf("Server IP faults\r\n");
goto err;
}
opcode =(uint16_t )tmp_buffer[0]<<8;
opcode|=tmp_buffer[1];
switch(opcode)
{
case TFTP_ACK :
current_pack =(uint16_t )tmp_buffer[2]<<8;
current_pack|=tmp_buffer[3];
if (last_pack != current_pack)
{
ptty->printf("\ntftp: update packet err! current_ack_pack=%d last_send_pack=%d remainLenth=%d \n",
last_pack, last_pack, remainLenth);
goto err;
}
/* make ACK */
tmp_buffer[0] = 0;
tmp_buffer[1] = TFTP_DATA; /* opcode */
last_pack++;
tmp_buffer[2] =(uint16_t)last_pack>>8;
tmp_buffer[3] =last_pack&0xff;
len =0;
if (remainLenth == 0)
{
goto ok;
}
if (remainLenth > 512)
{
for(i=0;i<128;i++)//數據填充512/4=128
{
data_temp = mem[pos];
tmp_buffer[4+(i*4)] = ((uint32_t)data_temp>>24)&0xff;
tmp_buffer[5+(i*4)] = ((uint32_t)data_temp>>16)&0xff;
tmp_buffer[6+(i*4)] = ((uint32_t)data_temp>>8)&0xff;
tmp_buffer[7+(i*4)] = (uint32_t)data_temp&0xff;
pos+=2;
}
len = 512 + 4;
}
else
{
half_num =remainLenth/2;
for(i=0;i<half_num;i++)//數據填充
{
data_temp = mem[pos];
tmp_buffer[4+(i*4)] = ((uint32_t)data_temp>>24)&0xff;
tmp_buffer[5+(i*4)] = ((uint32_t)data_temp>>16)&0xff;
tmp_buffer[6+(i*4)] = ((uint32_t)data_temp>>8)&0xff;
tmp_buffer[7+(i*4)] = (uint32_t)data_temp&0xff;
pos+=2;
}
if((half_num*2)<remainLenth)
{
data_temp = mem[pos];
tmp_buffer[8+(i*4)] = ((uint32_t)data_temp>>24)&0xff;
tmp_buffer[9+(i*4)] = ((uint32_t)data_temp>>16)&0xff;
tmp_buffer[10+(i*4)] = ((uint32_t)data_temp>>8)&0xff;
}
len = remainLenth + 4;
}
sendto(Socket, tmp_buffer, len, from_ip, from_port);
if (cnt % 50 == 0)
{
ptty->printf("*");
}
remainLenth -= (remainLenth > 512 ? 512 : remainLenth);
if (remainLenth == 0)
{
goto ok;
}
break;
case TFTP_ERROR:
current_pack =(uint16_t )tmp_buffer[2]<<8;
current_pack|=tmp_buffer[3];
if(current_pack>7) current_pack=0;
ptty->printf("err: %s\n", error_string[current_pack]);
goto err;
default:
ptty->printf("unknow error! \n");
goto err;
}
}
}
ok: ptty->printf("\ndone \n");
close(Socket);
return 1;
err:
close(Socket);
return 0;
}
////////////end file/////////////////
/**
* @file tftp.h
* @brief TFTP Header File.
* @version 0.1.0
* @author Sang-sik Kim
*/
#ifndef __TFTP_H__
#define __TFTP_H__
#include <stdint.h>
#include "utility.h"
#include "w5500.h"
#include "socket.h"
#include "w5500_conf.h"
#include <string.h>
#include "tty.h"
/* tftp message */
#define TFTP_RRQ 1
#define TFTP_WRQ 2
#define TFTP_DATA 3
#define TFTP_ACK 4
#define TFTP_ERROR 5
#define TFTP_OACK 6
/* tftp state */
#define STATE_NONE 0
#define STATE_RRQ 1
#define STATE_WRQ 2
#define STATE_DATA 3
#define STATE_ACK 4
#define STATE_OACK 5
/* tftp transfer mode */
#define TRANS_ASCII "netascii"
#define TRANS_BINARY "octet"
/* tftp progress state */
#define TFTP_PROGRESS 0
#define TFTP_FAIL 1
#define TFTP_SUCCESS 2
/* define */
#define TFTP_SERVER_PORT 69
#define TFTP_TEMP_PORT 51000
#define TFTP_BLK_SIZE 512
#define MAX_MTU_SIZE 1514
#define FILE_NAME_SIZE 20
//#define __TFTP_DEBUG__
/* typedef */
typedef struct tftp_data
{
uint8_t opcode[2];
uint8_t block_num[2];
uint8_t data[1024];
} TFTP_DATA_T;
typedef struct tftp_error
{
uint8_t opcode[2];
uint8_t error_code[2];
uint8_t error_msg[1024];
} TFTP_ERROR_T;
typedef struct tftp_option
{
uint8_t *code;
uint8_t *value;
} TFTP_OPTION;
extern int tftp_get(struct tty *ptty ,char *filename,uint32_t *getbuf,uint32_t *getlen,uint32_t getmax);
extern int tftp_send(struct tty *ptty , uint32_t *mem , char *filename , unsigned long setlen);
#endif /*__TFTP_H__ */
以上爲tftp協議部分 ,配合pc端軟件 tftpd32 即可快速文件傳輸,因DSP flash擦除和編程時不能訪問flash,內部SRAM容量有限,這裏我將接收的app.bin文件數據放入外部SDRAM,下一步將SDRAM數據copy到內部flash即可,(因uboot佔用bank0 ,所以只能將bnak1作爲app使用)以下爲編程flash代碼:
#define DRV_ECCFLASH_GOLBAL_
#include "Types.h"
#include "drv.h"
#include "drv_eccflash.h"
#include "app.h"
#include "f021.h"
#include "Constants.h "
#include "F021_F2837xS_C28x.h"
#include "F28x_Project.h"
#pragma CODE_SECTION(eccflash_write_16bit, ".TI.ramfunc");//該函數必須在SRAM中執行
// return 1:fail ,0:ok
int eccflash_write_16bit(uint16_t *dat ,uint32_t len)
{
volatile unsigned long u32Index = 0;
volatile unsigned long i = 0;
Fapi_StatusType oReturnCheck;
volatile Fapi_FlashStatusType oFlashStatus;
uint32_t Get_sector[14]= //BANK 1
{
BOne_SectorO_start,
BOne_SectorP_start,
BOne_SectorQ_start,
BOne_SectorR_start,
BOne_SectorS_start,
BOne_SectorT_start,
BOne_SectorU_start,
BOne_SectorV_start,
BOne_SectorW_start,
BOne_SectorX_start,
BOne_SectorY_start,
BOne_SectorZ_start,
BOne_SectorAA_start,
BOne_SectorAB_start,
};
//step 1
EALLOW;// Bank0 Erase Program
PUMPREQUEST = 0x5A5A0001; // Give pump ownership to FMC1
oReturnCheck = Fapi_initializeAPI(F021_CPU0_W1_BASE_ADDRESS, 150); //設置flash 狀態機 ,設置頻率150MHz
if(oReturnCheck != Fapi_Status_Success)goto end_prg;
//step 2
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank1);
if(oReturnCheck != Fapi_Status_Success)goto end_prg;
//step 3
for(i=0;i<14;i++) // 擦除bank1 14個扇區
{
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,(uint32 *)Get_sector[i]);// Erase Sector x
while(Fapi_checkFsmForReady() != Fapi_Status_FsmReady){}// Wait until FSM is done with erase sector operation
}
//step 4
for(i=0, u32Index = BOne_SectorO_start;(u32Index < (BOne_SectorO_start + len))&&(oReturnCheck == Fapi_Status_Success);)// 連續寫入flash 扇區
{
oReturnCheck = Fapi_issueProgrammingCommand((uint32 *)u32Index,&dat[i],8,0,0,Fapi_AutoEccGeneration);
while(Fapi_checkFsmForReady() == Fapi_Status_FsmBusy);
if(oReturnCheck != Fapi_Status_Success) goto end_prg;
oFlashStatus = Fapi_getFsmStatus();
i+= 8; u32Index+= 8;
}
//step 5
oReturnCheck = Fapi_issueAsyncCommand(Fapi_ClearMore);
while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady){}// Wait until the Flash program operation is over
end_prg:
PUMPREQUEST = 0x5A5A0000;// Give pump ownership back to FMC0
EDIS;
return oReturnCheck;
}
#ifndef SOURCE_DRIVER_DRV_ECCFLASH_H_
#define SOURCE_DRIVER_DRV_ECCFLASH_H_
#ifndef DRV_ECCFLASH_GOLBAL_
#define DRV_ECCFLASH_EXT
#else
#define DRV_ECCFLASH_EXT extern
#endif
#define PUMPREQUEST *(unsigned long*)(0x00050024)
#define BOne_SectorAB_start 0xFE000
#define BOne_SectorAB_End 0xFFFFF//1FFF
#define BOne_SectorAA_start 0xFC000
#define BOne_SectorAA_End 0xFDFFF//1FFF
#define BOne_SectorZ_start 0xFA000
#define BOne_SectorZ_End 0xFBFFF//1FFF
#define BOne_SectorY_start 0xF8000
#define BOne_SectorY_End 0xF9FFF//1FFF
#define BOne_SectorX_start 0xF0000
#define BOne_SectorX_End 0xF7FFF//7FFF
#define BOne_SectorW_start 0xE8000
#define BOne_SectorW_End 0xEFFFF//7FFF
#define BOne_SectorV_start 0xE0000
#define BOne_SectorV_End 0xE7FFF//7FFF ??
#define BOne_SectorU_start 0xD8000
#define BOne_SectorU_End 0xDFFFF//7FFF
#define BOne_SectorT_start 0xD0000
#define BOne_SectorT_End 0xD7FFF//7FFF ??
#define BOne_SectorS_start 0xC8000
#define BOne_SectorS_End 0xCFFFF//7FFF
#define BOne_SectorR_start 0xC6000
#define BOne_SectorR_End 0xC7FFF//1FFF
#define BOne_SectorQ_start 0xC4000
#define BOne_SectorQ_End 0xC5FFF//1FFF
#define BOne_SectorP_start 0xC2000
#define BOne_SectorP_End 0xC3FFF//1FFF
#define BOne_SectorO_start 0xC0000 //8KiB
#define BOne_SectorO_End 0xC1FFF//1FFF
// bank 1 =0x40000 =256KiB
#define Bzero_SectorN_start 0xBE000
#define Bzero_SectorN_End 0xBFFFF//1FFF
#define Bzero_SectorM_start 0xBC000
#define Bzero_SectorM_End 0xBDFFF//1FFF
#define Bzero_SectorL_start 0xBA000
#define Bzero_SectorL_End 0xBBFFF//1FFF
#define Bzero_SectorK_start 0xB8000
#define Bzero_SectorK_End 0xB9FFF//1FFF
#define Bzero_SectorJ_start 0xB0000
#define Bzero_SectorJ_End 0xB7FFF//7FFF
#define Bzero_SectorI_start 0xA8000
#define Bzero_SectorI_End 0xAFFFF//7FFF
#define Bzero_SectorH_start 0xA0000
#define Bzero_SectorH_End 0xA7FFF//7FFF
#define Bzero_SectorG_start 0x98000
#define Bzero_SectorG_End 0x9FFFF//7FFF
#define Bzero_SectorF_start 0x90000
#define Bzero_SectorF_End 0x97FFF//7FFF
#define Bzero_SectorE_start 0x88000
#define Bzero_SectorE_End 0x8FFFF//7FFF
#define Bzero_SectorD_start 0x86000
#define Bzero_SectorD_End 0x87FFF//1FFF
#define Bzero_SectorC_start 0x84000
#define Bzero_SectorC_End 0x85FFF//1FFF
#define Bzero_SectorB_start 0x82000
#define Bzero_SectorB_End 0x83FFF//1FFF
#define Bzero_SectorA_start 0x80000
#define Bzero_SectorA_End 0x81FFF //1FFF
#define Bzero_16KSector_u32length 0x1000
#define Bzero_64KSector_u32length 0x4000
#define BOne_16KSector_u32length 0x1000
#define BOne_64KSector_u32length 0x4000
extern int eccflash_write_16bit(uint16_t *dat ,uint32_t len);
#endif /* SOURCE_DRIVER_DRV_ECCFLASH_H_ */
需要注意的是,flash API 操作部分“F021_API_F2837xS_FPU32.lib” 也需要放入SRAM中,以下是我修改的Uboot cmd:
MEMORY
{
PAGE 0 : /* Program Memory */
/* Memory (RAM/FLASH) blocks can be moved to PAGE1 for data allocation */
/* BEGIN is used for the "boot to Flash" bootloader mode */
BEGIN : origin = 0x080000, length = 0x000002
RAMD0 : origin = 0x00B000, length = 0x000800
RAMLS0123 : origin = 0x008000, length = 0x002000
RAMLS4 : origin = 0x00A000, length = 0x000800
RESET : origin = 0x3FFFC0, length = 0x000002
/* Flash sectors */
FLASHA : origin = 0x080002, length = 0x001FFE /* on-chip Flash */
FLASHB : origin = 0x082000, length = 0x002000 /* on-chip Flash */
FLASHC : origin = 0x084000, length = 0x002000 /* on-chip Flash */
FLASHD : origin = 0x086000, length = 0x002000 /* on-chip Flash */
FLASHE : origin = 0x088000, length = 0x008000 /* on-chip Flash */
FLASHF : origin = 0x090000, length = 0x008000 /* on-chip Flash */
FLASHG : origin = 0x098000, length = 0x008000 /* on-chip Flash */
FLASHH : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
FLASHI : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
FLASHJ : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
FLASHK : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
FLASHL : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
FLASHM : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
FLASHN : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
PAGE 1 : /* Data Memory */
/* Memory (RAM/FLASH) blocks can be moved to PAGE0 for program allocation */
BOOT_RSVD : origin = 0x000002, length = 0x000120 /* Part of M0, BOOT rom will use this for stack */
RAMM01 : origin = 0x000122, length = 0x0006DE
RAMD1 : origin = 0x00B800, length = 0x000800
RAMLS5 : origin = 0x00A800, length = 0x000800
RAMGS0 : origin = 0x00C000, length = 0x001000
RAMGS1 : origin = 0x00D000, length = 0x001000
RAMGS2 : origin = 0x00E000, length = 0x001000
RAMGS3 : origin = 0x00F000, length = 0x001000
RAMGS4 : origin = 0x010000, length = 0x001000
RAMGS5 : origin = 0x011000, length = 0x001000
RAMGS6to10 : origin = 0x012000, length = 0x005000
RAMGS11 : origin = 0x017000, length = 0x001000
}
SECTIONS
{
/* Allocate program areas: */
.cinit : > FLASHA PAGE = 0, ALIGN(4)
.pinit : > FLASHA, PAGE = 0, ALIGN(4)
.text : >> FLASHA|FLASHB | FLASHC | FLASHD | FLASHE|FLASHF PAGE = 0, ALIGN(4)
codestart : > BEGIN PAGE = 0, ALIGN(4)
/* Allocate uninitalized data sections: */
.stack : > RAMM01 PAGE = 1
.ebss : >> RAMLS5 | RAMGS0 | RAMGS1 | RAMGS2|RAMGS3|RAMGS4|RAMGS5|RAMGS6to10| RAMGS11 PAGE = 1
.esysmem : > RAMLS5 PAGE = 1
/* Initalized sections go in Flash */
.econst : >> FLASHG | FLASHH | FLASHI PAGE = 0, ALIGN(4)
.switch : > FLASHJ PAGE = 0, ALIGN(4)
.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
GROUP
{
.TI.ramfunc
{-l F021_API_F2837xS_FPU32.lib} //注意:該庫文件 SRAM 中
} LOAD = FLASHK ,
RUN = RAMLS0123 ,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0, ALIGN(4)
#else
ramfuncs : LOAD = FLASHK,
RUN = RAMLS0123,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0, ALIGN(4)
#endif
#endif
ramgnet : > RAMGS6to10, PAGE = 1
.cio : >> RAMGS2, PAGE = 1
/* The following section definitions are for SDFM examples */
Filter1_RegsFile : > RAMGS1, PAGE = 1, fill=0x1111
Filter2_RegsFile : > RAMGS2, PAGE = 1, fill=0x2222
Filter3_RegsFile : > RAMGS3, PAGE = 1, fill=0x3333
Filter4_RegsFile : > RAMGS4, PAGE = 1, fill=0x4444
Difference_RegsFile : >RAMGS5, PAGE = 1, fill=0x3333
}
/*
//===========================================================================
// End of file.
//===========================================================================
*/
希望對大家有用 ,enjoy it!