Refs #305. Added TCP/IP support to the XMC4700 Relax Kit demo programs.

git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@618 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
Frank Voorburg 2018-08-20 11:43:38 +00:00
parent fa3900d833
commit c72fff6279
97 changed files with 17419 additions and 9156 deletions

View File

@ -1,9 +1,7 @@
<!DOCTYPE CrossStudio_Session_File>
<session>
<Bookmarks/>
<Breakpoints>
<Exceptions set="MemManage;UsageFault_Coprocessor;UsageFault_CheckingError;UsageFault_StateError;BusFault;ExceptionEntryReturnFault;HardFault" />
</Breakpoints>
<Breakpoints/>
<ExecutionProfileWindow/>
<FrameBufferWindow>
<FrameBufferWindow addressText="" bufferWidth="-1" bufferHeight="-1" addressSpace="" />
@ -70,7 +68,7 @@
<Watches active="0" update="Never" />
</Watch4>
<Files>
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="26" debugPath="../main.c" y="33" path="../main.c" left="0" selected="1" name="unnamed" top="24" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="../main.c" y="33" path="../main.c" left="0" selected="1" name="unnamed" top="26" />
</Files>
<ARMCrossStudioWindow activeProject="openblt_ek_lm3s6965" autoConnectTarget="Luminary USB Debug" debugSearchFileMap="" fileDialogInitialDirectory="C:/Work/software/OpenBLT_DHCP_Support/Target/Source/third_party/uip/apps/dhcpc" fileDialogDefaultFilter="" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Debug" />
<ARMCrossStudioWindow activeProject="openblt_ek_lm3s6965" autoConnectTarget="Luminary USB Debug" debugSearchFileMap="" fileDialogInitialDirectory="C:/Work/software/OpenBLT_DHCP_Support/Target/Source/third_party/uip/apps/dhcpc" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Debug" />
</session>

View File

@ -75,7 +75,6 @@ void netdev_init(void)
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
unsigned long ulUser0, ulUser1;
blt_int32u ulTemp;
blt_int32u ulLinkTimeOut;
@ -119,6 +118,8 @@ void netdev_init_mac(void)
{
break;
}
/* Service the watchdog. */
CopService();
}
/* set the default MAC address */

View File

@ -75,7 +75,6 @@ void netdev_init(void)
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
unsigned long ulUser0, ulUser1;
unsigned long ulTemp;
unsigned long ulLinkTimeOut;

View File

@ -7,8 +7,8 @@ start address 0x00000000
Program Header:
LOAD off 0x00010000 vaddr 0x00000000 paddr 0x00000000 align 2**16
filesz 0x000079cc memsz 0x000079cc flags r-x
LOAD off 0x00020040 vaddr 0x20000040 paddr 0x000079cc align 2**16
filesz 0x000079d0 memsz 0x000079d0 flags r-x
LOAD off 0x00020040 vaddr 0x20000040 paddr 0x000079d0 align 2**16
filesz 0x000001dc memsz 0x00002120 flags rw-
LOAD off 0x00030000 vaddr 0x20000000 paddr 0x20000000 align 2**16
filesz 0x00000000 memsz 0x00000040 flags rw-
@ -18,33 +18,33 @@ Sections:
Idx Name Size VMA LMA File off Algn
0 .shared 00000040 20000000 20000000 00030000 2**2
ALLOC
1 .text 000079cc 00000000 00000000 00010000 2**2
1 .text 000079d0 00000000 00000000 00010000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .data 000001dc 20000040 000079cc 00020040 2**2
2 .data 000001dc 20000040 000079d0 00020040 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00001f44 2000021c 00007ba8 0002021c 2**2
3 .bss 00001f44 2000021c 00007bac 0002021c 2**2
ALLOC
4 .ARM.attributes 00000029 00000000 00000000 0002021c 2**0
CONTENTS, READONLY
5 .comment 0000006e 00000000 00000000 00020245 2**0
CONTENTS, READONLY
6 .debug_info 00011169 00000000 00000000 000202b3 2**0
6 .debug_info 0001117d 00000000 00000000 000202b3 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_abbrev 00002b8d 00000000 00000000 0003141c 2**0
7 .debug_abbrev 00002b8d 00000000 00000000 00031430 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_loc 0000c330 00000000 00000000 00033fa9 2**0
8 .debug_loc 0000c330 00000000 00000000 00033fbd 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_aranges 00001100 00000000 00000000 000402d9 2**0
9 .debug_aranges 00001100 00000000 00000000 000402ed 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 00000ee0 00000000 00000000 000413d9 2**0
10 .debug_ranges 00000ee0 00000000 00000000 000413ed 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_macro 0000a351 00000000 00000000 000422b9 2**0
11 .debug_macro 0000a351 00000000 00000000 000422cd 2**0
CONTENTS, READONLY, DEBUGGING
12 .debug_line 00008415 00000000 00000000 0004c60a 2**0
12 .debug_line 00008416 00000000 00000000 0004c61e 2**0
CONTENTS, READONLY, DEBUGGING
13 .debug_str 0002b14d 00000000 00000000 00054a1f 2**0
13 .debug_str 0002b165 00000000 00000000 00054a34 2**0
CONTENTS, READONLY, DEBUGGING
14 .debug_frame 00003004 00000000 00000000 0007fb6c 2**2
14 .debug_frame 00003004 00000000 00000000 0007fb9c 2**2
CONTENTS, READONLY, DEBUGGING
SYMBOL TABLE:
20000000 l d .shared 00000000 .shared
@ -64,7 +64,7 @@ SYMBOL TABLE:
00000000 l d .debug_frame 00000000 .debug_frame
00000000 l df *ABS* 00000000 vectors.c
00000000 l df *ABS* 00000000 crtstuff.c
000079c8 l O .text 00000000 __EH_FRAME_BEGIN__
000079cc l O .text 00000000 __EH_FRAME_BEGIN__
000000f0 l F .text 00000000 __do_global_dtors_aux
2000021c l .bss 00000000 completed.8603
20000218 l O .data 00000000 __do_global_dtors_aux_fini_array_entry
@ -81,47 +81,47 @@ SYMBOL TABLE:
00000000 l df *ABS* 00000000 flashlib.c
00000000 l df *ABS* 00000000 sysctl.c
00000cd0 l F .text 000003f8 SysCtlPeripheralValid
000070c0 l O .text 0000006c g_pulXtals
00007144 l O .text 0000000c g_pulRCGCRegs
00007150 l O .text 0000000c g_pulSRCRRegs
000070c4 l O .text 0000006c g_pulXtals
00007148 l O .text 0000000c g_pulRCGCRegs
00007154 l O .text 0000000c g_pulSRCRRegs
00000000 l df *ABS* 00000000 ssi.c
00001560 l F .text 00000038 SSIBaseValid
00000000 l df *ABS* 00000000 clock-arch.c
00000000 l df *ABS* 00000000 netdev.c
00000000 l df *ABS* 00000000 mmc.c
000018b8 l F .text 00000010 power_off
000018c8 l F .text 00000058 send_initial_clock_train
00001920 l F .text 0000008c power_on
000019ac l F .text 00000024 xchg_spi
000019d0 l F .text 00000028 wait_ready
000019f8 l F .text 00000018 deselect
00001a10 l F .text 0000002c select
00001a3c l F .text 00000082 send_cmd
00001ac0 l F .text 0000000e rcvr_spi_m
00001ad0 l F .text 0000004e rcvr_datablock
00001b20 l F .text 0000005a xmit_datablock
00001b7c l F .text 00000044 set_max_speed
000018bc l F .text 00000010 power_off
000018cc l F .text 00000058 send_initial_clock_train
00001924 l F .text 0000008c power_on
000019b0 l F .text 00000024 xchg_spi
000019d4 l F .text 00000028 wait_ready
000019fc l F .text 00000018 deselect
00001a14 l F .text 0000002c select
00001a40 l F .text 00000082 send_cmd
00001ac4 l F .text 0000000e rcvr_spi_m
00001ad4 l F .text 0000004e rcvr_datablock
00001b24 l F .text 0000005a xmit_datablock
00001b80 l F .text 00000044 set_max_speed
20000238 l O .bss 00000004 CardType
20000040 l O .data 00000001 Stat
00000000 l df *ABS* 00000000 cstart.c
000020fe l F .text 00000000 zero_loop
00002102 l F .text 00000000 zero_loop
00000000 l df *ABS* 00000000 hooks.c
00007170 l O .text 0000001b firmwareFilename
00007174 l O .text 0000001b firmwareFilename
2000023c l O .bss 0000022c logfile
00000000 l df *ABS* 00000000 main.c
00002250 l F .text 00000048 Init
00002254 l F .text 00000048 Init
00000000 l df *ABS* 00000000 shared_params.c
000022dc l F .text 00000038 SharedParamsCalculateChecksum
00002314 l F .text 0000001c SharedParamsVerifyChecksum
00002330 l F .text 00000024 SharedParamsValidateBuffer
00002354 l F .text 00000010 SharedParamsWriteChecksum
000022e0 l F .text 00000038 SharedParamsCalculateChecksum
00002318 l F .text 0000001c SharedParamsVerifyChecksum
00002334 l F .text 00000024 SharedParamsValidateBuffer
00002358 l F .text 00000010 SharedParamsWriteChecksum
20000000 l O .shared 00000040 sharedParamsBuffer
00000000 l df *ABS* 00000000 assert.c
00000000 l df *ABS* 00000000 file.c
000023cc l F .text 0000003c FileLibLongToIntString
00002408 l F .text 0000002a FileLibByteNibbleToChar
00002434 l F .text 00000020 FileLibByteToHexString
00002454 l F .text 00000058 FileLibHexStringToByte
000023d0 l F .text 0000003c FileLibLongToIntString
0000240c l F .text 0000002a FileLibByteNibbleToChar
00002438 l F .text 00000020 FileLibByteToHexString
00002458 l F .text 00000058 FileLibHexStringToByte
20000468 l O .bss 00000040 loggingStr
200004a8 l O .bss 00000001 firmwareUpdateState
200004ac l O .bss 00000008 eraseInfo
@ -137,143 +137,143 @@ SYMBOL TABLE:
20000041 l O .data 00000001 comActiveInterface
20000a9c l O .bss 00000040 xcpCtoReqPacket.4531
00000000 l df *ABS* 00000000 net.c
00002cc4 l F .text 0000010c NetServerTask
00002cc8 l F .text 0000010c NetServerTask
20000adc l O .bss 00000001 netInitializedFlag
20000ae0 l O .bss 00000004 ARPTimerTimeOut
20000ae4 l O .bss 00000006 macAddress
20000042 l O .data 00000001 netInitializationDeferred
20000aec l O .bss 00000004 periodicTimerTimeOut
00000000 l df *ABS* 00000000 xcp.c
00002f64 l F .text 0000000c XcpProtectResources
00002f70 l F .text 00000014 XcpSetCtoError
00002f84 l F .text 0000001c XcpCmdDisconnect
00002fa0 l F .text 00000020 XcpCmdGetStatus
00002fc0 l F .text 0000000a XcpCmdSynch
00002fcc l F .text 0000002c XcpCmdGetId
00002ff8 l F .text 00000018 XcpCmdSetMta
00003010 l F .text 0000000a XcpCmdProgramPrepare
0000301c l F .text 00000028 XcpCmdProgramStart
00003044 l F .text 00000050 XcpCmdConnect
00003094 l F .text 00000040 XcpCmdUpload
000030d4 l F .text 00000040 XcpCmdShortUpload
00003114 l F .text 00000024 XcpComputeChecksum
00003138 l F .text 00000028 XcpCmdBuildCheckSum
00003160 l F .text 00000040 XcpCmdProgramMax
000031a0 l F .text 0000005c XcpCmdProgram
000031fc l F .text 00000028 XcpCmdProgramClear
00003224 l F .text 00000018 XcpCmdProgramReset
0000323c l F .text 0000000a XcpTransmitPacket
0000736c l O .text 00000008 xcpStationId
00002f68 l F .text 0000000c XcpProtectResources
00002f74 l F .text 00000014 XcpSetCtoError
00002f88 l F .text 0000001c XcpCmdDisconnect
00002fa4 l F .text 00000020 XcpCmdGetStatus
00002fc4 l F .text 0000000a XcpCmdSynch
00002fd0 l F .text 0000002c XcpCmdGetId
00002ffc l F .text 00000018 XcpCmdSetMta
00003014 l F .text 0000000a XcpCmdProgramPrepare
00003020 l F .text 00000028 XcpCmdProgramStart
00003048 l F .text 00000050 XcpCmdConnect
00003098 l F .text 00000040 XcpCmdUpload
000030d8 l F .text 00000040 XcpCmdShortUpload
00003118 l F .text 00000024 XcpComputeChecksum
0000313c l F .text 00000028 XcpCmdBuildCheckSum
00003164 l F .text 00000040 XcpCmdProgramMax
000031a4 l F .text 0000005c XcpCmdProgram
00003200 l F .text 00000028 XcpCmdProgramClear
00003228 l F .text 00000018 XcpCmdProgramReset
00003240 l F .text 0000000a XcpTransmitPacket
00007370 l O .text 00000008 xcpStationId
20000af0 l O .bss 0000004c xcpInfo
00000000 l df *ABS* 00000000 timer.c
20000b3c l O .bss 00000004 millisecond_counter
00000000 l df *ABS* 00000000 flash.c
000033c0 l F .text 00000048 FlashGetSector
00003408 l F .text 00000038 FlashGetSectorBaseAddr
00003440 l F .text 00000038 FlashGetSectorSize
00003478 l F .text 00000026 FlashInitBlock
000034a0 l F .text 0000005c FlashWriteBlock
000034fc l F .text 0000003c FlashSwitchBlock
00003538 l F .text 0000007a FlashAddToBlock
000035b4 l F .text 0000005e FlashEraseSectors
00007374 l O .text 000000c0 flashLayout
000033c4 l F .text 00000048 FlashGetSector
0000340c l F .text 00000038 FlashGetSectorBaseAddr
00003444 l F .text 00000038 FlashGetSectorSize
0000347c l F .text 00000026 FlashInitBlock
000034a4 l F .text 0000005c FlashWriteBlock
00003500 l F .text 0000003c FlashSwitchBlock
0000353c l F .text 0000007a FlashAddToBlock
000035b8 l F .text 0000005e FlashEraseSectors
00007378 l O .text 000000c0 flashLayout
20000b40 l O .bss 00000204 bootBlockInfo
20000d44 l O .bss 00000204 blockInfo
00000000 l df *ABS* 00000000 cpu.c
00000000 l df *ABS* 00000000 nvm.c
00000000 l df *ABS* 00000000 uart.c
0000385c l F .text 0000003c UartTransmitByte
00003898 l F .text 00000020 UartReceiveByte
00003860 l F .text 0000003c UartTransmitByte
0000389c l F .text 00000020 UartReceiveByte
20000f48 l O .bss 00000004 xcpCtoRxStartTime.4748
20000f4c l O .bss 00000041 xcpCtoReqPacket.4745
20000f8d l O .bss 00000001 xcpCtoRxLength.4746
20000f8e l O .bss 00000001 xcpCtoRxInProgress.4747
00000000 l df *ABS* 00000000 cpu_comp.c
00000000 l df *ABS* 00000000 ff.c
000039dc l F .text 0000000a ld_word
000039e8 l F .text 00000016 ld_dword
00003a00 l F .text 00000008 st_word
00003a08 l F .text 00000014 st_dword
00003a1c l F .text 00000012 mem_cpy
00003a30 l F .text 0000000a mem_set
00003a3c l F .text 0000001e mem_cmp
00003a5c l F .text 00000010 chk_chr
00003a6c l F .text 00000018 clust2sect
00003a84 l F .text 00000024 ld_clust
00003aa8 l F .text 00000024 st_clust
00003acc l F .text 0000008c pick_lfn
00003b58 l F .text 00000070 put_lfn
00003bc8 l F .text 000000a0 gen_numname
00003c68 l F .text 0000001c sum_sfn
00003c84 l F .text 00000052 get_ldnumber
00003cd8 l F .text 00000034 validate
00003d0c l F .text 00000054 sync_window
00003d60 l F .text 00000034 move_window
00003d94 l F .text 00000060 check_fs
00003df4 l F .text 000002d4 find_volume
000040c8 l F .text 000000d0 get_fat
00004198 l F .text 000000b2 dir_sdi
0000424c l F .text 0000010c put_fat
00004358 l F .text 000000ce create_chain
00004428 l F .text 0000007c remove_chain
000044a4 l F .text 00000126 dir_next
000045cc l F .text 0000004c dir_alloc
00004618 l F .text 000000c4 dir_read
000046dc l F .text 00000050 dir_remove
0000472c l F .text 00000228 create_name
00004954 l F .text 000000e2 get_fileinfo
00004a38 l F .text 000000ac cmp_lfn
00004ae4 l F .text 000000e8 dir_find
00004bcc l F .text 0000008c follow_path
00004c58 l F .text 0000013c dir_register
00004d94 l F .text 0000008c sync_fs
00005300 l F .text 0000004a putc_bfd
000039e0 l F .text 0000000a ld_word
000039ec l F .text 00000016 ld_dword
00003a04 l F .text 00000008 st_word
00003a0c l F .text 00000014 st_dword
00003a20 l F .text 00000012 mem_cpy
00003a34 l F .text 0000000a mem_set
00003a40 l F .text 0000001e mem_cmp
00003a60 l F .text 00000010 chk_chr
00003a70 l F .text 00000018 clust2sect
00003a88 l F .text 00000024 ld_clust
00003aac l F .text 00000024 st_clust
00003ad0 l F .text 0000008c pick_lfn
00003b5c l F .text 00000070 put_lfn
00003bcc l F .text 000000a0 gen_numname
00003c6c l F .text 0000001c sum_sfn
00003c88 l F .text 00000052 get_ldnumber
00003cdc l F .text 00000034 validate
00003d10 l F .text 00000054 sync_window
00003d64 l F .text 00000034 move_window
00003d98 l F .text 00000060 check_fs
00003df8 l F .text 000002d4 find_volume
000040cc l F .text 000000d0 get_fat
0000419c l F .text 000000b2 dir_sdi
00004250 l F .text 0000010c put_fat
0000435c l F .text 000000ce create_chain
0000442c l F .text 0000007c remove_chain
000044a8 l F .text 00000126 dir_next
000045d0 l F .text 0000004c dir_alloc
0000461c l F .text 000000c4 dir_read
000046e0 l F .text 00000050 dir_remove
00004730 l F .text 00000228 create_name
00004958 l F .text 000000e2 get_fileinfo
00004a3c l F .text 000000ac cmp_lfn
00004ae8 l F .text 000000e8 dir_find
00004bd0 l F .text 0000008c follow_path
00004c5c l F .text 0000013c dir_register
00004d98 l F .text 0000008c sync_fs
00005304 l F .text 0000004a putc_bfd
20000f90 l O .bss 00000200 LfnBuf
20001190 l O .bss 00000002 Fsid
0000746c l O .text 00000080 ExCvt
000074ec l O .text 0000000d LfnOfs
00007470 l O .text 00000080 ExCvt
000074f0 l O .text 0000000d LfnOfs
20001194 l O .bss 00000004 FatFs
00000000 l df *ABS* 00000000 unicode.c
000074fc l O .text 000000bc cvt2.4380
000075b8 l O .text 00000100 Tbl
000076b8 l O .text 000001f2 cvt1.4379
00007500 l O .text 000000bc cvt2.4380
000075bc l O .text 00000100 Tbl
000076bc l O .text 000001f2 cvt1.4379
00000000 l df *ABS* 00000000 uip.c
000057f0 l F .text 0000003a chksum
00005888 l F .text 00000030 uip_add_rcv_nxt
00005998 l F .text 0000003c upper_layer_chksum
000057f4 l F .text 0000003a chksum
0000588c l F .text 00000030 uip_add_rcv_nxt
0000599c l F .text 0000003c upper_layer_chksum
20001198 l O .bss 00000002 tmp16
2000119a l O .bss 00000002 ipid
2000119c l O .bss 00000004 iss
200011a0 l O .bss 00000002 lastport
200011a2 l O .bss 00000001 c
00000000 l df *ABS* 00000000 uip_arp.c
0000669c l F .text 00000108 uip_arp_update
000066a0 l F .text 00000108 uip_arp_update
200011aa l O .bss 00000001 i
200011ab l O .bss 00000001 tmpage
200011ac l O .bss 00000060 arp_table
000078ac l O .text 00000006 broadcast_ethaddr
000078b0 l O .text 00000006 broadcast_ethaddr
2000120c l O .bss 00000001 c
2000120d l O .bss 00000001 arptime
20001210 l O .bss 00000004 ipaddr
00000000 l df *ABS* 00000000 uip_timer.c
00000000 l df *ABS* 00000000 dhcpc.c
00006a6c l F .text 0000000e add_msg_type
00006a7c l F .text 0000001c add_server_id
00006a98 l F .text 00000016 add_req_options
00006ab0 l F .text 00000008 add_end
00006ab8 l F .text 0000002c dhcpc_configured
00006ae4 l F .text 0000001c add_req_ipaddr
00006b00 l F .text 00000078 parse_options
00006b78 l F .text 00000080 create_msg
00006bf8 l F .text 00000030 send_discover
00006c28 l F .text 00000034 send_request
00006c5c l F .text 00000058 parse_msg
00006d00 l F .text 00000288 handle_dhcp
000078b4 l O .text 00000004 xid
00006a70 l F .text 0000000e add_msg_type
00006a80 l F .text 0000001c add_server_id
00006a9c l F .text 00000016 add_req_options
00006ab4 l F .text 00000008 add_end
00006abc l F .text 0000002c dhcpc_configured
00006ae8 l F .text 0000001c add_req_ipaddr
00006b04 l F .text 00000078 parse_options
00006b7c l F .text 00000080 create_msg
00006bfc l F .text 00000030 send_discover
00006c2c l F .text 00000034 send_request
00006c60 l F .text 00000058 parse_msg
00006d04 l F .text 00000288 handle_dhcp
000078b8 l O .text 00000004 xid
20001214 l O .bss 00000034 s
000078b8 l O .text 00000004 magic_cookie
000078bc l O .text 00000004 magic_cookie
00000000 l df *ABS* 00000000 locale.c
00006f90 l F .text 00000018 __get_current_locale
00006f94 l F .text 00000018 __get_current_locale
00000000 l df *ABS* 00000000 mbtowc_r.c
00000000 l df *ABS* 00000000 memcmp.c
00000000 l df *ABS* 00000000 memcpy-stub.c
@ -283,7 +283,7 @@ SYMBOL TABLE:
00000000 l df *ABS* 00000000 c:/progra~2/gnutoo~1/50a5a~1.420/bin/../lib/gcc/arm-none-eabi/5.4.1/armv7-m/crtn.o
00000000 l df *ABS* 00000000 ctype_.c
00000000 l df *ABS* 00000000 crtstuff.c
000079c8 l O .text 00000000 __FRAME_END__
000079cc l O .text 00000000 __FRAME_END__
00000000 l df *ABS* 00000000 impure.c
20000044 l O .data 00000060 impure_data
00000000 l df *ABS* 00000000
@ -300,198 +300,198 @@ SYMBOL TABLE:
20000214 l .data 00000000 __init_array_start
00000000 l *UND* 00000000 _exit
20000214 l .data 00000000 __preinit_array_start
00002bdc g F .text 00000018 ComInit
0000362c g F .text 00000068 FlashWrite
0000567c g F .text 00000054 f_gets
00001858 g F .text 00000010 netdev_get_mac
000023c4 g F .text 00000008 AssertFailure
00002be0 g F .text 00000018 ComInit
00003630 g F .text 00000068 FlashWrite
00005680 g F .text 00000054 f_gets
0000185c g F .text 00000010 netdev_get_mac
000023c8 g F .text 00000008 AssertFailure
00000724 g F .text 00000034 GPIOPinTypeSSI
000020dc g F .text 00000040 reset_handler
000020e0 g F .text 00000040 reset_handler
000016fc g F .text 00000028 SSIDataGet
00003394 g F .text 0000001c TimerUpdate
00003274 g F .text 00000010 XcpPacketTransmitted
00002bf4 g F .text 00000050 ComTask
00003398 g F .text 0000001c TimerUpdate
00003278 g F .text 00000010 XcpPacketTransmitted
00002bf8 g F .text 00000050 ComTask
00001674 g F .text 00000024 SSIEnable
000011dc g F .text 00000008 SysCtlDelay
20001248 g O .bss 00000002 uip_len
200011a4 g O .bss 00000006 uip_ethaddr
00002b90 g F .text 0000000c BackDoorSetExtension
0000582c g F .text 0000005c uip_add32
00002b0c g F .text 00000020 BootInit
0000256c g F .text 0000003a FileSrecVerifyChecksum
00006fa8 g F .text 00000014 __locale_ctype_ptr
00002bc4 g F .text 00000018 BackDoorInit
00002b94 g F .text 0000000c BackDoorSetExtension
00005830 g F .text 0000005c uip_add32
00002b10 g F .text 00000020 BootInit
00002570 g F .text 0000003a FileSrecVerifyChecksum
00006fac g F .text 00000014 __locale_ctype_ptr
00002bc8 g F .text 00000018 BackDoorInit
00001598 g F .text 000000dc SSIConfigSetExpClk
00002b08 g F .text 00000002 CopService
000079cc g .text 00000000 _etext
00002b0c g F .text 00000002 CopService
000079d0 g .text 00000000 _etext
000010c8 g F .text 000000a4 SysCtlPeripheralReset
000039d4 g F .text 00000004 CpuIrqDisable
0000575c g F .text 00000094 ff_wtoupper
000039d8 g F .text 00000004 CpuIrqDisable
00005760 g F .text 00000094 ff_wtoupper
00000698 g F .text 00000024 GPIOPinWrite
00001868 g F .text 00000034 netdev_read
000059e0 g F .text 00000bec uip_process
000037a8 g F .text 00000006 FlashGetUserProgBaseAddress
00006ffe g F .text 00000016 memcpy
000026f4 g F .text 00000410 FileTask
0000186c g F .text 00000034 netdev_read
000059e4 g F .text 00000bec uip_process
000037ac g F .text 00000006 FlashGetUserProgBaseAddress
00007002 g F .text 00000016 memcpy
000026f8 g F .text 00000410 FileTask
00000304 g F .text 00000028 UARTSpaceAvail
00003364 g F .text 0000000c TimerReset
00001bc0 g F .text 00000160 disk_initialize
00003368 g F .text 0000000c TimerReset
00001bc4 g F .text 00000160 disk_initialize
2000124c g O .bss 00000004 uip_sappdata
0000172c g F .text 00000018 netdev_init
20001250 g O .bss 00000004 uip_acc32
00005978 g F .text 00000020 uip_ipchksum
0000597c g F .text 00000020 uip_ipchksum
00000358 g F .text 0000002c UARTCharPutNonBlocking
00002b2c g F .text 00000018 BootTask
000036d4 g F .text 0000004c FlashWriteChecksum
000065cc g F .text 000000a8 uip_udp_new
00002cac g F .text 00000018 ComDeferredInit
00002c48 g F .text 0000002c ComTransmitPacket
00002b30 g F .text 00000018 BootTask
000036d8 g F .text 0000004c FlashWriteChecksum
000065d0 g F .text 000000a8 uip_udp_new
00002cb0 g F .text 00000018 ComDeferredInit
00002c4c g F .text 0000002c ComTransmitPacket
00000894 g F .text 00000030 EthernetInitExpClk
00001d20 g F .text 00000014 disk_status
000025a8 g F .text 0000014c FileSrecParseLine
00005938 g F .text 00000034 uip_listen
0000189c g F .text 0000001c netdev_send
00001e68 g F .text 00000274 disk_ioctl
000024ec g F .text 00000030 FileHandleFirmwareUpdateRequest
00001d24 g F .text 00000014 disk_status
000025ac g F .text 0000014c FileSrecParseLine
0000593c g F .text 00000034 uip_listen
000018a0 g F .text 0000001c netdev_send
00001e6c g F .text 00000274 disk_ioctl
000024f0 g F .text 00000030 FileHandleFirmwareUpdateRequest
00000a10 g F .text 00000050 EthernetPacketPut
0000116c g F .text 00000070 SysCtlPeripheralEnable
20001254 g O .bss 00000001 uip_flags
000021ac g F .text 00000044 FileFirmwareUpdateCompletedHook
00003264 g F .text 00000010 XcpIsConnected
000055c0 g F .text 000000bc f_unlink
00007040 g F .text 00000000 _init
00003820 g F .text 00000008 NvmInit
00003614 g F .text 00000018 FlashInit
00003840 g F .text 00000008 NvmGetUserProgBaseAddress
000021b0 g F .text 00000044 FileFirmwareUpdateCompletedHook
00003268 g F .text 00000010 XcpIsConnected
000055c4 g F .text 000000bc f_unlink
00007044 g F .text 00000000 _init
00003824 g F .text 00000008 NvmInit
00003618 g F .text 00000018 FlashInit
00003844 g F .text 00000008 NvmGetUserProgBaseAddress
20001960 g .bss 00000000 _ebss
000056d0 g F .text 00000050 f_puts
00006cb4 g F .text 0000003c dhcpc_init
000056d4 g F .text 00000050 f_puts
00006cb8 g F .text 0000003c dhcpc_init
00000800 g *ABS* 00000000 __STACKSIZE__
000022cc g F .text 00000010 UnusedISR
000022d0 g F .text 00000010 UnusedISR
000009bc g F .text 00000054 EthernetPacketGetNonBlocking
00000678 g F .text 00000020 GPIOPinRead
00002c44 g F .text 00000002 ComFree
00002c48 g F .text 00000002 ComFree
000006bc g F .text 00000034 GPIOPinTypeEthernetLED
20001258 g O .bss 00000004 uip_udp_conn
00000000 w *UND* 00000000 __sf_fake_stderr
00006a54 g F .text 00000018 timer_expired
00006a58 g F .text 00000018 timer_expired
00000000 w *UND* 00000000 __deregister_frame_info
000038b8 g F .text 00000024 UartInit
00003830 g F .text 00000008 NvmErase
00002128 g F .text 00000014 CpuUserProgramStartHook
00001744 g F .text 00000114 netdev_init_mac
000038bc g F .text 00000024 UartInit
00003834 g F .text 00000008 NvmErase
0000212c g F .text 00000014 CpuUserProgramStartHook
00001744 g F .text 00000118 netdev_init_mac
0000032c g F .text 0000002c UARTCharGetNonBlocking
000016bc g F .text 00000040 SSIDataPut
2000021c g .bss 00000000 _bss
000053e8 g F .text 00000024 f_close
00003284 g F .text 000000e0 XcpPacketReceived
000059d4 g F .text 0000000a uip_tcpchksum
000037b0 g F .text 00000008 CpuInit
00004ff0 g F .text 0000016c f_read
00003768 g F .text 00000040 FlashDone
000053ec g F .text 00000024 f_close
00003288 g F .text 000000e0 XcpPacketReceived
000059d8 g F .text 0000000a uip_tcpchksum
000037b4 g F .text 00000008 CpuInit
00004ff4 g F .text 0000016c f_read
0000376c g F .text 00000040 FlashDone
2000125c g O .bss 00000004 uip_appdata
20001260 g O .bss 00000004 uip_conn
00006fe0 g F .text 0000001e memcmp
00006fe4 g F .text 0000001e memcmp
20000040 g .shared 00000000 __shared_end__
20001264 g O .bss 00000068 uip_conns
00000b90 g F .text 000000d8 FlashProgram
00003248 g F .text 0000001c XcpInit
000024ac g F .text 0000002c FileInit
0000324c g F .text 0000001c XcpInit
000024b0 g F .text 0000002c FileInit
00000a98 g F .text 00000028 EthernetIntStatus
000068e4 g F .text 00000160 uip_arp_out
000068e8 g F .text 00000160 uip_arp_out
00000000 w *UND* 00000000 __sf_fake_stdin
00003694 g F .text 00000040 FlashErase
00007014 g F .text 00000010 memset
000021f0 g F .text 00000018 FileFirmwareUpdateErrorHook
00002298 g F .text 00000032 main
0000534c g F .text 0000009c f_sync
00003698 g F .text 00000040 FlashErase
00007018 g F .text 00000010 memset
000021f4 g F .text 00000018 FileFirmwareUpdateErrorHook
0000229c g F .text 00000032 main
00005350 g F .text 0000009c f_sync
0000135c g F .text 00000204 SysCtlClockGet
0000251c g F .text 00000050 FileSrecGetLineType
00002520 g F .text 00000050 FileSrecGetLineType
000001e4 g F .text 00000038 UARTDisable
00007024 g F .text 0000001a __ascii_wctomb
00003848 g F .text 00000014 NvmDone
00007028 g F .text 0000001a __ascii_wctomb
0000384c g F .text 00000014 NvmDone
0000097c g F .text 00000040 EthernetEnable
00004e20 g F .text 00000058 f_mount
000038dc g F .text 00000050 UartTransmitPacket
00003838 g F .text 00000008 NvmVerifyChecksum
00003800 g F .text 00000020 CpuMemCopy
00002364 g F .text 00000030 SharedParamsInit
0000704c g F .text 00000000 _fini
0000540c g F .text 00000168 f_lseek
00006804 g F .text 000000e0 uip_arp_arpin
00002c8c g F .text 00000018 ComGetActiveInterfaceMaxTxLen
0000392c g F .text 000000a8 UartReceivePacket
0000217c g F .text 00000008 FileGetFirmwareFilenameHook
000039d8 g F .text 00000004 CpuIrqEnable
00004e24 g F .text 00000058 f_mount
000038e0 g F .text 00000050 UartTransmitPacket
0000383c g F .text 00000008 NvmVerifyChecksum
00003804 g F .text 00000020 CpuMemCopy
00002368 g F .text 00000030 SharedParamsInit
00007050 g F .text 00000000 _fini
00005410 g F .text 00000168 f_lseek
00006808 g F .text 000000e0 uip_arp_arpin
00002c90 g F .text 00000018 ComGetActiveInterfaceMaxTxLen
00003930 g F .text 000000a8 UartReceivePacket
00002180 g F .text 00000008 FileGetFirmwareFilenameHook
000039dc g F .text 00000004 CpuIrqEnable
0000091c g F .text 00000060 EthernetMACAddrSet
200000a4 g O .data 00000004 _impure_ptr
000067a4 g F .text 00000060 uip_arp_timer
000067a8 g F .text 00000060 uip_arp_timer
200012cc g O .bss 00000002 uip_listenports
200012d0 g O .bss 00000004 uip_draddr
00006fbc g F .text 00000024 __ascii_mbtowc
00006fc0 g F .text 00000024 __ascii_mbtowc
20000040 g .data 00000000 _data
00000af4 g F .text 00000044 EthernetPHYRead
00005574 g F .text 0000004c f_stat
00002b04 g F .text 00000002 CopInit
00002b9c g F .text 0000000c BackDoorGetExtension
00006a44 g F .text 0000000e timer_set
00005578 g F .text 0000004c f_stat
00002b08 g F .text 00000002 CopInit
00002ba0 g F .text 0000000c BackDoorGetExtension
00006a48 g F .text 0000000e timer_set
00001698 g F .text 00000024 SSIDisable
00003828 g F .text 00000008 NvmWrite
000037b8 g F .text 00000048 CpuStartUserProgram
0000382c g F .text 00000008 NvmWrite
000037bc g F .text 00000048 CpuStartUserProgram
20002160 g .bss 00000000 _estack
000008c4 g F .text 00000058 EthernetConfigSet
00003720 g F .text 00000048 FlashVerifyChecksum
00002e8c g F .text 00000048 NetTransmitPacket
00003724 g F .text 00000048 FlashVerifyChecksum
00002e90 g F .text 00000048 NetTransmitPacket
2000021c g .data 00000000 _edata
000024d8 g F .text 00000014 FileIsIdle
0000596c g F .text 0000000a htons
00006f88 g F .text 00000008 dhcpc_appcall
0000515c g F .text 000001a4 f_write
000024dc g F .text 00000014 FileIsIdle
00005970 g F .text 0000000a htons
00006f8c g F .text 00000008 dhcpc_appcall
00005160 g F .text 000001a4 f_write
00000000 g O .text 000000f0 _vectab
00000c68 g F .text 00000068 FlashUserGet
00000758 g F .text 00000034 GPIOPinTypeUART
20000000 g .shared 00000000 __shared_start__
00004e78 g F .text 00000178 f_open
00001dbc g F .text 000000ac disk_write
00004e7c g F .text 00000178 f_open
00001dc0 g F .text 000000ac disk_write
000006f0 g F .text 00000034 GPIOPinTypeGPIOOutput
00002208 g F .text 00000048 FileFirmwareUpdateLogHook
00002ca4 g F .text 00000008 ComIsConnected
0000220c g F .text 00000048 FileFirmwareUpdateLogHook
00002ca8 g F .text 00000008 ComIsConnected
00000000 w *UND* 00000000 __sf_fake_stdout
00000a60 g F .text 00000038 EthernetIntDisable
000078c6 g O .text 00000101 _ctype_
000078ca g O .text 00000101 _ctype_
00000ac0 g F .text 00000034 EthernetIntClear
0000213c g F .text 00000040 FileIsFirmwareUpdateRequestedHook
00002140 g F .text 00000040 FileIsFirmwareUpdateRequestedHook
00000384 g F .text 00000020 UARTBusy
000058b8 g F .text 00000080 uip_init
000058bc g F .text 00000080 uip_init
00001724 g F .text 00000008 clock_time
00002ba8 g F .text 0000001c BackDoorRestartTimer
00002c74 g F .text 00000018 ComGetActiveInterfaceMaxRxLen
00002ed4 g F .text 00000018 NetReceivePacket
00002bac g F .text 0000001c BackDoorRestartTimer
00002c78 g F .text 00000018 ComGetActiveInterfaceMaxRxLen
00002ed8 g F .text 00000018 NetReceivePacket
000004c8 g F .text 00000064 GPIODirModeSet
00001d34 g F .text 00000088 disk_read
00002b44 g F .text 0000004c BackDoorCheck
00001d38 g F .text 00000088 disk_read
00002b48 g F .text 0000004c BackDoorCheck
20001960 g .bss 00000000 _stack
00002394 g F .text 00000030 SharedParamsReadByIndex
00002398 g F .text 00000030 SharedParamsReadByIndex
200012d4 g O .bss 00000004 uip_netmask
00002e70 g F .text 0000001c NetDeferredInit
00002e74 g F .text 0000001c NetDeferredInit
200012d8 g O .bss 00000004 uip_hostaddr
00005720 g F .text 0000003c ff_convert
000033b0 g F .text 00000010 TimerGet
00002eec g F .text 00000078 NetApp
00005724 g F .text 0000003c ff_convert
000033b4 g F .text 00000010 TimerGet
00002ef0 g F .text 00000078 NetApp
00000000 w *UND* 00000000 _Jv_RegisterClasses
0000021c g F .text 000000e8 UARTConfigSetExpClk
00002dd0 g F .text 000000a0 NetInit
00002dd4 g F .text 000000a0 NetInit
000011e4 g F .text 00000178 SysCtlClockSet
0000052c g F .text 0000014c GPIOPadConfigSet
00003370 g F .text 00000024 TimerInit
00003374 g F .text 00000024 TimerInit
00000000 w *UND* 00000000 __register_frame_info
200012dc g O .bss 00000642 uip_buf
200000a8 g O .data 0000016c __global_locale
00000b38 g F .text 00000058 FlashClear
00006674 g F .text 00000028 uip_send
00006cf0 g F .text 00000010 dhcpc_request
00006678 g F .text 00000028 uip_send
00006cf4 g F .text 00000010 dhcpc_request
2000191e g O .bss 00000002 uip_slen
00002184 g F .text 00000028 FileFirmwareUpdateStartedHook
00002188 g F .text 00000028 FileFirmwareUpdateStartedHook
20001920 g O .bss 00000040 uip_udp_conns
000001b4 g F .text 00000030 UARTEnable

View File

@ -75,7 +75,6 @@ void netdev_init(void)
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
unsigned long ulUser0, ulUser1;
blt_int32u ulTemp;
blt_int32u ulLinkTimeOut;
@ -119,6 +118,8 @@ void netdev_init_mac(void)
{
break;
}
/* Service the watchdog. */
CopService();
}
/* set the default MAC address */

View File

@ -75,7 +75,6 @@ void netdev_init(void)
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
unsigned long ulUser0, ulUser1;
unsigned long ulTemp;
unsigned long ulLinkTimeOut;

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@
<PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><ShowCodeCoverage>0</ShowCodeCoverage><ShowInstrProfiling>0</ShowInstrProfiling></Disassembly>
<WATCH_1><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><expressions><item></item></expressions><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>147</item><item>150</item><item>100</item><item>289</item></col-widths></WATCH_1><Register><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Register><STACK_1><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><stack>CSTACK</stack><width>4</width><vars>1</vars><offset>0</offset><col-names><item>Data</item><item>Frame</item><item>Location</item><item>Type</item><item>Value</item><item>Variable</item></col-names><col-widths><item>100</item><item>100</item><item>100</item><item>100</item><item>100</item><item>100</item></col-widths></STACK_1><Memory><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><FindDirection>1</FindDirection><MemGotoHistory><item>0x20001ec8</item></MemGotoHistory><FindAsHex>0</FindAsHex></Memory><CallStack><col-names><item>Frame</item><item>_I0</item></col-names><col-widths><item>3500</item><item>20</item></col-widths><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></CallStack></Static>
<WATCH_1><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><expressions><item/></expressions><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>147</item><item>150</item><item>100</item><item>289</item></col-widths></WATCH_1><Register><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Register><STACK_1><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><stack>CSTACK</stack><width>4</width><vars>1</vars><offset>0</offset><col-names><item>Data</item><item>Frame</item><item>Location</item><item>Type</item><item>Value</item><item>Variable</item></col-names><col-widths><item>100</item><item>100</item><item>100</item><item>100</item><item>100</item><item>100</item></col-widths></STACK_1><Memory><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><FindDirection>1</FindDirection><MemGotoHistory><item>0x20001ec8</item></MemGotoHistory><FindAsHex>0</FindAsHex></Memory><CallStack><col-names><item>Frame</item><item>_I0</item></col-names><col-widths><item>3500</item><item>20</item></col-widths><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></CallStack></Static>
<Windows>

View File

@ -17,7 +17,7 @@
<Build><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Find-All-References</Factory></Window></Windows></PreferedWindows><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1155</ColumnWidth1><ColumnWidth2>308</ColumnWidth2><ColumnWidth3>77</ColumnWidth3></Build><Find-in-Files><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><ColumnWidth0>552</ColumnWidth0><ColumnWidth1>78</ColumnWidth1><ColumnWidth2>946</ColumnWidth2><ColumnWidth3>379</ColumnWidth3></Find-in-Files><TerminalIO/><PROJECT_GUI_CALL_GRAPH><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><col-names><item>File</item><item>Function</item><item>Line</item></col-names><col-widths><item>200</item><item>700</item><item>100</item></col-widths></PROJECT_GUI_CALL_GRAPH><Select-Ambiguous-Definitions><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Build</Factory></Window><Window><Factory>Find-in-Files</Factory></Window><Window><Factory>Find-All-References</Factory></Window></Windows></PreferedWindows><ColumnWidth0>664</ColumnWidth0><ColumnWidth1>94</ColumnWidth1><ColumnWidth2>1138</ColumnWidth2></Select-Ambiguous-Definitions><Find-All-References><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Build</Factory></Window></Windows></PreferedWindows><ColumnWidth0>664</ColumnWidth0><ColumnWidth1>94</ColumnWidth1><ColumnWidth2>1138</ColumnWidth2></Find-All-References><Debug-Log><ColumnWidth0>18</ColumnWidth0><ColumnWidth1>279</ColumnWidth1></Debug-Log></Static>
<Windows>
<Wnd0>
<Wnd1>
<Tabs>
<Tab>
<Identity>TabID-31649-22318</Identity>
@ -25,24 +25,24 @@
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>lm3s6965</ExpandedNode><ExpandedNode>lm3s6965/Boot</ExpandedNode><ExpandedNode>lm3s6965/Output</ExpandedNode><ExpandedNode>lm3s6965/Source</ExpandedNode><ExpandedNode>lm3s6965/Source/ARMCM3_LM3S</ExpandedNode><ExpandedNode>lm3s6965/Source/ARMCM3_LM3S/IAR</ExpandedNode><ExpandedNode>lm3s6965/Source/fatfs</ExpandedNode><ExpandedNode>lm3s6965/Source/third_party</ExpandedNode><ExpandedNode>lm3s6965/Source/third_party/uip</ExpandedNode></NodeDict></Session>
<NodeDict><ExpandedNode>lm3s6965</ExpandedNode><ExpandedNode>lm3s6965/Boot</ExpandedNode><ExpandedNode>lm3s6965/Boot/lib</ExpandedNode><ExpandedNode>lm3s6965/Boot/lib/uip</ExpandedNode><ExpandedNode>lm3s6965/Output</ExpandedNode><ExpandedNode>lm3s6965/Source</ExpandedNode><ExpandedNode>lm3s6965/Source/ARMCM3_LM3S</ExpandedNode><ExpandedNode>lm3s6965/Source/ARMCM3_LM3S/IAR</ExpandedNode><ExpandedNode>lm3s6965/Source/fatfs</ExpandedNode><ExpandedNode>lm3s6965/Source/third_party</ExpandedNode><ExpandedNode>lm3s6965/Source/third_party/uip</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd0><Wnd3><Tabs><Tab><Identity>TabID-23631-11730</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-25094-12726</Identity><TabName>Ambiguous Definitions</TabName><Factory>Select-Ambiguous-Definitions</Factory><Session/></Tab><Tab><Identity>TabID-13294-29227</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>
<SelectedTab>0</SelectedTab></Wnd1><Wnd2><Tabs><Tab><Identity>TabID-23631-11730</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-25094-12726</Identity><TabName>Ambiguous Definitions</TabName><Factory>Select-Ambiguous-Definitions</Factory><Session/></Tab><Tab><Identity>TabID-13294-29227</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd2></Windows>
<Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\blt_conf.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>75</YPos2><SelStart2>5274</SelStart2><SelEnd2>5274</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>36</YPos2><SelStart2>2624</SelStart2><SelEnd2>2624</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\hooks.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>51</YPos2><SelStart2>3539</SelStart2><SelEnd2>3539</SelEnd2></Tab><ActiveTab>2</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\blt_conf.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>75</YPos2><SelStart2>5274</SelStart2><SelEnd2>5274</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>36</YPos2><SelStart2>2624</SelStart2><SelEnd2>2624</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\hooks.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>51</YPos2><SelStart2>3539</SelStart2><SelEnd2>3539</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\lib\uip\netdev.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>77</YPos2><SelStart2>4591</SelStart2><SelEnd2>4591</SelEnd2></Tab><ActiveTab>3</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-049D4890><key>iaridepm.enu1</key></Toolbar-049D4890></Sizes></Row0><Row1><Sizes/></Row1><Row2><Sizes/></Row2></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>463</Bottom><Right>467</Right><x>-2</x><y>-2</y><xscreen>372</xscreen><yscreen>353</yscreen><sizeHorzCX>193750</sizeHorzCX><sizeHorzCY>350546</sizeHorzCY><sizeVertCX>244271</sizeVertCX><sizeVertCY>461768</sizeVertCY></Rect></Wnd0><Wnd3><Rect><Top>0</Top><Left>0</Left><Bottom>0</Bottom><Right>7</Right><x>-2</x><y>461</y><xscreen>258</xscreen><yscreen>237</yscreen><sizeHorzCX>134375</sizeHorzCX><sizeHorzCY>235353</sizeHorzCY><sizeVertCX>244271</sizeVertCX><sizeVertCY>497517</sizeVertCY></Rect></Wnd3></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes/></Row0></Bottom><Float><Sizes/></Float></Positions>
<Top><Row0><Sizes><Toolbar-053402B0><key>iaridepm.enu1</key></Toolbar-053402B0></Sizes></Row0></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>463</Bottom><Right>467</Right><x>-2</x><y>-2</y><xscreen>372</xscreen><yscreen>353</yscreen><sizeHorzCX>193750</sizeHorzCX><sizeHorzCY>350546</sizeHorzCY><sizeVertCX>244271</sizeVertCX><sizeVertCY>461768</sizeVertCY></Rect></Wnd1><Wnd2><Rect><Top>0</Top><Left>0</Left><Bottom>1298092032</Bottom><Right>0</Right><x>-2</x><y>461</y><xscreen>258</xscreen><yscreen>237</yscreen><sizeHorzCX>134375</sizeHorzCX><sizeHorzCY>235353</sizeHorzCY><sizeVertCX>244271</sizeVertCX><sizeVertCY>497517</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes/></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Workspace>

View File

@ -75,7 +75,6 @@ void netdev_init(void)
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
unsigned long ulUser0, ulUser1;
blt_int32u ulTemp;
blt_int32u ulLinkTimeOut;
@ -119,6 +118,8 @@ void netdev_init_mac(void)
{
break;
}
/* Service the watchdog. */
CopService();
}
/* set the default MAC address */

View File

@ -75,7 +75,6 @@ void netdev_init(void)
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
unsigned long ulUser0, ulUser1;
unsigned long ulTemp;
unsigned long ulLinkTimeOut;

View File

@ -114,16 +114,20 @@
<option id="org.eclipse.cdt.cross.arm.gnu.c.compiler.option.optimization.level.1924292214" name="Optimization level" superClass="org.eclipse.cdt.cross.arm.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="org.eclipse.cdt.cross.arm.gnu.base.option.optimization.level.debugging" valueType="enumerated"/>
<option id="com.ifx.xmc4000.compiler.option.misc.mfloat.1070317286" name="Floating point" superClass="com.ifx.xmc4000.compiler.option.misc.mfloat" useByScannerDiscovery="false" value="org.eclipse.cdt.cross.arm.gnu.base.option.other.mfloat.softfp" valueType="enumerated"/>
<option id="com.ifx.xmc4000.compiler.option.include.paths.116069669" name="Include paths (-I)" superClass="com.ifx.xmc4000.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Libraries/XMCLib/inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Libraries/CMSIS/Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Libraries/CMSIS/Infineon/XMC4700_series/Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Libraries&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Libraries/CMSIS/Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Libraries/CMSIS/Infineon/XMC4700_series/Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Libraries/XMCLib/inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Libraries/uip&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../../../Source&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../../../Source/ARMCM4_XMC4&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../../../Source/third_party/uip/uip&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../../../Source/third_party/uip/apps/dhcpc&quot;"/>
</option>
<option id="org.eclipse.cdt.cross.arm.gnu.c.compiler.option.preprocessor.def.73574838" name="Defined symbols (-D)" superClass="org.eclipse.cdt.cross.arm.gnu.c.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="XMC4700_F144x2048"/>
<listOptionValue builtIn="false" value="XMC_ETH_PHY_KSZ8081RNB"/>
</option>
<inputType id="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.c.compiler.base.input.631714543" superClass="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.c.compiler.base.input"/>
</tool>
@ -140,7 +144,7 @@
</tool>
<tool id="com.ifx.xmc4000.appDebug.assembler.573678005" name="ARM-GCC Assembler" superClass="com.ifx.xmc4000.appDebug.assembler">
<option id="com.ifx.xmc4000.assembler.option.misc.mfloat.1022230053" name="Floating point" superClass="com.ifx.xmc4000.assembler.option.misc.mfloat" value="org.eclipse.cdt.cross.arm.gnu.base.option.other.mfloat.softfp" valueType="enumerated"/>
<option id="com.ifx.xmc4000.assembler.option.include.paths.1033397418" name="Include paths (-I)" superClass="com.ifx.xmc4000.assembler.option.include.paths" valueType="includePath"/>
<option id="com.ifx.xmc4000.assembler.option.include.paths.1033397418" name="Include paths (-I)" superClass="com.ifx.xmc4000.assembler.option.include.paths"/>
<option id="org.eclipse.cdt.cross.arm.gnu.assembler.option.preprocessor.def.1114263431" name="Defined symbols (-D)" superClass="org.eclipse.cdt.cross.arm.gnu.assembler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="XMC4700_F144x2048"/>
</option>
@ -204,4 +208,5 @@
<resource resourceType="PROJECT" workspacePath="/Boot"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>

View File

@ -34,7 +34,7 @@
</linkedResources>
<filteredResources>
<filter>
<id>1493816189331</id>
<id>1534411681639</id>
<name>Core</name>
<type>9</type>
<matcher>
@ -42,6 +42,15 @@
<arguments>1.0-name-matches-false-false-ARMCM4_XMC4</arguments>
</matcher>
</filter>
<filter>
<id>1534411681686</id>
<name>Core</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-third_party</arguments>
</matcher>
</filter>
<filter>
<id>1493816210232</id>
<name>Core/ARMCM4_XMC4</name>
@ -51,6 +60,78 @@
<arguments>1.0-name-matches-false-false-GCC</arguments>
</matcher>
</filter>
<filter>
<id>1534411697456</id>
<name>Core/third_party</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-uip</arguments>
</matcher>
</filter>
<filter>
<id>1534411724947</id>
<name>Core/third_party/uip</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-uip</arguments>
</matcher>
</filter>
<filter>
<id>1534411724947</id>
<name>Core/third_party/uip</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-apps</arguments>
</matcher>
</filter>
<filter>
<id>1534411829080</id>
<name>Core/third_party/uip/apps</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-dhcpc</arguments>
</matcher>
</filter>
<filter>
<id>1534411789542</id>
<name>Core/third_party/uip/uip</name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-psock.*</arguments>
</matcher>
</filter>
<filter>
<id>1534411789558</id>
<name>Core/third_party/uip/uip</name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-uip-fw.c</arguments>
</matcher>
</filter>
<filter>
<id>1534411789558</id>
<name>Core/third_party/uip/uip</name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-uip-neighbor.c</arguments>
</matcher>
</filter>
<filter>
<id>1534411789574</id>
<name>Core/third_party/uip/uip</name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-uip-split.c</arguments>
</matcher>
</filter>
</filteredResources>
<variableList>
<variable>

View File

@ -4,7 +4,7 @@
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1684938055939234381" id="com.ifx.xmc4000.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings XMC" parameter="${COMMAND} ${FLAGS} -E -P -v -dM &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1737998430419022637" id="com.ifx.xmc4000.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings XMC" parameter="${COMMAND} ${FLAGS} -E -P -v -dM &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -14,7 +14,7 @@
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1684938055939234381" id="com.ifx.xmc4000.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings XMC" parameter="${COMMAND} ${FLAGS} -E -P -v -dM &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1737998430419022637" id="com.ifx.xmc4000.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings XMC" parameter="${COMMAND} ${FLAGS} -E -P -v -dM &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<com.ifx.xmc4000.appDebug_memory>
<details IMemento.internal.id="0" enable="Yes" endAddress="0x08003FFF" memModelType="ROM" modelName="FLASH 1 (cached)" startAddress="0x08000000"/>
<details IMemento.internal.id="1" enable="Yes" endAddress="0x0C003FFF" memModelType="ROM" modelName="FLASH 1 (uncached)" startAddress="0x0C000000"/>
<details IMemento.internal.id="2" enable="Yes" endAddress="0x1FFFFFFF" memModelType="RAM" modelName="PSRAM 1" startAddress="0x1FFE8000"/>
<details IMemento.internal.id="0" enable="Yes" endAddress="0x08007FFF" memModelType="ROM" modelName="FLASH 1 (cached)" startAddress="0x08000000"/>
<details IMemento.internal.id="1" enable="Yes" endAddress="0x0C007FFF" memModelType="ROM" modelName="FLASH 1 (uncached)" startAddress="0x0C000000"/>
<details IMemento.internal.id="2" enable="Yes" endAddress="0x1FFFFFFF" memModelType="RAM" modelName="PSRAM 1" startAddress="0x1FFE8040"/>
<details IMemento.internal.id="3" enable="Yes" endAddress="0x2001FFFF" memModelType="RAM" modelName="DSRAM 1 (system)" startAddress="0x20000000"/>
<details IMemento.internal.id="4" enable="Yes" endAddress="0x2003FFFF" memModelType="RAM" modelName="DSRAM 2 (comm)" startAddress="0x20020000"/>
<details IMemento.internal.id="5" enable="Yes" endAddress="0x2003FFFF" memModelType="RAM" modelName="SRAM (combined)" startAddress="0x1FFE8000"/>
<details IMemento.internal.id="5" enable="Yes" endAddress="0x2003FFFF" memModelType="RAM" modelName="SRAM (combined)" startAddress="0x1FFE8040"/>
<details IMemento.internal.id="6" enable="Yes" endAddress="0x1FFE803F" memModelType="RAM" modelName="SHARED" startAddress="0x1FFE8000"/>
</com.ifx.xmc4000.appDebug_memory>

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: clock-arch.c,v 1.2 2006/06/12 08:00:31 adam Exp $
*/
/**
* \file
* Implementation of architecture-specific clock functionality
* \author
* Adam Dunkels <adam@sics.se>
*/
#include "clock-arch.h"
#include "boot.h"
/*---------------------------------------------------------------------------*/
clock_time_t
clock_time(void)
{
return (clock_time_t)TimerGet();
}
/*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: clock-arch.h,v 1.2 2006/06/12 08:00:31 adam Exp $
*/
#ifndef __CLOCK_ARCH_H__
#define __CLOCK_ARCH_H__
typedef int clock_time_t;
#define CLOCK_CONF_SECOND 1000
#endif /* __CLOCK_ARCH_H__ */

View File

@ -0,0 +1,298 @@
/*
* Copyright (c) 2001, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: netdev.c,v 1.8 2006/06/07 08:39:58 adam Exp $
*/
/*---------------------------------------------------------------------------*/
#include "uip.h"
#include "uip_arp.h"
#include "boot.h"
#include "xmc_gpio.h"
#include "xmc_eth_mac.h"
#include "xmc_eth_phy.h"
#include <string.h>
/*---------------------------------------------------------------------------*/
#define NETDEV_LINKUP_TIMEOUT_MS (5000)
#define NETDEV_DEFAULT_MACADDR0 (0x08)
#define NETDEV_DEFAULT_MACADDR1 (0x00)
#define NETDEV_DEFAULT_MACADDR2 (0x27)
#define NETDEV_DEFAULT_MACADDR3 (0x69)
#define NETDEV_DEFAULT_MACADDR4 (0x5B)
#define NETDEV_DEFAULT_MACADDR5 (0x45)
#define NETDEV_DEFAULT_MACADDR ((uint64_t)NETDEV_DEFAULT_MACADDR0 | \
((uint64_t)NETDEV_DEFAULT_MACADDR1 << 8) | \
((uint64_t)NETDEV_DEFAULT_MACADDR2 << 16) | \
((uint64_t)NETDEV_DEFAULT_MACADDR3 << 24) | \
((uint64_t)NETDEV_DEFAULT_MACADDR4 << 32) | \
((uint64_t)NETDEV_DEFAULT_MACADDR5 << 40))
#define ETH_UIP_0_NUM_RX_BUF (4U)
#define ETH_UIP_0_NUM_TX_BUF (4U)
#define ETH_UIP_0_CRS_DV XMC_GPIO_PORT15, 9U
#define ETH_UIP_0_RXER XMC_GPIO_PORT2, 4U
#define ETH_UIP_0_RXD0 XMC_GPIO_PORT2, 2U
#define ETH_UIP_0_RXD1 XMC_GPIO_PORT2, 3U
#define ETH_UIP_0_TXEN XMC_GPIO_PORT2, 5U
#define ETH_UIP_0_TXD0 XMC_GPIO_PORT2, 8U
#define ETH_UIP_0_TXD1 XMC_GPIO_PORT2, 9U
#define ETH_UIP_0_RMII_CLK XMC_GPIO_PORT15, 8U
#define ETH_UIP_0_MDC XMC_GPIO_PORT2, 7U
#define ETH_UIP_0_MDIO XMC_GPIO_PORT2, 0U
#define ETH_UIP_0_PIN_LIST_SIZE (10U)
#define ETH_UIP_0_PHY_ADDR (0)
/*---------------------------------------------------------------------------*/
#if defined(__ICCARM__)
#pragma data_alignment=4
static XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] @ ".iram2";
#pragma data_alignment=4
static XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] @ ".iram2";
#pragma data_alignment=4
static blt_int8u ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] @ ".iram2";
#pragma data_alignment=4
static blt_int8u ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] @ ".iram2";
#elif defined(__CC_ARM)
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("RW_IRAM1")));
#elif defined(__GNUC__)
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("ETH_RAM")));
#else
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF];
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF];
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE];
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE];
#endif
const XMC_ETH_PHY_CONFIG_t eth_phy_config =
{
.interface = XMC_ETH_LINK_INTERFACE_RMII,
.enable_auto_negotiate = false,
.duplex = XMC_ETH_LINK_DUPLEX_FULL,
.speed = XMC_ETH_LINK_SPEED_100M
};
XMC_ETH_MAC_t eth_mac =
{
.regs = ETH0,
.address = NETDEV_DEFAULT_MACADDR,
.rx_desc = ETH_UIP_0_rx_desc,
.tx_desc = ETH_UIP_0_tx_desc,
.rx_buf = &ETH_UIP_0_rx_buf[0][0],
.tx_buf = &ETH_UIP_0_tx_buf[0][0],
.num_rx_buf = ETH_UIP_0_NUM_RX_BUF,
.num_tx_buf = ETH_UIP_0_NUM_TX_BUF
};
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
XMC_ETH_MAC_PORT_CTRL_t port_control;
XMC_GPIO_CONFIG_t gpio_config;
gpio_config.output_level = XMC_GPIO_OUTPUT_LEVEL_LOW;
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
/* Initialize GPIO pins. */
XMC_GPIO_Init(ETH_UIP_0_CRS_DV, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXER, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXD0, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXD1, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXEN, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXD0, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXD1, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RMII_CLK, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_MDC, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_MDIO, &gpio_config);
XMC_GPIO_SetHardwareControl(ETH_UIP_0_MDIO, XMC_GPIO_HWCTRL_PERIPHERAL1);
port_control.mode = XMC_ETH_MAC_PORT_CTRL_MODE_RMII;
port_control.rxd0 = (XMC_ETH_MAC_PORT_CTRL_RXD0_t)0U;
port_control.rxd1 = (XMC_ETH_MAC_PORT_CTRL_RXD1_t)0U;
port_control.clk_rmii = (XMC_ETH_MAC_PORT_CTRL_CLK_RMII_t)2U;
port_control.crs_dv = (XMC_ETH_MAC_PORT_CTRL_CRS_DV_t)2U;
port_control.rxer = (XMC_ETH_MAC_PORT_CTRL_RXER_t)0U;
port_control.mdio = (XMC_ETH_MAC_PORT_CTRL_MDIO_t)1U;
XMC_ETH_MAC_SetPortControl(&eth_mac, port_control);
}
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
blt_int32u ulLinkTimeOut;
(void)XMC_ETH_MAC_Init(&eth_mac);
XMC_ETH_MAC_DisableJumboFrame(&eth_mac);
/* Wait for link to become active. */
ulLinkTimeOut = TimerGet() + NETDEV_LINKUP_TIMEOUT_MS;
while (XMC_ETH_PHY_GetLinkStatus(&eth_mac, ETH_UIP_0_PHY_ADDR) == XMC_ETH_LINK_STATUS_DOWN)
{
/* Check for timeout so that the software program can still start if the ethernet
* cable is not connected.
*/
if (TimerGet() >= ulLinkTimeOut)
{
break;
}
/* Service the watchdog. */
CopService();
}
XMC_ETH_PHY_Init(&eth_mac, ETH_UIP_0_PHY_ADDR, &eth_phy_config);
XMC_ETH_MAC_SetLink(&eth_mac, XMC_ETH_LINK_SPEED_100M, XMC_ETH_LINK_DUPLEX_FULL);
XMC_ETH_MAC_EnableTx(&eth_mac);
XMC_ETH_MAC_EnableRx(&eth_mac);
/* set the default MAC address */
macAddress.addr[0] = NETDEV_DEFAULT_MACADDR0;
macAddress.addr[1] = NETDEV_DEFAULT_MACADDR1;
macAddress.addr[2] = NETDEV_DEFAULT_MACADDR2;
macAddress.addr[3] = NETDEV_DEFAULT_MACADDR3;
macAddress.addr[4] = NETDEV_DEFAULT_MACADDR4;
macAddress.addr[5] = NETDEV_DEFAULT_MACADDR5;
uip_setethaddr(macAddress);
}
/*---------------------------------------------------------------------------*/
void netdev_get_mac(unsigned char * mac_addr)
{
mac_addr[0] = NETDEV_DEFAULT_MACADDR0;
mac_addr[1] = NETDEV_DEFAULT_MACADDR1;
mac_addr[2] = NETDEV_DEFAULT_MACADDR2;
mac_addr[3] = NETDEV_DEFAULT_MACADDR3;
mac_addr[4] = NETDEV_DEFAULT_MACADDR4;
mac_addr[5] = NETDEV_DEFAULT_MACADDR5;
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{
blt_int32u result = 0;
blt_int32u framelen;
/* Check if a new frame was received. */
framelen = XMC_ETH_MAC_GetRxFrameSize(&eth_mac);
/* Only process the frame if the length is valid. */
if ((framelen > 0U) && (framelen <= (blt_int32u)XMC_ETH_MAC_BUF_SIZE))
{
XMC_ETH_MAC_ReadFrame(&eth_mac, uip_buf, framelen);
result = framelen;
}
/* Give the result back to the caller. */
return result;
}
/*---------------------------------------------------------------------------*/
void netdev_send(void)
{
uint8_t *buffer;
uint32_t idx;
/* Only send the frame if the length is valid. */
if ((uip_len > 0U) && (uip_len <= (blt_int32u)XMC_ETH_MAC_BUF_SIZE))
{
if (XMC_ETH_MAC_IsTxDescriptorOwnedByDma(&eth_mac))
{
XMC_ETH_MAC_ResumeTx(&eth_mac);
}
else
{
buffer = XMC_ETH_MAC_GetTxBuffer(&eth_mac);
for (idx = 0; idx < uip_len; idx++)
{
buffer[idx] = uip_buf[idx];
}
XMC_ETH_MAC_SetTxBufferSize(&eth_mac, uip_len);
/* Return the Tx descriptor but do not use the XMC_ETH_MAC_ReturnTxDescriptor().
* This function enables the 'checksum insertion control' feature by setting the
* ETH_MAC_DMA_TDES0_CIC in the eth_mac.tx_desc[eth_mac.tx_index].status. When
* this feature is enabled, an incorrect checksum of 0x0000 is always added to
* ICMP reponse messages such as the PING reply.
*/
eth_mac.tx_ts_index = eth_mac.tx_index;
eth_mac.tx_desc[eth_mac.tx_index].status |= ETH_MAC_DMA_TDES0_OWN;
eth_mac.tx_index++;
if (eth_mac.tx_index == eth_mac.num_tx_buf)
{
eth_mac.tx_index = 0U;
}
eth_mac.frame_end = NULL;
XMC_ETH_MAC_ResumeTx(&eth_mac);
}
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2001, Adam Dunkels.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Dunkels.
* 4. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: netdev.h,v 1.1 2002/01/10 06:22:56 adam Exp $
*
*/
#ifndef __NETDEV_H__
#define __NETDEV_H__
void netdev_init(void);
void netdev_init_mac(void);
void netdev_get_mac(unsigned char * mac_addr);
unsigned int netdev_read(void);
void netdev_send(void);
#endif /* __NETDEV_H__ */

View File

@ -0,0 +1,160 @@
/**
* \addtogroup uipopt
* @{
*/
/**
* \name Project-specific configuration options
* @{
*
* uIP has a number of configuration options that can be overridden
* for each project. These are kept in a project-specific uip-conf.h
* file and all configuration names have the prefix UIP_CONF.
*/
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: uip-conf.h,v 1.6 2006/06/12 08:00:31 adam Exp $
*/
/**
* \file
* An example uIP configuration file
* \author
* Adam Dunkels <adam@sics.se>
*/
#ifndef __UIP_CONF_H__
#define __UIP_CONF_H__
/**
* 8 bit datatype
*
* This typedef defines the 8-bit type used throughout uIP.
*
* \hideinitializer
*/
typedef unsigned char u8_t;
/**
* 16 bit datatype
*
* This typedef defines the 16-bit type used throughout uIP.
*
* \hideinitializer
*/
typedef unsigned short u16_t;
/**
* Statistics datatype
*
* This typedef defines the dataype used for keeping statistics in
* uIP.
*
* \hideinitializer
*/
typedef unsigned short uip_stats_t;
/**
* Maximum number of TCP connections.
*
* \hideinitializer
*/
#define UIP_CONF_MAX_CONNECTIONS 1
/**
* Maximum number of listening TCP ports.
*
* \hideinitializer
*/
#define UIP_CONF_MAX_LISTENPORTS 1
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 1
/**
* UDP Maximum Connections
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CONNS 1
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 0
/**
* uIP buffer size.
*
* \hideinitializer
*/
#define UIP_CONF_BUFFER_SIZE 1600
/**
* CPU byte order.
*
* \hideinitializer
*/
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
/**
* Logging on or off
*
* \hideinitializer
*/
#define UIP_CONF_LOGGING 0
/**
* uIP statistics on or off
*
* \hideinitializer
*/
#define UIP_CONF_STATISTICS 0
/* Here we include the header file for the application(s) we use in
our project. */
#include "boot.h"
#include "net.h"
#include "dhcpc.h"
#endif /* __UIP_CONF_H__ */
/** @} */
/** @} */

View File

@ -104,6 +104,62 @@
#define BOOT_COM_UART_CHANNEL_INDEX (0)
/* The NET communication interface for firmware updates via TCP/IP is selected by setting
* the BOOT_COM_NET_ENABLE configurable to 1. The maximum amount of data bytes in a
* message for data transmission and reception is set through BOOT_COM_NET_TX_MAX_DATA
* and BOOT_COM_NET_RX_MAX_DATA, respectively. The default IP address is configured
* with the macros BOOT_COM_NET_IPADDRx. The default netmask is configured with the
* macro BOOT_COM_NET_NETMASKx. The default gateway is configured with the macros
* BOOT_COM_NET_GATEWAYx. The bootloader acts and a TCP/IP server. The port the server
* listen on for connections is configured with BOOT_COM_NET_PORT.
* In case the network switch/router supports a DHCP server, you can set configuration
* macro BOOT_COM_NET_DHCP_ENABLE to 1 to enable the DHCP client. In this case the
* DHCP client handles the automatic IP address assignment. In this case the macros for
* configuring the IP address, network mask and gateway address are no longer needed.
*/
/** \brief Enable/disable the NET transport layer. */
#define BOOT_COM_NET_ENABLE (1)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_NET_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_NET_RX_MAX_DATA (64)
/** \brief Configure the port that the TCP/IP server listens on */
#define BOOT_COM_NET_PORT (1000)
/** \brief Enable/disable DHCP client for automatically obtaining an IP address. */
#define BOOT_COM_NET_DHCP_ENABLE (1)
/** \brief Configure the 1st byte of the IP address */
#define BOOT_COM_NET_IPADDR0 (192)
/** \brief Configure the 2nd byte of the IP address */
#define BOOT_COM_NET_IPADDR1 (168)
/** \brief Configure the 3rd byte of the IP address */
#define BOOT_COM_NET_IPADDR2 (178)
/** \brief Configure the 4th byte of the IP address */
#define BOOT_COM_NET_IPADDR3 (50)
/** \brief Configure the 1st byte of the network mask */
#define BOOT_COM_NET_NETMASK0 (255)
/** \brief Configure the 2nd byte of the network mask */
#define BOOT_COM_NET_NETMASK1 (255)
/** \brief Configure the 3rd byte of the network mask */
#define BOOT_COM_NET_NETMASK2 (255)
/** \brief Configure the 4th byte of the network mask */
#define BOOT_COM_NET_NETMASK3 (0)
/** \brief Configure the 1st byte of the gateway address */
#define BOOT_COM_NET_GATEWAY0 (192)
/** \brief Configure the 2nd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY1 (168)
/** \brief Configure the 3rd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY2 (178)
/** \brief Configure the 4th byte of the gateway address */
#define BOOT_COM_NET_GATEWAY3 (1)
/** \brief Enable/disable the deferred initialization mechanism. When enabled, the
* communication interface is only initialized when: (a) no valid user program
* is detected, or (b) when CpuUserProgramStartHook() returns BLT_FALSE. Your
* bootloader application can explicitly initialize the communication interface
* by calling ComDeferredInit().
*/
#define BOOT_COM_NET_DEFERRED_INIT_ENABLE (1)
/****************************************************************************************
* B A C K D O O R E N T R Y C O N F I G U R A T I O N
****************************************************************************************/

View File

@ -78,9 +78,6 @@ blt_bool BackDoorEntryHook(void)
****************************************************************************************/
blt_bool CpuUserProgramStartHook(void)
{
/* clean up the LED driver */
LedBlinkExit();
/* additional and optional backdoor entry through BUTTON1 on the board. to
* force the bootloader to stay active after reset, keep it pressed during reset.
*/
@ -92,6 +89,9 @@ blt_bool CpuUserProgramStartHook(void)
return BLT_FALSE;
}
/* clean up the LED driver */
LedBlinkExit();
/* okay to start the user program.*/
return BLT_TRUE;
} /*** end of CpuUserProgramStartHook ***/

View File

@ -65,16 +65,31 @@ no_init_size = 64;
MEMORY
{
FLASH_1_cached(RX) : ORIGIN = 0x08000000, LENGTH = 0x4000
FLASH_1_uncached(RX) : ORIGIN = 0x0C000000, LENGTH = 0x4000
PSRAM_1(!RX) : ORIGIN = 0x1FFE8000, LENGTH = 0x18000
FLASH_1_cached(RX) : ORIGIN = 0x08000000, LENGTH = 0x8000
FLASH_1_uncached(RX) : ORIGIN = 0x0C000000, LENGTH = 0x8000
PSRAM_1(!RX) : ORIGIN = 0x1FFE8040, LENGTH = 0x17fc0
DSRAM_1_system(!RX) : ORIGIN = 0x20000000, LENGTH = 0x20000
DSRAM_2_comm(!RX) : ORIGIN = 0x20020000, LENGTH = 0x20000
SRAM_combined(!RX) : ORIGIN = 0x1FFE8000, LENGTH = 0x58000
SRAM_combined(!RX) : ORIGIN = 0x1FFE8040, LENGTH = 0x57fc0
SHARED(!RX) : ORIGIN = 0x1FFE8000, LENGTH = 0x40
}
SECTIONS
{
/* Shared data section that also shouldn't get zeroed */
.shared (NOLOAD) :
{
. = ALIGN(4);
_sshared = .; /* define a global symbol at shared start */
__shared_start__ = _sshared;
*(.shared)
*(.shared.*)
KEEP(*(.shared))
. = ALIGN(4);
_eshared = .; /* define a global symbol at shared end */
__shared_end__ = _eshared;
} >SHARED
/* TEXT section */
.text :

View File

@ -33,6 +33,7 @@
#include "xmc_gpio.h" /* GPIO module */
#include "xmc_uart.h" /* UART driver header */
#include "xmc_can.h" /* CAN driver header */
#include "shared_params.h" /* Shared parameters header */
/****************************************************************************************
@ -50,10 +51,44 @@ static void PostInit(void);
****************************************************************************************/
int main(void)
{
blt_int8u deferredInitRequestFlag = 0;
/* initialize the microcontroller */
Init();
/* initialize the shared parameters module */
SharedParamsInit();
/* initialize the bootloader */
BootInit();
#if (BOOT_COM_DEFERRED_INIT_ENABLE == 1)
/* the bootloader is configured to NOT initialize the TCP/IP network stack by default
* to bypass unnecessary delay times before starting the user program. the TCP/IP net-
* work tack is now only initialized when: (a) no valid user program is detected, or
* (b) a forced backdoor entry occurred (CpuUserProgramStartHook() returned BLT_FALSE).
*
* these demo bootloader and user programs have one extra feature implemented for
* demonstration purposes. the demo user program can detect firmware update requests
* from the TCP/IP network in which case it activates the bootloader. But...the
* TCP/IP network stack will not be initialized in this situation. for this reason
* the shared parameter module was integrated in both the bootloader and user program.
* more information about the shared parameter module can be found here:
* https://www.feaser.com/en/blog/?p=216
*
* the shared parameter at the first index (0) contains a flag. this flag is set to
* 1, right before the user program activates this bootloader, to explicitly request
* the bootloader to initialize the TCP/IP network stack. this makes it possible for
* a firmware update to proceed. the code here reads out this flag and performs the
* TCP/IP network stack initialization when requested.
*/
SharedParamsReadByIndex(0, &deferredInitRequestFlag);
if (deferredInitRequestFlag == 1)
{
/* explicitly initialize all communication interface for which the deferred
* initialization feature was enabled.
*/
ComDeferredInit();
}
#endif
/* post initialization of the microcontroller */
PostInit();

View File

@ -0,0 +1,301 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_GCC/Boot/shared_params.c
* \brief Shared RAM parameters source file.
* \ingroup Boot_ARMCM4_XMC4_XMC4700_Relax_Kit_GCC
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2018 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
/****************************************************************************************
* Include files
****************************************************************************************/
#include <stddef.h> /* Standard definitions (NULL). */
#include "shared_params.h" /* Shared parameters header. */
/****************************************************************************************
* Macro definitions
****************************************************************************************/
/** \brief Constant parameter buffer identifier. This value is always located as the
* start of the buffer to validate the the RAM contains valid shared parameters.
*/
#define SHARED_PARAMS_BUFFER_ID (0xCE42E7A2u)
/****************************************************************************************
* Type definitions
****************************************************************************************/
/** \brief Layout of the shared parameters RAM buffer. */
typedef struct t_shared_params_buffer
{
/** \brief Fixed buffer identifier to validate that the RAM contains valid shared
* parameters.
*/
uint32_t identifier;
/** \brief Array for the actual parameter data. */
uint8_t data[SHARED_PARAMS_CFG_BUFFER_DATA_LEN];
/** \brief Checksum value of all the bytes in the buffer, excluding this checksum
* value of obvious reasons. The checksum is calculated as the Two's
* complement of the sum of the bytes.
*/
uint16_t checksum;
} tSharedParamsBuffer;
/****************************************************************************************
* Global data declarations
****************************************************************************************/
/** \brief Declaration of the actual parameter buffer that this module manages.
* \warning For the shared RAM parameters to work properly for sharing information
* between the bootloader and user program, it is important that this
* variable is linked to the exact same RAM address in both the bootloader
* and the user program. Additionally, it should be configured such that the
* C-startup code does NOT zero its contents during system initialization. This
* is the code that runs in the reset event handler, before function main() is
* called.
* For GCC based embedded toolchains, the solution is to assign this variable
* to a custom section, in this case called ".shared". Then in the linker
* script, add the following to the SECTIONS:
*
* .shared (NOLOAD) :
* {
* . = ALIGN(4);
* _sshared = .;
* __shared_start__ = _sshared;
* *(.shared)
* *(.shared.*)
* KEEP(*(.shared))
* . = ALIGN(4);
* _eshared = .;
* __shared_end__ = _eshared;
* } >SHARED
*
* Next, add a new MEMORY entry for SHARED at the start of RAM and reduce
* the length of the remaining RAM:
*
* SHARED (xrw) : ORIGIN = 0x200000C0, LENGTH = 64
* RAM (xrw) : ORIGIN = 0x20000100, LENGTH = 32K - 192 - 64
*
* Note that the previous example is for an STM32F0 microcontroller where
* the first 192 (0xC0) bytes in RAM are reserved for the user program
* vector table.
*
* \remark This same approach can be applied with other toolchains such as Keil MDK
* and IAR EWARM. Consult the compiler and linker user manuals of your
* toolchain to find out how to place a RAM variable at a fixed memory address
* and to prevent the C-startup code from zeroing its contents.
* Here are a few links to get you started:
* * IAR EWARM:
* https://www.iar.com/support/tech-notes/compiler/
* linker-error-for-absolute-located-variable/
* * Keil MDK:
* http://www.keil.com/support/docs/3480.htm
*/
static tSharedParamsBuffer sharedParamsBuffer __attribute__ ((section (".shared")));
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static bool SharedParamsValidateBuffer(void);
static void SharedParamsWriteChecksum(void);
static bool SharedParamsVerifyChecksum(void);
static uint16_t SharedParamsCalculateChecksum(void);
/************************************************************************************//**
** \brief Initializes the shared RAM parameters module.
** \return none.
**
****************************************************************************************/
void SharedParamsInit(void)
{
uint32_t byteIdx;
/* The shared parameter buffer does not get initialized by the C-startup code. Another
* previously running program could have initialized it, in which case it is ready
* for use and nothing more needs to be done.
*/
if (!SharedParamsValidateBuffer())
{
/* The shared parameter buffer was not yet initialized by a running program. This
* typically happens after a cold reset where the RAM contents were lost. In this
* case we need to explicitly configure and initialize it, since the C-startup code
* was configured to not do this.
*
* The initialization consists of setting the buffer identifier, zeroing the
* actual parameter data and updating the checksum at the end.
*/
sharedParamsBuffer.identifier = SHARED_PARAMS_BUFFER_ID;
for (byteIdx=0; byteIdx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN; byteIdx++)
{
sharedParamsBuffer.data[byteIdx] = 0;
}
SharedParamsWriteChecksum();
}
} /*** end of SharedParamsInit ***/
/************************************************************************************//**
** \brief Reads a data byte from the shared parameter buffer at the specified index.
** \param idx Index into the parameter data array. A valid value is between 0 and
** (SHARED_PARAMS_CFG_BUFFER_DATA_LEN - 1).
** \param value Pointer to where the read data value is stored.
** \return True if successful, false otherwise.
**
****************************************************************************************/
bool SharedParamsReadByIndex(uint32_t idx, uint8_t * value)
{
bool result = false;
/* Only continue if the buffer and the specified parameters are valid. */
if ( (SharedParamsValidateBuffer()) &&
(idx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN) &&
(value != NULL) )
{
/* Read the value and update the result. */
*value = sharedParamsBuffer.data[idx];
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsReadByIndex ***/
/************************************************************************************//**
** \brief Writes a data byte to the shared parameter buffer at the specified index.
** \param idx Index into the parameter data array. A valid value is between 0 and
** (SHARED_PARAMS_CFG_BUFFER_DATA_LEN - 1).
** \param value Value to write.
** \return True if successful, false otherwise.
**
****************************************************************************************/
bool SharedParamsWriteByIndex(uint32_t idx, uint8_t value)
{
bool result = false;
/* Only continue if the buffer and the specified parameters are valid. */
if ( (SharedParamsValidateBuffer()) &&
(idx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN) )
{
/* Write the value. */
sharedParamsBuffer.data[idx] = value;
/* Update the checksum since the contents were just changed. */
SharedParamsWriteChecksum();
/* Update the result. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsWriteByIndex ***/
/************************************************************************************//**
** \brief Validates the shared parameter buffer contents by looking at the table
** identifier and verifying its checksum.
** \return True if successful, false otherwise.
**
****************************************************************************************/
static bool SharedParamsValidateBuffer(void)
{
bool result = false;
/* Perform validation. */
if ( (sharedParamsBuffer.identifier == SHARED_PARAMS_BUFFER_ID) &&
(SharedParamsVerifyChecksum()) )
{
/* The shared parameter buffer is valid, so update the result value. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsValitabeTable ***/
/************************************************************************************//**
** \brief Calculates and writes the checksum into the buffer.
** \return none.
**
****************************************************************************************/
static void SharedParamsWriteChecksum(void)
{
/* Calculate and write the checksum. */
sharedParamsBuffer.checksum = SharedParamsCalculateChecksum();
} /*** end of SharedParamsWriteChecksum ***/
/************************************************************************************//**
** \brief Calculates and verifies the checksum that is currently present in the
** buffer.
** \return True is the checksum is correct, false otherwise.
**
****************************************************************************************/
static bool SharedParamsVerifyChecksum(void)
{
bool result = false;
/* Calculate and verify the checksum. */
if (SharedParamsCalculateChecksum() == sharedParamsBuffer.checksum)
{
/* Checksum is correct, so update the result value. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsVerifyChecksum ***/
/************************************************************************************//**
** \brief Calculates and returns the checksum value for the current contents in the
** buffer. The checksum is calculated by taking the sum of all bytes in the
** parameter buffer (excluding the checksum at the end) and them taking the
** two's complement value of it.
** \return The calculated checksum value.
**
****************************************************************************************/
static uint16_t SharedParamsCalculateChecksum(void)
{
uint16_t result = 0;
uint32_t byteIdx;
/* Add the identifier bytes to the checksum. */
result += (uint8_t)sharedParamsBuffer.identifier;
result += (uint8_t)(sharedParamsBuffer.identifier >> 8u);
result += (uint8_t)(sharedParamsBuffer.identifier >> 16u);
result += (uint8_t)(sharedParamsBuffer.identifier >> 24u);
/* Loop through the parameter data array. */
for (byteIdx=0; byteIdx<SHARED_PARAMS_CFG_BUFFER_DATA_LEN; byteIdx++)
{
/* Add parameter data byte to the checksum. */
result += (uint8_t)sharedParamsBuffer.data[byteIdx];
}
/* Determine one's complement. */
result = ~result;
/* Determine two's complement. */
result += 1;
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsCalculateChecksum ***/
/*********************************** end of shared_params.c ****************************/

View File

@ -0,0 +1,57 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_GCC/Boot/shared_params.h
* \brief Shared RAM parameters header file.
* \ingroup Boot_ARMCM4_XMC4_XMC4700_Relax_Kit_GCC
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2018 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
#ifndef SHARED_PARAMS_H
#define SHARED_PARAMS_H
/****************************************************************************************
* Include files
****************************************************************************************/
#include <stdint.h> /* Standard integer types. */
#include <stdbool.h> /* Standard boolean types. */
/****************************************************************************************
* Configuration macros
****************************************************************************************/
/** \brief Configuration macro for specifying the size of the data inside the parameter
* buffer. This is the length in bytes of the actual parameter data, so
* excluding the bufferId and checksum.
*/
#define SHARED_PARAMS_CFG_BUFFER_DATA_LEN (56u)
/****************************************************************************************
* Function prototypes
****************************************************************************************/
void SharedParamsInit(void);
bool SharedParamsReadByIndex(uint32_t idx, uint8_t * value);
bool SharedParamsWriteByIndex(uint32_t idx, uint8_t value);
#endif /* SHARED_PARAMS_H */
/*********************************** end of shared_params.h ****************************/

View File

@ -119,9 +119,13 @@
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Libraries/CMSIS/Infineon/XMC4700_series/Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Libraries&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Libraries/uip&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../../../Source/third_party/uip/uip&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/../../../Source/third_party/uip/apps/dhcpc&quot;"/>
</option>
<option id="org.eclipse.cdt.cross.arm.gnu.c.compiler.option.preprocessor.def.183730939" name="Defined symbols (-D)" superClass="org.eclipse.cdt.cross.arm.gnu.c.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="XMC4700_F144x2048"/>
<listOptionValue builtIn="false" value="XMC_ETH_PHY_KSZ8081RNB"/>
</option>
<inputType id="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.c.compiler.base.input.654750255" superClass="org.eclipse.cdt.cross.arm.gnu.sourcery.windows.c.compiler.base.input"/>
</tool>
@ -138,7 +142,7 @@
</tool>
<tool id="com.ifx.xmc4000.appDebug.assembler.1025953132" name="ARM-GCC Assembler" superClass="com.ifx.xmc4000.appDebug.assembler">
<option id="com.ifx.xmc4000.assembler.option.misc.mfloat.1260066885" name="Floating point" superClass="com.ifx.xmc4000.assembler.option.misc.mfloat" value="org.eclipse.cdt.cross.arm.gnu.base.option.other.mfloat.softfp" valueType="enumerated"/>
<option id="com.ifx.xmc4000.assembler.option.include.paths.484200460" name="Include paths (-I)" superClass="com.ifx.xmc4000.assembler.option.include.paths" valueType="includePath"/>
<option id="com.ifx.xmc4000.assembler.option.include.paths.484200460" name="Include paths (-I)" superClass="com.ifx.xmc4000.assembler.option.include.paths"/>
<option id="org.eclipse.cdt.cross.arm.gnu.assembler.option.preprocessor.def.617790470" name="Defined symbols (-D)" superClass="org.eclipse.cdt.cross.arm.gnu.assembler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="XMC4700_F144x2048"/>
</option>

View File

@ -25,4 +25,82 @@
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>uip</name>
<type>2</type>
<locationURI>UIP_ROOT</locationURI>
</link>
</linkedResources>
<filteredResources>
<filter>
<id>1534521832743</id>
<name>uip</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-uip</arguments>
</matcher>
</filter>
<filter>
<id>1534521832758</id>
<name>uip</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-apps</arguments>
</matcher>
</filter>
<filter>
<id>1534521862395</id>
<name>uip/apps</name>
<type>9</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-dhcpc</arguments>
</matcher>
</filter>
<filter>
<id>1534521922685</id>
<name>uip/uip</name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-psock.*</arguments>
</matcher>
</filter>
<filter>
<id>1534521922701</id>
<name>uip/uip</name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-uip-fw.c</arguments>
</matcher>
</filter>
<filter>
<id>1534521922701</id>
<name>uip/uip</name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-uip-neighbor.c</arguments>
</matcher>
</filter>
<filter>
<id>1534521922716</id>
<name>uip/uip</name>
<type>6</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-uip-split.c</arguments>
</matcher>
</filter>
</filteredResources>
<variableList>
<variable>
<name>UIP_ROOT</name>
<value>$%7BPARENT-3-PROJECT_LOC%7D/Source/third_party/uip</value>
</variable>
</variableList>
</projectDescription>

View File

@ -4,7 +4,7 @@
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1684938055939234381" id="com.ifx.xmc4000.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings XMC" parameter="${COMMAND} ${FLAGS} -E -P -v -dM &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1737998430419022637" id="com.ifx.xmc4000.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings XMC" parameter="${COMMAND} ${FLAGS} -E -P -v -dM &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -14,7 +14,7 @@
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1684938055939234381" id="com.ifx.xmc4000.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings XMC" parameter="${COMMAND} ${FLAGS} -E -P -v -dM &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1737998430419022637" id="com.ifx.xmc4000.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings XMC" parameter="${COMMAND} ${FLAGS} -E -P -v -dM &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<com.ifx.xmc4000.appDebug_memory>
<details IMemento.internal.id="0" enable="Yes" endAddress="0x081FFFFF" memModelType="ROM" modelName="FLASH 1 (cached)" startAddress="0x08004000"/>
<details IMemento.internal.id="1" enable="Yes" endAddress="0x0C1FFFFF" memModelType="ROM" modelName="FLASH 1 (uncached)" startAddress="0x0C004000"/>
<details IMemento.internal.id="2" enable="Yes" endAddress="0x1FFFFFFF" memModelType="RAM" modelName="PSRAM 1" startAddress="0x1FFE8000"/>
<details IMemento.internal.id="0" enable="Yes" endAddress="0x081FFFFF" memModelType="ROM" modelName="FLASH 1 (cached)" startAddress="0x08008000"/>
<details IMemento.internal.id="1" enable="Yes" endAddress="0x0C1FFFFF" memModelType="ROM" modelName="FLASH 1 (uncached)" startAddress="0x0C008000"/>
<details IMemento.internal.id="2" enable="Yes" endAddress="0x1FFFFFFF" memModelType="RAM" modelName="PSRAM 1" startAddress="0x1FFE8040"/>
<details IMemento.internal.id="3" enable="Yes" endAddress="0x2001FFFF" memModelType="RAM" modelName="DSRAM 1 (system)" startAddress="0x20000000"/>
<details IMemento.internal.id="4" enable="Yes" endAddress="0x2003FFFF" memModelType="RAM" modelName="DSRAM 2 (comm)" startAddress="0x20020000"/>
<details IMemento.internal.id="5" enable="Yes" endAddress="0x2003FFFF" memModelType="RAM" modelName="SRAM (combined)" startAddress="0x1FFE8000"/>
<details IMemento.internal.id="5" enable="Yes" endAddress="0x2003FFFF" memModelType="RAM" modelName="SRAM (combined)" startAddress="0x1FFE8040"/>
<details IMemento.internal.id="6" enable="Yes" endAddress="0x1FFE803F" memModelType="RAM" modelName="SHARED" startAddress="0x1FFE8000"/>
</com.ifx.xmc4000.appDebug_memory>

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: clock-arch.c,v 1.2 2006/06/12 08:00:31 adam Exp $
*/
/**
* \file
* Implementation of architecture-specific clock functionality
* \author
* Adam Dunkels <adam@sics.se>
*/
#include "header.h" /* generic header */
#include "clock-arch.h"
/*---------------------------------------------------------------------------*/
clock_time_t
clock_time(void)
{
return (clock_time_t)TimerGet();
}
/*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: clock-arch.h,v 1.2 2006/06/12 08:00:31 adam Exp $
*/
#ifndef __CLOCK_ARCH_H__
#define __CLOCK_ARCH_H__
typedef int clock_time_t;
#define CLOCK_CONF_SECOND 1000
#endif /* __CLOCK_ARCH_H__ */

View File

@ -0,0 +1,296 @@
/*
* Copyright (c) 2001, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: netdev.c,v 1.8 2006/06/07 08:39:58 adam Exp $
*/
/*---------------------------------------------------------------------------*/
#include "header.h" /* generic header */
#include "uip.h"
#include "uip_arp.h"
#include "xmc_gpio.h"
#include "xmc_eth_mac.h"
#include "xmc_eth_phy.h"
#include <string.h>
/*---------------------------------------------------------------------------*/
#define NETDEV_LINKUP_TIMEOUT_MS (5000)
#define NETDEV_DEFAULT_MACADDR0 (0x08)
#define NETDEV_DEFAULT_MACADDR1 (0x00)
#define NETDEV_DEFAULT_MACADDR2 (0x27)
#define NETDEV_DEFAULT_MACADDR3 (0x69)
#define NETDEV_DEFAULT_MACADDR4 (0x5B)
#define NETDEV_DEFAULT_MACADDR5 (0x45)
#define NETDEV_DEFAULT_MACADDR ((uint64_t)NETDEV_DEFAULT_MACADDR0 | \
((uint64_t)NETDEV_DEFAULT_MACADDR1 << 8) | \
((uint64_t)NETDEV_DEFAULT_MACADDR2 << 16) | \
((uint64_t)NETDEV_DEFAULT_MACADDR3 << 24) | \
((uint64_t)NETDEV_DEFAULT_MACADDR4 << 32) | \
((uint64_t)NETDEV_DEFAULT_MACADDR5 << 40))
#define ETH_UIP_0_NUM_RX_BUF (4U)
#define ETH_UIP_0_NUM_TX_BUF (4U)
#define ETH_UIP_0_CRS_DV XMC_GPIO_PORT15, 9U
#define ETH_UIP_0_RXER XMC_GPIO_PORT2, 4U
#define ETH_UIP_0_RXD0 XMC_GPIO_PORT2, 2U
#define ETH_UIP_0_RXD1 XMC_GPIO_PORT2, 3U
#define ETH_UIP_0_TXEN XMC_GPIO_PORT2, 5U
#define ETH_UIP_0_TXD0 XMC_GPIO_PORT2, 8U
#define ETH_UIP_0_TXD1 XMC_GPIO_PORT2, 9U
#define ETH_UIP_0_RMII_CLK XMC_GPIO_PORT15, 8U
#define ETH_UIP_0_MDC XMC_GPIO_PORT2, 7U
#define ETH_UIP_0_MDIO XMC_GPIO_PORT2, 0U
#define ETH_UIP_0_PIN_LIST_SIZE (10U)
#define ETH_UIP_0_PHY_ADDR (0)
/*---------------------------------------------------------------------------*/
#if defined(__ICCARM__)
#pragma data_alignment=4
static XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] @ ".iram2";
#pragma data_alignment=4
static XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] @ ".iram2";
#pragma data_alignment=4
static uint8_t ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] @ ".iram2";
#pragma data_alignment=4
static uint8_t ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] @ ".iram2";
#elif defined(__CC_ARM)
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("RW_IRAM1")));
#elif defined(__GNUC__)
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("ETH_RAM")));
#else
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF];
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF];
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE];
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE];
#endif
const XMC_ETH_PHY_CONFIG_t eth_phy_config =
{
.interface = XMC_ETH_LINK_INTERFACE_RMII,
.enable_auto_negotiate = false,
.duplex = XMC_ETH_LINK_DUPLEX_FULL,
.speed = XMC_ETH_LINK_SPEED_100M
};
XMC_ETH_MAC_t eth_mac =
{
.regs = ETH0,
.address = NETDEV_DEFAULT_MACADDR,
.rx_desc = ETH_UIP_0_rx_desc,
.tx_desc = ETH_UIP_0_tx_desc,
.rx_buf = &ETH_UIP_0_rx_buf[0][0],
.tx_buf = &ETH_UIP_0_tx_buf[0][0],
.num_rx_buf = ETH_UIP_0_NUM_RX_BUF,
.num_tx_buf = ETH_UIP_0_NUM_TX_BUF
};
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
XMC_ETH_MAC_PORT_CTRL_t port_control;
XMC_GPIO_CONFIG_t gpio_config;
gpio_config.output_level = XMC_GPIO_OUTPUT_LEVEL_LOW;
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
/* Initialize GPIO pins. */
XMC_GPIO_Init(ETH_UIP_0_CRS_DV, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXER, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXD0, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXD1, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXEN, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXD0, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXD1, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RMII_CLK, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_MDC, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_MDIO, &gpio_config);
XMC_GPIO_SetHardwareControl(ETH_UIP_0_MDIO, XMC_GPIO_HWCTRL_PERIPHERAL1);
port_control.mode = XMC_ETH_MAC_PORT_CTRL_MODE_RMII;
port_control.rxd0 = (XMC_ETH_MAC_PORT_CTRL_RXD0_t)0U;
port_control.rxd1 = (XMC_ETH_MAC_PORT_CTRL_RXD1_t)0U;
port_control.clk_rmii = (XMC_ETH_MAC_PORT_CTRL_CLK_RMII_t)2U;
port_control.crs_dv = (XMC_ETH_MAC_PORT_CTRL_CRS_DV_t)2U;
port_control.rxer = (XMC_ETH_MAC_PORT_CTRL_RXER_t)0U;
port_control.mdio = (XMC_ETH_MAC_PORT_CTRL_MDIO_t)1U;
XMC_ETH_MAC_SetPortControl(&eth_mac, port_control);
}
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
uint32_t ulLinkTimeOut;
(void)XMC_ETH_MAC_Init(&eth_mac);
XMC_ETH_MAC_DisableJumboFrame(&eth_mac);
/* Wait for link to become active. */
ulLinkTimeOut = TimerGet() + NETDEV_LINKUP_TIMEOUT_MS;
while (XMC_ETH_PHY_GetLinkStatus(&eth_mac, ETH_UIP_0_PHY_ADDR) == XMC_ETH_LINK_STATUS_DOWN)
{
/* Check for timeout so that the software program can still start if the ethernet
* cable is not connected.
*/
if (TimerGet() >= ulLinkTimeOut)
{
break;
}
}
XMC_ETH_PHY_Init(&eth_mac, ETH_UIP_0_PHY_ADDR, &eth_phy_config);
XMC_ETH_MAC_SetLink(&eth_mac, XMC_ETH_LINK_SPEED_100M, XMC_ETH_LINK_DUPLEX_FULL);
XMC_ETH_MAC_EnableTx(&eth_mac);
XMC_ETH_MAC_EnableRx(&eth_mac);
/* set the default MAC address */
macAddress.addr[0] = NETDEV_DEFAULT_MACADDR0;
macAddress.addr[1] = NETDEV_DEFAULT_MACADDR1;
macAddress.addr[2] = NETDEV_DEFAULT_MACADDR2;
macAddress.addr[3] = NETDEV_DEFAULT_MACADDR3;
macAddress.addr[4] = NETDEV_DEFAULT_MACADDR4;
macAddress.addr[5] = NETDEV_DEFAULT_MACADDR5;
uip_setethaddr(macAddress);
}
/*---------------------------------------------------------------------------*/
void netdev_get_mac(unsigned char * mac_addr)
{
mac_addr[0] = NETDEV_DEFAULT_MACADDR0;
mac_addr[1] = NETDEV_DEFAULT_MACADDR1;
mac_addr[2] = NETDEV_DEFAULT_MACADDR2;
mac_addr[3] = NETDEV_DEFAULT_MACADDR3;
mac_addr[4] = NETDEV_DEFAULT_MACADDR4;
mac_addr[5] = NETDEV_DEFAULT_MACADDR5;
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{
uint32_t result = 0;
uint32_t framelen;
/* Check if a new frame was received. */
framelen = XMC_ETH_MAC_GetRxFrameSize(&eth_mac);
/* Only process the frame if the length is valid. */
if ((framelen > 0U) && (framelen <= (uint32_t)XMC_ETH_MAC_BUF_SIZE))
{
XMC_ETH_MAC_ReadFrame(&eth_mac, uip_buf, framelen);
result = framelen;
}
/* Give the result back to the caller. */
return result;
}
/*---------------------------------------------------------------------------*/
void netdev_send(void)
{
uint8_t *buffer;
uint32_t idx;
/* Only send the frame if the length is valid. */
if ((uip_len > 0U) && (uip_len <= (uint32_t)XMC_ETH_MAC_BUF_SIZE))
{
if (XMC_ETH_MAC_IsTxDescriptorOwnedByDma(&eth_mac))
{
XMC_ETH_MAC_ResumeTx(&eth_mac);
}
else
{
buffer = XMC_ETH_MAC_GetTxBuffer(&eth_mac);
for (idx = 0; idx < uip_len; idx++)
{
buffer[idx] = uip_buf[idx];
}
XMC_ETH_MAC_SetTxBufferSize(&eth_mac, uip_len);
/* Return the Tx descriptor but do not use the XMC_ETH_MAC_ReturnTxDescriptor().
* This function enables the 'checksum insertion control' feature by setting the
* ETH_MAC_DMA_TDES0_CIC in the eth_mac.tx_desc[eth_mac.tx_index].status. When
* this feature is enabled, an incorrect checksum of 0x0000 is always added to
* ICMP reponse messages such as the PING reply.
*/
eth_mac.tx_ts_index = eth_mac.tx_index;
eth_mac.tx_desc[eth_mac.tx_index].status |= ETH_MAC_DMA_TDES0_OWN;
eth_mac.tx_index++;
if (eth_mac.tx_index == eth_mac.num_tx_buf)
{
eth_mac.tx_index = 0U;
}
eth_mac.frame_end = NULL;
XMC_ETH_MAC_ResumeTx(&eth_mac);
}
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2001, Adam Dunkels.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Dunkels.
* 4. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: netdev.h,v 1.1 2002/01/10 06:22:56 adam Exp $
*
*/
#ifndef __NETDEV_H__
#define __NETDEV_H__
void netdev_init(void);
void netdev_init_mac(void);
void netdev_get_mac(unsigned char * mac_addr);
unsigned int netdev_read(void);
void netdev_send(void);
#endif /* __NETDEV_H__ */

View File

@ -0,0 +1,160 @@
/**
* \addtogroup uipopt
* @{
*/
/**
* \name Project-specific configuration options
* @{
*
* uIP has a number of configuration options that can be overridden
* for each project. These are kept in a project-specific uip-conf.h
* file and all configuration names have the prefix UIP_CONF.
*/
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: uip-conf.h,v 1.6 2006/06/12 08:00:31 adam Exp $
*/
/**
* \file
* An example uIP configuration file
* \author
* Adam Dunkels <adam@sics.se>
*/
#ifndef __UIP_CONF_H__
#define __UIP_CONF_H__
/**
* 8 bit datatype
*
* This typedef defines the 8-bit type used throughout uIP.
*
* \hideinitializer
*/
typedef unsigned char u8_t;
/**
* 16 bit datatype
*
* This typedef defines the 16-bit type used throughout uIP.
*
* \hideinitializer
*/
typedef unsigned short u16_t;
/**
* Statistics datatype
*
* This typedef defines the dataype used for keeping statistics in
* uIP.
*
* \hideinitializer
*/
typedef unsigned short uip_stats_t;
/**
* Maximum number of TCP connections.
*
* \hideinitializer
*/
#define UIP_CONF_MAX_CONNECTIONS 1
/**
* Maximum number of listening TCP ports.
*
* \hideinitializer
*/
#define UIP_CONF_MAX_LISTENPORTS 1
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 1
/**
* UDP Maximum Connections
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CONNS 1
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 0
/**
* uIP buffer size.
*
* \hideinitializer
*/
#define UIP_CONF_BUFFER_SIZE 1600
/**
* CPU byte order.
*
* \hideinitializer
*/
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
/**
* Logging on or off
*
* \hideinitializer
*/
#define UIP_CONF_LOGGING 0
/**
* uIP statistics on or off
*
* \hideinitializer
*/
#define UIP_CONF_STATISTICS 0
/* Here we include the header file for the application(s) we use in
our project. */
#include "header.h"
#include "net.h"
#include "dhcpc.h"
#endif /* __UIP_CONF_H__ */
/** @} */
/** @} */

View File

@ -36,6 +36,8 @@
#include "boot.h" /* bootloader interface driver */
#include "led.h" /* LED driver */
#include "timer.h" /* Timer driver */
#include "net.h" /* TCP/IP server application */
#include "shared_params.h" /* Shared parameters header. */
#endif /* HEADER_H */

View File

@ -65,16 +65,31 @@ no_init_size = 64;
MEMORY
{
FLASH_1_cached(RX) : ORIGIN = 0x08004000, LENGTH = 0x1fc000
FLASH_1_uncached(RX) : ORIGIN = 0x0C004000, LENGTH = 0x1fc000
PSRAM_1(!RX) : ORIGIN = 0x1FFE8000, LENGTH = 0x18000
FLASH_1_cached(RX) : ORIGIN = 0x08008000, LENGTH = 0x1f8000
FLASH_1_uncached(RX) : ORIGIN = 0x0C008000, LENGTH = 0x1f8000
PSRAM_1(!RX) : ORIGIN = 0x1FFE8040, LENGTH = 0x17fc0
DSRAM_1_system(!RX) : ORIGIN = 0x20000000, LENGTH = 0x20000
DSRAM_2_comm(!RX) : ORIGIN = 0x20020000, LENGTH = 0x20000
SRAM_combined(!RX) : ORIGIN = 0x1FFE8000, LENGTH = 0x58000
SRAM_combined(!RX) : ORIGIN = 0x1FFE8040, LENGTH = 0x57fc0
SHARED(!RX) : ORIGIN = 0x1FFE8000, LENGTH = 0x40
}
SECTIONS
{
/* Shared data section that also shouldn't get zeroed */
.shared (NOLOAD) :
{
. = ALIGN(4);
_sshared = .; /* define a global symbol at shared start */
__shared_start__ = _sshared;
*(.shared)
*(.shared.*)
KEEP(*(.shared))
. = ALIGN(4);
_eshared = .; /* define a global symbol at shared end */
__shared_end__ = _eshared;
} >SHARED
/* TEXT section */
.text :

View File

@ -48,14 +48,25 @@ int main(void)
{
/* initialize the microcontroller */
Init();
/* initialize the shared parameters module */
SharedParamsInit();
/* initialize the network application */
NetInit();
/* initialize the bootloader interface */
BootComInit();
/* the shared parameter at index 0 is used as a boolean flag to indicate if the
* bootloader should initialize the TCP/IP network stack. by default this flag
* should be reset.
*/
SharedParamsWriteByIndex(0, 0);
/* start the infinite program loop */
while (1)
{
/* toggle LED with a fixed frequency */
LedToggle();
/* run the network task */
NetTask();
/* check for bootloader activation request */
BootComCheckActivationRequest();
}

View File

@ -0,0 +1,253 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_GCC/Prog/net.c
* \brief Network application for the uIP TCP/IP stack.
* \ingroup Prog_ARMCM4_XMC4_XMC4700_Relax_Kit_GCC
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2014 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
/****************************************************************************************
* Include files
****************************************************************************************/
#include "header.h" /* generic header */
#include "netdev.h"
#include "uip.h"
#include "uip_arp.h"
/****************************************************************************************
* Macro definitions
****************************************************************************************/
/** \brief Delta time for the uIP periodic timer. */
#define NET_UIP_PERIODIC_TIMER_MS (500)
/** \brief Delta time for the uIP ARP timer. */
#define NET_UIP_ARP_TIMER_MS (10000)
/** \brief Macro for accessing the Ethernet header information in the buffer */
#define NET_UIP_HEADER_BUF ((struct uip_eth_hdr *)&uip_buf[0])
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief Holds the time out value of the uIP periodic timer. */
static unsigned long periodicTimerTimeOut;
/** \brief Holds the time out value of the uIP ARP timer. */
static unsigned long ARPTimerTimeOut;
#if (BOOT_COM_NET_DHCP_ENABLE > 0)
/** \brief Holds the MAC address which is used by the DHCP client. */
static struct uip_eth_addr macAddress;
#endif
/************************************************************************************//**
** \brief Initializes the TCP/IP network communication interface.
** \return none.
**
****************************************************************************************/
void NetInit(void)
{
uip_ipaddr_t ipaddr;
/* initialize the network device */
netdev_init();
/* initialize the timer variables */
periodicTimerTimeOut = TimerGet() + NET_UIP_PERIODIC_TIMER_MS;
ARPTimerTimeOut = TimerGet() + NET_UIP_ARP_TIMER_MS;
/* initialize the uIP TCP/IP stack. */
uip_init();
#if (BOOT_COM_NET_DHCP_ENABLE == 0)
/* set the IP address */
uip_ipaddr(ipaddr, BOOT_COM_NET_IPADDR0, BOOT_COM_NET_IPADDR1, BOOT_COM_NET_IPADDR2,
BOOT_COM_NET_IPADDR3);
uip_sethostaddr(ipaddr);
/* set the network mask */
uip_ipaddr(ipaddr, BOOT_COM_NET_NETMASK0, BOOT_COM_NET_NETMASK1, BOOT_COM_NET_NETMASK2,
BOOT_COM_NET_NETMASK3);
uip_setnetmask(ipaddr);
/* set the gateway address */
uip_ipaddr(ipaddr, BOOT_COM_NET_GATEWAY0, BOOT_COM_NET_GATEWAY1, BOOT_COM_NET_GATEWAY2,
BOOT_COM_NET_GATEWAY3);
uip_setdraddr(ipaddr);
#else
/* set the IP address */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_sethostaddr(ipaddr);
/* set the network mask */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_setnetmask(ipaddr);
/* set the gateway address */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_setdraddr(ipaddr);
#endif
/* start listening on the configured port for XCP transfers on TCP/IP */
uip_listen(HTONS(BOOT_COM_NET_PORT));
/* initialize the MAC and set the MAC address */
netdev_init_mac();
#if (BOOT_COM_NET_DHCP_ENABLE > 0)
/* initialize the DHCP client application and send the initial request. */
netdev_get_mac(&macAddress.addr[0]);
dhcpc_init(&macAddress.addr[0], 6);
dhcpc_request();
#endif
} /*** end of NetInit ***/
/************************************************************************************//**
** \brief The uIP network application that detects the XCP connect command on the
** port used by the bootloader. This indicates that the bootloader should
** be activated.
** \return none.
**
****************************************************************************************/
void NetApp(void)
{
unsigned char *newDataPtr;
if (uip_connected())
{
return;
}
if (uip_newdata())
{
/* a new XCP command was received. check if this is the connect command and in this
* case activate the bootloader. with XCP on TCP/IP the first 4 bytes contain a
* counter value in which we are not really interested.
*/
newDataPtr = uip_appdata;
newDataPtr += 4;
/* check if this was an XCP CONNECT command */
if ((newDataPtr[0] == 0xff) && (newDataPtr[1] == 0x00))
{
/* the shared parameter at index 0 is used as a boolean flag to indicate if the
* bootloader should initialize the TCP/IP network stack. we just received a
* firmware update request from the TCP/IP network and we are about to active
* the bootloader for a firmware update via TCP/IP. At this point we should
* set the flag to make sure the bootloader initializes its TCP/IP network stack.
*/
SharedParamsWriteByIndex(0, 1);
/* connection request received so start the bootloader */
BootActivate();
}
}
} /*** end of NetApp ***/
/************************************************************************************//**
** \brief Runs the TCP/IP server task.
** \return none.
**
****************************************************************************************/
void NetTask(void)
{
unsigned long connection;
unsigned long packetLen;
/* check for an RX packet and read it. */
packetLen = netdev_read();
if (packetLen > 0)
{
/* set uip_len for uIP stack usage */
uip_len = (unsigned short)packetLen;
/* process incoming IP packets here. */
if (NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_IP))
{
uip_arp_ipin();
uip_input();
/* if the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if (uip_len > 0)
{
uip_arp_out();
netdev_send();
uip_len = 0;
}
}
/* process incoming ARP packets here. */
else if (NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_ARP))
{
uip_arp_arpin();
/* if the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if (uip_len > 0)
{
netdev_send();
uip_len = 0;
}
}
}
/* process TCP/IP Periodic Timer here. */
if (TimerGet() >= periodicTimerTimeOut)
{
periodicTimerTimeOut += NET_UIP_PERIODIC_TIMER_MS;
for (connection = 0; connection < UIP_CONNS; connection++)
{
uip_periodic(connection);
/* If the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if (uip_len > 0)
{
uip_arp_out();
netdev_send();
uip_len = 0;
}
}
#if UIP_UDP
for (connection = 0; connection < UIP_UDP_CONNS; connection++)
{
uip_udp_periodic(connection);
/* If the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if(uip_len > 0)
{
uip_arp_out();
netdev_send();
uip_len = 0;
}
}
#endif
}
/* process ARP Timer here. */
if (TimerGet() >= ARPTimerTimeOut)
{
ARPTimerTimeOut += NET_UIP_ARP_TIMER_MS;
uip_arp_timer();
}
} /*** end of NetServerTask ***/
/*********************************** end of net.c **************************************/

View File

@ -0,0 +1,61 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_GCC/Prog/net.h
* \brief Network application for the uIP TCP/IP stack.
* \ingroup Prog_ARMCM4_XMC4_XMC4700_Relax_Kit_GCC
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2014 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
#ifndef NET_H
#define NET_H
/****************************************************************************************
* Macro definitions
****************************************************************************************/
#ifndef UIP_APPCALL
#define UIP_APPCALL NetApp
#endif /* UIP_APPCALL */
/****************************************************************************************
* Type definitions
****************************************************************************************/
/** \brief Define the uip_tcp_appstate_t datatype. This is the state of our tcp/ip
* application, and the memory required for this state is allocated together
* with each TCP connection. One application state for each TCP connection.
*/
typedef struct net_state
{
unsigned char unused;
} uip_tcp_appstate_t;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
void NetInit(void);
void NetApp(void);
void NetTask(void);
#endif /* NET_H */
/*********************************** end of net.h **************************************/

View File

@ -0,0 +1,301 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_GCC/Prog/shared_params.c
* \brief Shared RAM parameters source file.
* \ingroup Prog_ARMCM4_XMC4_XMC4700_Relax_Kit_GCC
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2018 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
/****************************************************************************************
* Include files
****************************************************************************************/
#include <stddef.h> /* Standard definitions (NULL). */
#include "shared_params.h" /* Shared parameters header. */
/****************************************************************************************
* Macro definitions
****************************************************************************************/
/** \brief Constant parameter buffer identifier. This value is always located as the
* start of the buffer to validate the the RAM contains valid shared parameters.
*/
#define SHARED_PARAMS_BUFFER_ID (0xCE42E7A2u)
/****************************************************************************************
* Type definitions
****************************************************************************************/
/** \brief Layout of the shared parameters RAM buffer. */
typedef struct t_shared_params_buffer
{
/** \brief Fixed buffer identifier to validate that the RAM contains valid shared
* parameters.
*/
uint32_t identifier;
/** \brief Array for the actual parameter data. */
uint8_t data[SHARED_PARAMS_CFG_BUFFER_DATA_LEN];
/** \brief Checksum value of all the bytes in the buffer, excluding this checksum
* value of obvious reasons. The checksum is calculated as the Two's
* complement of the sum of the bytes.
*/
uint16_t checksum;
} tSharedParamsBuffer;
/****************************************************************************************
* Global data declarations
****************************************************************************************/
/** \brief Declaration of the actual parameter buffer that this module manages.
* \warning For the shared RAM parameters to work properly for sharing information
* between the bootloader and user program, it is important that this
* variable is linked to the exact same RAM address in both the bootloader
* and the user program. Additionally, it should be configured such that the
* C-startup code does NOT zero its contents during system initialization. This
* is the code that runs in the reset event handler, before function main() is
* called.
* For GCC based embedded toolchains, the solution is to assign this variable
* to a custom section, in this case called ".shared". Then in the linker
* script, add the following to the SECTIONS:
*
* .shared (NOLOAD) :
* {
* . = ALIGN(4);
* _sshared = .;
* __shared_start__ = _sshared;
* *(.shared)
* *(.shared.*)
* KEEP(*(.shared))
* . = ALIGN(4);
* _eshared = .;
* __shared_end__ = _eshared;
* } >SHARED
*
* Next, add a new MEMORY entry for SHARED at the start of RAM and reduce
* the length of the remaining RAM:
*
* SHARED (xrw) : ORIGIN = 0x200000C0, LENGTH = 64
* RAM (xrw) : ORIGIN = 0x20000100, LENGTH = 32K - 192 - 64
*
* Note that the previous example is for an STM32F0 microcontroller where
* the first 192 (0xC0) bytes in RAM are reserved for the user program
* vector table.
*
* \remark This same approach can be applied with other toolchains such as Keil MDK
* and IAR EWARM. Consult the compiler and linker user manuals of your
* toolchain to find out how to place a RAM variable at a fixed memory address
* and to prevent the C-startup code from zeroing its contents.
* Here are a few links to get you started:
* * IAR EWARM:
* https://www.iar.com/support/tech-notes/compiler/
* linker-error-for-absolute-located-variable/
* * Keil MDK:
* http://www.keil.com/support/docs/3480.htm
*/
static tSharedParamsBuffer sharedParamsBuffer __attribute__ ((section (".shared")));
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static bool SharedParamsValidateBuffer(void);
static void SharedParamsWriteChecksum(void);
static bool SharedParamsVerifyChecksum(void);
static uint16_t SharedParamsCalculateChecksum(void);
/************************************************************************************//**
** \brief Initializes the shared RAM parameters module.
** \return none.
**
****************************************************************************************/
void SharedParamsInit(void)
{
uint32_t byteIdx;
/* The shared parameter buffer does not get initialized by the C-startup code. Another
* previously running program could have initialized it, in which case it is ready
* for use and nothing more needs to be done.
*/
if (!SharedParamsValidateBuffer())
{
/* The shared parameter buffer was not yet initialized by a running program. This
* typically happens after a cold reset where the RAM contents were lost. In this
* case we need to explicitly configure and initialize it, since the C-startup code
* was configured to not do this.
*
* The initialization consists of setting the buffer identifier, zeroing the
* actual parameter data and updating the checksum at the end.
*/
sharedParamsBuffer.identifier = SHARED_PARAMS_BUFFER_ID;
for (byteIdx=0; byteIdx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN; byteIdx++)
{
sharedParamsBuffer.data[byteIdx] = 0;
}
SharedParamsWriteChecksum();
}
} /*** end of SharedParamsInit ***/
/************************************************************************************//**
** \brief Reads a data byte from the shared parameter buffer at the specified index.
** \param idx Index into the parameter data array. A valid value is between 0 and
** (SHARED_PARAMS_CFG_BUFFER_DATA_LEN - 1).
** \param value Pointer to where the read data value is stored.
** \return True if successful, false otherwise.
**
****************************************************************************************/
bool SharedParamsReadByIndex(uint32_t idx, uint8_t * value)
{
bool result = false;
/* Only continue if the buffer and the specified parameters are valid. */
if ( (SharedParamsValidateBuffer()) &&
(idx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN) &&
(value != NULL) )
{
/* Read the value and update the result. */
*value = sharedParamsBuffer.data[idx];
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsReadByIndex ***/
/************************************************************************************//**
** \brief Writes a data byte to the shared parameter buffer at the specified index.
** \param idx Index into the parameter data array. A valid value is between 0 and
** (SHARED_PARAMS_CFG_BUFFER_DATA_LEN - 1).
** \param value Value to write.
** \return True if successful, false otherwise.
**
****************************************************************************************/
bool SharedParamsWriteByIndex(uint32_t idx, uint8_t value)
{
bool result = false;
/* Only continue if the buffer and the specified parameters are valid. */
if ( (SharedParamsValidateBuffer()) &&
(idx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN) )
{
/* Write the value. */
sharedParamsBuffer.data[idx] = value;
/* Update the checksum since the contents were just changed. */
SharedParamsWriteChecksum();
/* Update the result. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsWriteByIndex ***/
/************************************************************************************//**
** \brief Validates the shared parameter buffer contents by looking at the table
** identifier and verifying its checksum.
** \return True if successful, false otherwise.
**
****************************************************************************************/
static bool SharedParamsValidateBuffer(void)
{
bool result = false;
/* Perform validation. */
if ( (sharedParamsBuffer.identifier == SHARED_PARAMS_BUFFER_ID) &&
(SharedParamsVerifyChecksum()) )
{
/* The shared parameter buffer is valid, so update the result value. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsValitabeTable ***/
/************************************************************************************//**
** \brief Calculates and writes the checksum into the buffer.
** \return none.
**
****************************************************************************************/
static void SharedParamsWriteChecksum(void)
{
/* Calculate and write the checksum. */
sharedParamsBuffer.checksum = SharedParamsCalculateChecksum();
} /*** end of SharedParamsWriteChecksum ***/
/************************************************************************************//**
** \brief Calculates and verifies the checksum that is currently present in the
** buffer.
** \return True is the checksum is correct, false otherwise.
**
****************************************************************************************/
static bool SharedParamsVerifyChecksum(void)
{
bool result = false;
/* Calculate and verify the checksum. */
if (SharedParamsCalculateChecksum() == sharedParamsBuffer.checksum)
{
/* Checksum is correct, so update the result value. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsVerifyChecksum ***/
/************************************************************************************//**
** \brief Calculates and returns the checksum value for the current contents in the
** buffer. The checksum is calculated by taking the sum of all bytes in the
** parameter buffer (excluding the checksum at the end) and them taking the
** two's complement value of it.
** \return The calculated checksum value.
**
****************************************************************************************/
static uint16_t SharedParamsCalculateChecksum(void)
{
uint16_t result = 0;
uint32_t byteIdx;
/* Add the identifier bytes to the checksum. */
result += (uint8_t)sharedParamsBuffer.identifier;
result += (uint8_t)(sharedParamsBuffer.identifier >> 8u);
result += (uint8_t)(sharedParamsBuffer.identifier >> 16u);
result += (uint8_t)(sharedParamsBuffer.identifier >> 24u);
/* Loop through the parameter data array. */
for (byteIdx=0; byteIdx<SHARED_PARAMS_CFG_BUFFER_DATA_LEN; byteIdx++)
{
/* Add parameter data byte to the checksum. */
result += (uint8_t)sharedParamsBuffer.data[byteIdx];
}
/* Determine one's complement. */
result = ~result;
/* Determine two's complement. */
result += 1;
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsCalculateChecksum ***/
/*********************************** end of shared_params.c ****************************/

View File

@ -0,0 +1,57 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_GCC/Prog/shared_params.h
* \brief Shared RAM parameters header file.
* \ingroup Prog_ARMCM4_XMC4_XMC4700_Relax_Kit_GCC
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2018 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
#ifndef SHARED_PARAMS_H
#define SHARED_PARAMS_H
/****************************************************************************************
* Include files
****************************************************************************************/
#include <stdint.h> /* Standard integer types. */
#include <stdbool.h> /* Standard boolean types. */
/****************************************************************************************
* Configuration macros
****************************************************************************************/
/** \brief Configuration macro for specifying the size of the data inside the parameter
* buffer. This is the length in bytes of the actual parameter data, so
* excluding the bufferId and checksum.
*/
#define SHARED_PARAMS_CFG_BUFFER_DATA_LEN (56u)
/****************************************************************************************
* Function prototypes
****************************************************************************************/
void SharedParamsInit(void);
bool SharedParamsReadByIndex(uint32_t idx, uint8_t * value);
bool SharedParamsWriteByIndex(uint32_t idx, uint8_t value);
#endif /* SHARED_PARAMS_H */
/*********************************** end of shared_params.h ****************************/

View File

@ -104,6 +104,62 @@
#define BOOT_COM_UART_CHANNEL_INDEX (0)
/* The NET communication interface for firmware updates via TCP/IP is selected by setting
* the BOOT_COM_NET_ENABLE configurable to 1. The maximum amount of data bytes in a
* message for data transmission and reception is set through BOOT_COM_NET_TX_MAX_DATA
* and BOOT_COM_NET_RX_MAX_DATA, respectively. The default IP address is configured
* with the macros BOOT_COM_NET_IPADDRx. The default netmask is configured with the
* macro BOOT_COM_NET_NETMASKx. The default gateway is configured with the macros
* BOOT_COM_NET_GATEWAYx. The bootloader acts and a TCP/IP server. The port the server
* listen on for connections is configured with BOOT_COM_NET_PORT.
* In case the network switch/router supports a DHCP server, you can set configuration
* macro BOOT_COM_NET_DHCP_ENABLE to 1 to enable the DHCP client. In this case the
* DHCP client handles the automatic IP address assignment. In this case the macros for
* configuring the IP address, network mask and gateway address are no longer needed.
*/
/** \brief Enable/disable the NET transport layer. */
#define BOOT_COM_NET_ENABLE (1)
/** \brief Configure number of bytes in the target->host data packet. */
#define BOOT_COM_NET_TX_MAX_DATA (64)
/** \brief Configure number of bytes in the host->target data packet. */
#define BOOT_COM_NET_RX_MAX_DATA (64)
/** \brief Configure the port that the TCP/IP server listens on */
#define BOOT_COM_NET_PORT (1000)
/** \brief Enable/disable DHCP client for automatically obtaining an IP address. */
#define BOOT_COM_NET_DHCP_ENABLE (1)
/** \brief Configure the 1st byte of the IP address */
#define BOOT_COM_NET_IPADDR0 (192)
/** \brief Configure the 2nd byte of the IP address */
#define BOOT_COM_NET_IPADDR1 (168)
/** \brief Configure the 3rd byte of the IP address */
#define BOOT_COM_NET_IPADDR2 (178)
/** \brief Configure the 4th byte of the IP address */
#define BOOT_COM_NET_IPADDR3 (50)
/** \brief Configure the 1st byte of the network mask */
#define BOOT_COM_NET_NETMASK0 (255)
/** \brief Configure the 2nd byte of the network mask */
#define BOOT_COM_NET_NETMASK1 (255)
/** \brief Configure the 3rd byte of the network mask */
#define BOOT_COM_NET_NETMASK2 (255)
/** \brief Configure the 4th byte of the network mask */
#define BOOT_COM_NET_NETMASK3 (0)
/** \brief Configure the 1st byte of the gateway address */
#define BOOT_COM_NET_GATEWAY0 (192)
/** \brief Configure the 2nd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY1 (168)
/** \brief Configure the 3rd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY2 (178)
/** \brief Configure the 4th byte of the gateway address */
#define BOOT_COM_NET_GATEWAY3 (1)
/** \brief Enable/disable the deferred initialization mechanism. When enabled, the
* communication interface is only initialized when: (a) no valid user program
* is detected, or (b) when CpuUserProgramStartHook() returns BLT_FALSE. Your
* bootloader application can explicitly initialize the communication interface
* by calling ComDeferredInit().
*/
#define BOOT_COM_NET_DEFERRED_INIT_ENABLE (1)
/****************************************************************************************
* B A C K D O O R E N T R Y C O N F I G U R A T I O N
****************************************************************************************/

View File

@ -4,28 +4,30 @@
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_IROM1_start__ = 0x08000000;
define symbol __ICFEDIT_region_IROM1_end__ = 0x08003FFF;
define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
define symbol __ICFEDIT_region_IROM2_end__ = 0x0;
define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
define symbol __ICFEDIT_region_EROM1_end__ = 0x0;
define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
define symbol __ICFEDIT_region_EROM2_end__ = 0x0;
define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
define symbol __ICFEDIT_region_EROM3_end__ = 0x0;
define symbol __ICFEDIT_region_IRAM1_start__ = 0x1FFE8000;
define symbol __ICFEDIT_region_IRAM1_end__ = 0x1FFFFFFF;
define symbol __ICFEDIT_region_IRAM2_start__ = 0x20000000;
define symbol __ICFEDIT_region_IRAM2_end__ = 0x2001FFFF;
define symbol __ICFEDIT_region_IRAM3_start__ = 0x20020000;
define symbol __ICFEDIT_region_IRAM3_end__ = 0x2003FFFF;
define symbol __ICFEDIT_region_ERAM1_start__ = 0x60000000;
define symbol __ICFEDIT_region_ERAM1_end__ = 0x6FFFFFFF;
define symbol __ICFEDIT_region_ERAM2_start__ = 0xA0000000;
define symbol __ICFEDIT_region_ERAM2_end__ = 0xAFFFFFFF;
define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
define symbol __ICFEDIT_region_ERAM3_end__ = 0x0;
define symbol __ICFEDIT_region_IROM1_start__ = 0x08000000;
define symbol __ICFEDIT_region_IROM1_end__ = 0x08007FFF;
define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
define symbol __ICFEDIT_region_IROM2_end__ = 0x0;
define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
define symbol __ICFEDIT_region_EROM1_end__ = 0x0;
define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
define symbol __ICFEDIT_region_EROM2_end__ = 0x0;
define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
define symbol __ICFEDIT_region_EROM3_end__ = 0x0;
define symbol __ICFEDIT_region_SHARED_start__ = 0x1FFE8000;
define symbol __ICFEDIT_region_SHARED_end__ = 0x1FFE803F;
define symbol __ICFEDIT_region_IRAM1_start__ = 0x1FFE8040;
define symbol __ICFEDIT_region_IRAM1_end__ = 0x1FFFFFFF;
define symbol __ICFEDIT_region_IRAM2_start__ = 0x20000000;
define symbol __ICFEDIT_region_IRAM2_end__ = 0x2001FFFF;
define symbol __ICFEDIT_region_IRAM3_start__ = 0x20020000;
define symbol __ICFEDIT_region_IRAM3_end__ = 0x2003FFFF;
define symbol __ICFEDIT_region_ERAM1_start__ = 0x60000000;
define symbol __ICFEDIT_region_ERAM1_end__ = 0x6FFFFFFF;
define symbol __ICFEDIT_region_ERAM2_start__ = 0xA0000000;
define symbol __ICFEDIT_region_ERAM2_end__ = 0xAFFFFFFF;
define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
define symbol __ICFEDIT_region_ERAM3_end__ = 0x0;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_heap__ = 0x1000;
@ -38,8 +40,8 @@ define region EROM_region = mem:[from __ICFEDIT_region_EROM1_start__ to __IC
| mem:[from __ICFEDIT_region_EROM2_start__ to __ICFEDIT_region_EROM2_end__]
| mem:[from __ICFEDIT_region_EROM3_start__ to __ICFEDIT_region_EROM3_end__];
define region IRAM_region = mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFEDIT_region_IRAM1_end__]
| mem:[from __ICFEDIT_region_IRAM2_start__ to __ICFEDIT_region_IRAM2_end__]
| mem:[from __ICFEDIT_region_IRAM3_start__ to __ICFEDIT_region_IRAM3_end__];
define region IRAM2_region = mem:[from __ICFEDIT_region_IRAM2_start__ to __ICFEDIT_region_IRAM2_end__];
define region ERAM_region = mem:[from __ICFEDIT_region_ERAM1_start__ to __ICFEDIT_region_ERAM1_end__]
| mem:[from __ICFEDIT_region_ERAM2_start__ to __ICFEDIT_region_ERAM2_end__]
| mem:[from __ICFEDIT_region_ERAM3_start__ to __ICFEDIT_region_ERAM3_end__];
@ -57,8 +59,10 @@ if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
}
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place at address mem:__ICFEDIT_region_SHARED_start__ { readwrite section .shared };
place in IROM_region { readonly };
place in EROM_region { readonly section application_specific_ro };
place in IRAM_region { readwrite, block CSTACK, block HEAP };
place in IRAM2_region { readwrite section .iram2 };
place in ERAM_region { readwrite section application_specific_rw };

View File

@ -78,9 +78,6 @@ blt_bool BackDoorEntryHook(void)
****************************************************************************************/
blt_bool CpuUserProgramStartHook(void)
{
/* clean up the LED driver */
LedBlinkExit();
/* additional and optional backdoor entry through BUTTON1 on the board. to
* force the bootloader to stay active after reset, keep it pressed during reset.
*/
@ -92,6 +89,9 @@ blt_bool CpuUserProgramStartHook(void)
return BLT_FALSE;
}
/* clean up the LED driver */
LedBlinkExit();
/* okay to start the user program.*/
return BLT_TRUE;
} /*** end of CpuUserProgramStartHook ***/

View File

@ -25,7 +25,7 @@ if not "%~1" == "" goto debugFile
@echo on
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\common\bin\cspybat" -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Boot\ide\settings\xmc4700.Debug.general.xcl" --backend -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Boot\ide\settings\xmc4700.Debug.driver.xcl"
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\common\bin\cspybat" -f "C:\Work\software\OpenBLT_XMC4700_extras\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Boot\ide\settings\xmc4700.Debug.general.xcl" --backend -f "C:\Work\software\OpenBLT_XMC4700_extras\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Boot\ide\settings\xmc4700.Debug.driver.xcl"
@echo off
goto end
@ -34,7 +34,7 @@ goto end
@echo on
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\common\bin\cspybat" -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Boot\ide\settings\xmc4700.Debug.general.xcl" "--debug_file=%~1" --backend -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Boot\ide\settings\xmc4700.Debug.driver.xcl"
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\common\bin\cspybat" -f "C:\Work\software\OpenBLT_XMC4700_extras\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Boot\ide\settings\xmc4700.Debug.general.xcl" "--debug_file=%~1" --backend -f "C:\Work\software\OpenBLT_XMC4700_extras\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Boot\ide\settings\xmc4700.Debug.driver.xcl"
@echo off
:end

View File

@ -2,7 +2,7 @@
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\arm\bin\armjlink2.dll"
"C:\Work\software\OpenBLT\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Boot\bin\openblt_xmc4700.out"
"C:\Work\software\OpenBLT_XMC4700_extras\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Boot\bin\openblt_xmc4700.out"
--plugin "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\arm\bin\armbat.dll"

View File

@ -19,7 +19,7 @@
<Column0>124</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
<Column0>283</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Disassembly>
<col-names>
@ -63,7 +63,7 @@
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>xmc4700</ExpandedNode></NodeDict></Session>
<NodeDict><ExpandedNode>xmc4700</ExpandedNode><ExpandedNode>xmc4700/Source</ExpandedNode><ExpandedNode>xmc4700/Source/third_party</ExpandedNode><ExpandedNode>xmc4700/Source/third_party/uip</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
@ -83,14 +83,14 @@
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>39</YPos2><SelStart2>2830</SelStart2><SelEnd2>2830</SelEnd2></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\blt_conf.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>54</YPos2><SelStart2>4852</SelStart2><SelEnd2>4852</SelEnd2></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>36</YPos2><SelStart2>2921</SelStart2><SelEnd2>2921</SelEnd2></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\blt_conf.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>45</YPos2><SelStart2>7443</SelStart2><SelEnd2>7443</SelEnd2></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-048C1F58><key>iaridepm.enu1</key></Toolbar-048C1F58></Sizes></Row0><Row1><Sizes><Toolbar-10601A68><key>debuggergui.enu1</key></Toolbar-10601A68></Sizes></Row1><Row2><Sizes><Toolbar-10601F18><key>armjlink2.enu1</key></Toolbar-10601F18></Sizes></Row2></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>716</Bottom><Right>198</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>713009</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>716</Bottom><Right>198</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>713009</sizeVertCY></Rect></Wnd2></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1922</Right><x>-2</x><y>-2</y><xscreen>1924</xscreen><yscreen>200</yscreen><sizeHorzCX>1002083</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198610</sizeVertCY></Rect></Wnd0></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
<Top><Row0><Sizes><Toolbar-051A02B0><key>iaridepm.enu1</key></Toolbar-051A02B0></Sizes></Row0><Row1><Sizes><Toolbar-15B93740><key>debuggergui.enu1</key></Toolbar-15B93740></Sizes></Row1><Row2><Sizes><Toolbar-15B93358><key>armjlink2.enu1</key></Toolbar-15B93358></Sizes></Row2></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>716</Bottom><Right>374</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>195833</sizeVertCX><sizeVertCY>713009</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>716</Bottom><Right>198</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>713009</sizeVertCY></Rect></Wnd2></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1922</Right><x>-2</x><y>-2</y><xscreen>1924</xscreen><yscreen>200</yscreen><sizeHorzCX>1002083</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198610</sizeVertCY></Rect></Wnd0></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Project>

View File

@ -26,7 +26,7 @@ TraceBufferSize=0x00010000
TraceStallIfFIFOFull=0x00000000
TracePortSize=0x00000004
[DebugChecksum]
Checksum=-991246518
Checksum=1184049083
[Exceptions]
StopOnUncaught=_ 0
StopOnThrow=_ 0

View File

@ -18,7 +18,7 @@
<Column0>401</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
<Column0>240</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Debug-Log>
@ -52,7 +52,7 @@
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>xmc4700</ExpandedNode><ExpandedNode>xmc4700/Boot</ExpandedNode><ExpandedNode>xmc4700/Output</ExpandedNode></NodeDict></Session>
<NodeDict><ExpandedNode>xmc4700</ExpandedNode><ExpandedNode>xmc4700/Boot</ExpandedNode><ExpandedNode>xmc4700/Boot/lib</ExpandedNode><ExpandedNode>xmc4700/Boot/lib/uip</ExpandedNode><ExpandedNode>xmc4700/Output</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
@ -62,14 +62,14 @@
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>39</YPos2><SelStart2>2830</SelStart2><SelEnd2>2830</SelEnd2></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\blt_conf.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>54</YPos2><SelStart2>4852</SelStart2><SelEnd2>4852</SelEnd2></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>36</YPos2><SelStart2>2921</SelStart2><SelEnd2>2921</SelEnd2></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\blt_conf.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>45</YPos2><SelStart2>7443</SelStart2><SelEnd2>7443</SelEnd2></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-048C1F58><key>iaridepm.enu1</key></Toolbar-048C1F58></Sizes></Row0></Top><Left><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>717</Bottom><Right>475</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>248438</sizeVertCX><sizeVertCY>714002</sizeVertCY></Rect></Wnd3></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>245</Bottom><Right>1922</Right><x>-2</x><y>-2</y><xscreen>1924</xscreen><yscreen>247</yscreen><sizeHorzCX>1002083</sizeHorzCX><sizeHorzCY>245283</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198610</sizeVertCY></Rect></Wnd2></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
<Top><Row0><Sizes><Toolbar-051A02B0><key>iaridepm.enu1</key></Toolbar-051A02B0></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>962</Bottom><Right>314</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>164583</sizeVertCX><sizeVertCY>957299</sizeVertCY></Rect></Wnd3></Sizes></Row0></Left><Right><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>962</Bottom><Right>410</Right><x>-2</x><y>-2</y><xscreen>1924</xscreen><yscreen>247</yscreen><sizeHorzCX>1002083</sizeHorzCX><sizeHorzCY>245283</sizeHorzCY><sizeVertCX>214583</sizeVertCX><sizeVertCY>957299</sizeVertCY></Rect></Wnd2></Sizes></Row0></Right><Bottom><Row0><Sizes/></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Workspace>

View File

@ -182,6 +182,7 @@
<option>
<name>CCDefines</name>
<state>XMC4700_F144x2048</state>
<state>XMC_ETH_PHY_KSZ8081RNB</state>
</option>
<option>
<name>CCPreprocFile</name>
@ -313,10 +314,13 @@
<state>$PROJ_DIR$\..\</state>
<state>$PROJ_DIR$\..\lib</state>
<state>$PROJ_DIR$\..\lib\cmsis</state>
<state>$PROJ_DIR$\..\lib\uip</state>
<state>$PROJ_DIR$\..\lib\xmclib\inc</state>
<state>$PROJ_DIR$\..\..\..\..\Source</state>
<state>$PROJ_DIR$\..\..\..\..\Source\ARMCM4_XMC4</state>
<state>$PROJ_DIR$\..\..\..\..\Source\ARMCM4_XMC4\IAR</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc</state>
</option>
<option>
<name>CCStdIncCheck</name>
@ -1953,6 +1957,24 @@
<name>$PROJ_DIR$\..\lib\cmsis\core_cmSimd.h</name>
</file>
</group>
<group>
<name>uip</name>
<file>
<name>$PROJ_DIR$\..\lib\uip\clock-arch.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\clock-arch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\netdev.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\netdev.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\uip-conf.h</name>
</file>
</group>
<group>
<name>xmclib</name>
<file>
@ -2227,6 +2249,12 @@
<file>
<name>$PROJ_DIR$\..\main.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\startup_XMC4700.s</name>
</file>
@ -2266,6 +2294,63 @@
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM4_XMC4\uart.c</name>
</file>
</group>
<group>
<name>third_party</name>
<group>
<name>uip</name>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\clock.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc-addrlabels.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc-switch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\pt.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arp.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_timer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uiplib.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uiplib.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uipopt.h</name>
</file>
</group>
</group>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\assert.c</name>
</file>

View File

@ -2333,6 +2333,24 @@
<name>$PROJ_DIR$\..\lib\cmsis\core_cmSimd.h</name>
</file>
</group>
<group>
<name>uip</name>
<file>
<name>$PROJ_DIR$\..\lib\uip\clock-arch.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\clock-arch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\netdev.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\netdev.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\uip-conf.h</name>
</file>
</group>
<group>
<name>xmclib</name>
<file>
@ -2607,6 +2625,12 @@
<file>
<name>$PROJ_DIR$\..\main.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\startup_XMC4700.s</name>
</file>
@ -2646,6 +2670,63 @@
<name>$PROJ_DIR$\..\..\..\..\Source\ARMCM4_XMC4\uart.c</name>
</file>
</group>
<group>
<name>third_party</name>
<group>
<name>uip</name>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\clock.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc-addrlabels.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc-switch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\pt.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arp.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_timer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uiplib.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uiplib.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uipopt.h</name>
</file>
</group>
</group>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\assert.c</name>
</file>

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: clock-arch.c,v 1.2 2006/06/12 08:00:31 adam Exp $
*/
/**
* \file
* Implementation of architecture-specific clock functionality
* \author
* Adam Dunkels <adam@sics.se>
*/
#include "clock-arch.h"
#include "boot.h"
/*---------------------------------------------------------------------------*/
clock_time_t
clock_time(void)
{
return (clock_time_t)TimerGet();
}
/*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: clock-arch.h,v 1.2 2006/06/12 08:00:31 adam Exp $
*/
#ifndef __CLOCK_ARCH_H__
#define __CLOCK_ARCH_H__
typedef int clock_time_t;
#define CLOCK_CONF_SECOND 1000
#endif /* __CLOCK_ARCH_H__ */

View File

@ -0,0 +1,298 @@
/*
* Copyright (c) 2001, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: netdev.c,v 1.8 2006/06/07 08:39:58 adam Exp $
*/
/*---------------------------------------------------------------------------*/
#include "uip.h"
#include "uip_arp.h"
#include "boot.h"
#include "xmc_gpio.h"
#include "xmc_eth_mac.h"
#include "xmc_eth_phy.h"
#include <string.h>
/*---------------------------------------------------------------------------*/
#define NETDEV_LINKUP_TIMEOUT_MS (5000)
#define NETDEV_DEFAULT_MACADDR0 (0x08)
#define NETDEV_DEFAULT_MACADDR1 (0x00)
#define NETDEV_DEFAULT_MACADDR2 (0x27)
#define NETDEV_DEFAULT_MACADDR3 (0x69)
#define NETDEV_DEFAULT_MACADDR4 (0x5B)
#define NETDEV_DEFAULT_MACADDR5 (0x45)
#define NETDEV_DEFAULT_MACADDR ((uint64_t)NETDEV_DEFAULT_MACADDR0 | \
((uint64_t)NETDEV_DEFAULT_MACADDR1 << 8) | \
((uint64_t)NETDEV_DEFAULT_MACADDR2 << 16) | \
((uint64_t)NETDEV_DEFAULT_MACADDR3 << 24) | \
((uint64_t)NETDEV_DEFAULT_MACADDR4 << 32) | \
((uint64_t)NETDEV_DEFAULT_MACADDR5 << 40))
#define ETH_UIP_0_NUM_RX_BUF (4U)
#define ETH_UIP_0_NUM_TX_BUF (4U)
#define ETH_UIP_0_CRS_DV XMC_GPIO_PORT15, 9U
#define ETH_UIP_0_RXER XMC_GPIO_PORT2, 4U
#define ETH_UIP_0_RXD0 XMC_GPIO_PORT2, 2U
#define ETH_UIP_0_RXD1 XMC_GPIO_PORT2, 3U
#define ETH_UIP_0_TXEN XMC_GPIO_PORT2, 5U
#define ETH_UIP_0_TXD0 XMC_GPIO_PORT2, 8U
#define ETH_UIP_0_TXD1 XMC_GPIO_PORT2, 9U
#define ETH_UIP_0_RMII_CLK XMC_GPIO_PORT15, 8U
#define ETH_UIP_0_MDC XMC_GPIO_PORT2, 7U
#define ETH_UIP_0_MDIO XMC_GPIO_PORT2, 0U
#define ETH_UIP_0_PIN_LIST_SIZE (10U)
#define ETH_UIP_0_PHY_ADDR (0)
/*---------------------------------------------------------------------------*/
#if defined(__ICCARM__)
#pragma data_alignment=4
static XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] @ ".iram2";
#pragma data_alignment=4
static XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] @ ".iram2";
#pragma data_alignment=4
static blt_int8u ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] @ ".iram2";
#pragma data_alignment=4
static blt_int8u ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] @ ".iram2";
#elif defined(__CC_ARM)
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("RW_IRAM1")));
#elif defined(__GNUC__)
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("ETH_RAM")));
#else
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF];
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF];
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE];
static __attribute__((aligned(4))) blt_int8u ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE];
#endif
const XMC_ETH_PHY_CONFIG_t eth_phy_config =
{
.interface = XMC_ETH_LINK_INTERFACE_RMII,
.enable_auto_negotiate = false,
.duplex = XMC_ETH_LINK_DUPLEX_FULL,
.speed = XMC_ETH_LINK_SPEED_100M
};
XMC_ETH_MAC_t eth_mac =
{
.regs = ETH0,
.address = NETDEV_DEFAULT_MACADDR,
.rx_desc = ETH_UIP_0_rx_desc,
.tx_desc = ETH_UIP_0_tx_desc,
.rx_buf = &ETH_UIP_0_rx_buf[0][0],
.tx_buf = &ETH_UIP_0_tx_buf[0][0],
.num_rx_buf = ETH_UIP_0_NUM_RX_BUF,
.num_tx_buf = ETH_UIP_0_NUM_TX_BUF
};
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
XMC_ETH_MAC_PORT_CTRL_t port_control;
XMC_GPIO_CONFIG_t gpio_config;
gpio_config.output_level = XMC_GPIO_OUTPUT_LEVEL_LOW;
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
/* Initialize GPIO pins. */
XMC_GPIO_Init(ETH_UIP_0_CRS_DV, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXER, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXD0, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXD1, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXEN, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXD0, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXD1, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RMII_CLK, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_MDC, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_MDIO, &gpio_config);
XMC_GPIO_SetHardwareControl(ETH_UIP_0_MDIO, XMC_GPIO_HWCTRL_PERIPHERAL1);
port_control.mode = XMC_ETH_MAC_PORT_CTRL_MODE_RMII;
port_control.rxd0 = (XMC_ETH_MAC_PORT_CTRL_RXD0_t)0U;
port_control.rxd1 = (XMC_ETH_MAC_PORT_CTRL_RXD1_t)0U;
port_control.clk_rmii = (XMC_ETH_MAC_PORT_CTRL_CLK_RMII_t)2U;
port_control.crs_dv = (XMC_ETH_MAC_PORT_CTRL_CRS_DV_t)2U;
port_control.rxer = (XMC_ETH_MAC_PORT_CTRL_RXER_t)0U;
port_control.mdio = (XMC_ETH_MAC_PORT_CTRL_MDIO_t)1U;
XMC_ETH_MAC_SetPortControl(&eth_mac, port_control);
}
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
blt_int32u ulLinkTimeOut;
(void)XMC_ETH_MAC_Init(&eth_mac);
XMC_ETH_MAC_DisableJumboFrame(&eth_mac);
/* Wait for link to become active. */
ulLinkTimeOut = TimerGet() + NETDEV_LINKUP_TIMEOUT_MS;
while (XMC_ETH_PHY_GetLinkStatus(&eth_mac, ETH_UIP_0_PHY_ADDR) == XMC_ETH_LINK_STATUS_DOWN)
{
/* Check for timeout so that the software program can still start if the ethernet
* cable is not connected.
*/
if (TimerGet() >= ulLinkTimeOut)
{
break;
}
/* Service the watchdog. */
CopService();
}
XMC_ETH_PHY_Init(&eth_mac, ETH_UIP_0_PHY_ADDR, &eth_phy_config);
XMC_ETH_MAC_SetLink(&eth_mac, XMC_ETH_LINK_SPEED_100M, XMC_ETH_LINK_DUPLEX_FULL);
XMC_ETH_MAC_EnableTx(&eth_mac);
XMC_ETH_MAC_EnableRx(&eth_mac);
/* set the default MAC address */
macAddress.addr[0] = NETDEV_DEFAULT_MACADDR0;
macAddress.addr[1] = NETDEV_DEFAULT_MACADDR1;
macAddress.addr[2] = NETDEV_DEFAULT_MACADDR2;
macAddress.addr[3] = NETDEV_DEFAULT_MACADDR3;
macAddress.addr[4] = NETDEV_DEFAULT_MACADDR4;
macAddress.addr[5] = NETDEV_DEFAULT_MACADDR5;
uip_setethaddr(macAddress);
}
/*---------------------------------------------------------------------------*/
void netdev_get_mac(unsigned char * mac_addr)
{
mac_addr[0] = NETDEV_DEFAULT_MACADDR0;
mac_addr[1] = NETDEV_DEFAULT_MACADDR1;
mac_addr[2] = NETDEV_DEFAULT_MACADDR2;
mac_addr[3] = NETDEV_DEFAULT_MACADDR3;
mac_addr[4] = NETDEV_DEFAULT_MACADDR4;
mac_addr[5] = NETDEV_DEFAULT_MACADDR5;
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{
blt_int32u result = 0;
blt_int32u framelen;
/* Check if a new frame was received. */
framelen = XMC_ETH_MAC_GetRxFrameSize(&eth_mac);
/* Only process the frame if the length is valid. */
if ((framelen > 0U) && (framelen <= (blt_int32u)XMC_ETH_MAC_BUF_SIZE))
{
XMC_ETH_MAC_ReadFrame(&eth_mac, uip_buf, framelen);
result = framelen;
}
/* Give the result back to the caller. */
return result;
}
/*---------------------------------------------------------------------------*/
void netdev_send(void)
{
uint8_t *buffer;
uint32_t idx;
/* Only send the frame if the length is valid. */
if ((uip_len > 0U) && (uip_len <= (blt_int32u)XMC_ETH_MAC_BUF_SIZE))
{
if (XMC_ETH_MAC_IsTxDescriptorOwnedByDma(&eth_mac))
{
XMC_ETH_MAC_ResumeTx(&eth_mac);
}
else
{
buffer = XMC_ETH_MAC_GetTxBuffer(&eth_mac);
for (idx = 0; idx < uip_len; idx++)
{
buffer[idx] = uip_buf[idx];
}
XMC_ETH_MAC_SetTxBufferSize(&eth_mac, uip_len);
/* Return the Tx descriptor but do not use the XMC_ETH_MAC_ReturnTxDescriptor().
* This function enables the 'checksum insertion control' feature by setting the
* ETH_MAC_DMA_TDES0_CIC in the eth_mac.tx_desc[eth_mac.tx_index].status. When
* this feature is enabled, an incorrect checksum of 0x0000 is always added to
* ICMP reponse messages such as the PING reply.
*/
eth_mac.tx_ts_index = eth_mac.tx_index;
eth_mac.tx_desc[eth_mac.tx_index].status |= ETH_MAC_DMA_TDES0_OWN;
eth_mac.tx_index++;
if (eth_mac.tx_index == eth_mac.num_tx_buf)
{
eth_mac.tx_index = 0U;
}
eth_mac.frame_end = NULL;
XMC_ETH_MAC_ResumeTx(&eth_mac);
}
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2001, Adam Dunkels.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Dunkels.
* 4. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: netdev.h,v 1.1 2002/01/10 06:22:56 adam Exp $
*
*/
#ifndef __NETDEV_H__
#define __NETDEV_H__
void netdev_init(void);
void netdev_init_mac(void);
void netdev_get_mac(unsigned char * mac_addr);
unsigned int netdev_read(void);
void netdev_send(void);
#endif /* __NETDEV_H__ */

View File

@ -0,0 +1,160 @@
/**
* \addtogroup uipopt
* @{
*/
/**
* \name Project-specific configuration options
* @{
*
* uIP has a number of configuration options that can be overridden
* for each project. These are kept in a project-specific uip-conf.h
* file and all configuration names have the prefix UIP_CONF.
*/
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: uip-conf.h,v 1.6 2006/06/12 08:00:31 adam Exp $
*/
/**
* \file
* An example uIP configuration file
* \author
* Adam Dunkels <adam@sics.se>
*/
#ifndef __UIP_CONF_H__
#define __UIP_CONF_H__
/**
* 8 bit datatype
*
* This typedef defines the 8-bit type used throughout uIP.
*
* \hideinitializer
*/
typedef unsigned char u8_t;
/**
* 16 bit datatype
*
* This typedef defines the 16-bit type used throughout uIP.
*
* \hideinitializer
*/
typedef unsigned short u16_t;
/**
* Statistics datatype
*
* This typedef defines the dataype used for keeping statistics in
* uIP.
*
* \hideinitializer
*/
typedef unsigned short uip_stats_t;
/**
* Maximum number of TCP connections.
*
* \hideinitializer
*/
#define UIP_CONF_MAX_CONNECTIONS 1
/**
* Maximum number of listening TCP ports.
*
* \hideinitializer
*/
#define UIP_CONF_MAX_LISTENPORTS 1
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 1
/**
* UDP Maximum Connections
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CONNS 1
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 0
/**
* uIP buffer size.
*
* \hideinitializer
*/
#define UIP_CONF_BUFFER_SIZE 1600
/**
* CPU byte order.
*
* \hideinitializer
*/
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
/**
* Logging on or off
*
* \hideinitializer
*/
#define UIP_CONF_LOGGING 0
/**
* uIP statistics on or off
*
* \hideinitializer
*/
#define UIP_CONF_STATISTICS 0
/* Here we include the header file for the application(s) we use in
our project. */
#include "boot.h"
#include "net.h"
#include "dhcpc.h"
#endif /* __UIP_CONF_H__ */
/** @} */
/** @} */

View File

@ -33,6 +33,7 @@
#include "xmc_gpio.h" /* GPIO module */
#include "xmc_uart.h" /* UART driver header */
#include "xmc_can.h" /* CAN driver header */
#include "shared_params.h" /* Shared parameters header */
/****************************************************************************************
@ -50,10 +51,44 @@ static void PostInit(void);
****************************************************************************************/
void main(void)
{
blt_int8u deferredInitRequestFlag = 0;
/* initialize the microcontroller */
Init();
/* initialize the shared parameters module */
SharedParamsInit();
/* initialize the bootloader */
BootInit();
#if (BOOT_COM_DEFERRED_INIT_ENABLE == 1)
/* the bootloader is configured to NOT initialize the TCP/IP network stack by default
* to bypass unnecessary delay times before starting the user program. the TCP/IP net-
* work tack is now only initialized when: (a) no valid user program is detected, or
* (b) a forced backdoor entry occurred (CpuUserProgramStartHook() returned BLT_FALSE).
*
* these demo bootloader and user programs have one extra feature implemented for
* demonstration purposes. the demo user program can detect firmware update requests
* from the TCP/IP network in which case it activates the bootloader. But...the
* TCP/IP network stack will not be initialized in this situation. for this reason
* the shared parameter module was integrated in both the bootloader and user program.
* more information about the shared parameter module can be found here:
* https://www.feaser.com/en/blog/?p=216
*
* the shared parameter at the first index (0) contains a flag. this flag is set to
* 1, right before the user program activates this bootloader, to explicitly request
* the bootloader to initialize the TCP/IP network stack. this makes it possible for
* a firmware update to proceed. the code here reads out this flag and performs the
* TCP/IP network stack initialization when requested.
*/
SharedParamsReadByIndex(0, &deferredInitRequestFlag);
if (deferredInitRequestFlag == 1)
{
/* explicitly initialize all communication interface for which the deferred
* initialization feature was enabled.
*/
ComDeferredInit();
}
#endif
/* post initialization of the microcontroller */
PostInit();

View File

@ -0,0 +1,301 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_IAR/Boot/shared_params.c
* \brief Shared RAM parameters source file.
* \ingroup Boot_ARMCM4_XMC4_XMC4700_Relax_Kit_IAR
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2018 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
/****************************************************************************************
* Include files
****************************************************************************************/
#include <stddef.h> /* Standard definitions (NULL). */
#include "shared_params.h" /* Shared parameters header. */
/****************************************************************************************
* Macro definitions
****************************************************************************************/
/** \brief Constant parameter buffer identifier. This value is always located as the
* start of the buffer to validate the the RAM contains valid shared parameters.
*/
#define SHARED_PARAMS_BUFFER_ID (0xCE42E7A2u)
/****************************************************************************************
* Type definitions
****************************************************************************************/
/** \brief Layout of the shared parameters RAM buffer. */
typedef struct t_shared_params_buffer
{
/** \brief Fixed buffer identifier to validate that the RAM contains valid shared
* parameters.
*/
uint32_t identifier;
/** \brief Array for the actual parameter data. */
uint8_t data[SHARED_PARAMS_CFG_BUFFER_DATA_LEN];
/** \brief Checksum value of all the bytes in the buffer, excluding this checksum
* value of obvious reasons. The checksum is calculated as the Two's
* complement of the sum of the bytes.
*/
uint16_t checksum;
} tSharedParamsBuffer;
/****************************************************************************************
* Global data declarations
****************************************************************************************/
/** \brief Declaration of the actual parameter buffer that this module manages.
* \warning For the shared RAM parameters to work properly for sharing information
* between the bootloader and user program, it is important that this
* variable is linked to the exact same RAM address in both the bootloader
* and the user program. Additionally, it should be configured such that the
* C-startup code does NOT zero its contents during system initialization. This
* is the code that runs in the reset event handler, before function main() is
* called.
* For GCC based embedded toolchains, the solution is to assign this variable
* to a custom section, in this case called ".shared". Then in the linker
* script, add the following to the SECTIONS:
*
* .shared (NOLOAD) :
* {
* . = ALIGN(4);
* _sshared = .;
* __shared_start__ = _sshared;
* *(.shared)
* *(.shared.*)
* KEEP(*(.shared))
* . = ALIGN(4);
* _eshared = .;
* __shared_end__ = _eshared;
* } >SHARED
*
* Next, add a new MEMORY entry for SHARED at the start of RAM and reduce
* the length of the remaining RAM:
*
* SHARED (xrw) : ORIGIN = 0x200000C0, LENGTH = 64
* RAM (xrw) : ORIGIN = 0x20000100, LENGTH = 32K - 192 - 64
*
* Note that the previous example is for an STM32F0 microcontroller where
* the first 192 (0xC0) bytes in RAM are reserved for the user program
* vector table.
*
* \remark This same approach can be applied with other toolchains such as Keil MDK
* and IAR EWARM. Consult the compiler and linker user manuals of your
* toolchain to find out how to place a RAM variable at a fixed memory address
* and to prevent the C-startup code from zeroing its contents.
* Here are a few links to get you started:
* * IAR EWARM:
* https://www.iar.com/support/tech-notes/compiler/
* linker-error-for-absolute-located-variable/
* * Keil MDK:
* http://www.keil.com/support/docs/3480.htm
*/
__no_init static tSharedParamsBuffer sharedParamsBuffer @ ".shared";
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static bool SharedParamsValidateBuffer(void);
static void SharedParamsWriteChecksum(void);
static bool SharedParamsVerifyChecksum(void);
static uint16_t SharedParamsCalculateChecksum(void);
/************************************************************************************//**
** \brief Initializes the shared RAM parameters module.
** \return none.
**
****************************************************************************************/
void SharedParamsInit(void)
{
uint32_t byteIdx;
/* The shared parameter buffer does not get initialized by the C-startup code. Another
* previously running program could have initialized it, in which case it is ready
* for use and nothing more needs to be done.
*/
if (!SharedParamsValidateBuffer())
{
/* The shared parameter buffer was not yet initialized by a running program. This
* typically happens after a cold reset where the RAM contents were lost. In this
* case we need to explicitly configure and initialize it, since the C-startup code
* was configured to not do this.
*
* The initialization consists of setting the buffer identifier, zeroing the
* actual parameter data and updating the checksum at the end.
*/
sharedParamsBuffer.identifier = SHARED_PARAMS_BUFFER_ID;
for (byteIdx=0; byteIdx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN; byteIdx++)
{
sharedParamsBuffer.data[byteIdx] = 0;
}
SharedParamsWriteChecksum();
}
} /*** end of SharedParamsInit ***/
/************************************************************************************//**
** \brief Reads a data byte from the shared parameter buffer at the specified index.
** \param idx Index into the parameter data array. A valid value is between 0 and
** (SHARED_PARAMS_CFG_BUFFER_DATA_LEN - 1).
** \param value Pointer to where the read data value is stored.
** \return True if successful, false otherwise.
**
****************************************************************************************/
bool SharedParamsReadByIndex(uint32_t idx, uint8_t * value)
{
bool result = false;
/* Only continue if the buffer and the specified parameters are valid. */
if ( (SharedParamsValidateBuffer()) &&
(idx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN) &&
(value != NULL) )
{
/* Read the value and update the result. */
*value = sharedParamsBuffer.data[idx];
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsReadByIndex ***/
/************************************************************************************//**
** \brief Writes a data byte to the shared parameter buffer at the specified index.
** \param idx Index into the parameter data array. A valid value is between 0 and
** (SHARED_PARAMS_CFG_BUFFER_DATA_LEN - 1).
** \param value Value to write.
** \return True if successful, false otherwise.
**
****************************************************************************************/
bool SharedParamsWriteByIndex(uint32_t idx, uint8_t value)
{
bool result = false;
/* Only continue if the buffer and the specified parameters are valid. */
if ( (SharedParamsValidateBuffer()) &&
(idx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN) )
{
/* Write the value. */
sharedParamsBuffer.data[idx] = value;
/* Update the checksum since the contents were just changed. */
SharedParamsWriteChecksum();
/* Update the result. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsWriteByIndex ***/
/************************************************************************************//**
** \brief Validates the shared parameter buffer contents by looking at the table
** identifier and verifying its checksum.
** \return True if successful, false otherwise.
**
****************************************************************************************/
static bool SharedParamsValidateBuffer(void)
{
bool result = false;
/* Perform validation. */
if ( (sharedParamsBuffer.identifier == SHARED_PARAMS_BUFFER_ID) &&
(SharedParamsVerifyChecksum()) )
{
/* The shared parameter buffer is valid, so update the result value. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsValitabeTable ***/
/************************************************************************************//**
** \brief Calculates and writes the checksum into the buffer.
** \return none.
**
****************************************************************************************/
static void SharedParamsWriteChecksum(void)
{
/* Calculate and write the checksum. */
sharedParamsBuffer.checksum = SharedParamsCalculateChecksum();
} /*** end of SharedParamsWriteChecksum ***/
/************************************************************************************//**
** \brief Calculates and verifies the checksum that is currently present in the
** buffer.
** \return True is the checksum is correct, false otherwise.
**
****************************************************************************************/
static bool SharedParamsVerifyChecksum(void)
{
bool result = false;
/* Calculate and verify the checksum. */
if (SharedParamsCalculateChecksum() == sharedParamsBuffer.checksum)
{
/* Checksum is correct, so update the result value. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsVerifyChecksum ***/
/************************************************************************************//**
** \brief Calculates and returns the checksum value for the current contents in the
** buffer. The checksum is calculated by taking the sum of all bytes in the
** parameter buffer (excluding the checksum at the end) and them taking the
** two's complement value of it.
** \return The calculated checksum value.
**
****************************************************************************************/
static uint16_t SharedParamsCalculateChecksum(void)
{
uint16_t result = 0;
uint32_t byteIdx;
/* Add the identifier bytes to the checksum. */
result += (uint8_t)sharedParamsBuffer.identifier;
result += (uint8_t)(sharedParamsBuffer.identifier >> 8u);
result += (uint8_t)(sharedParamsBuffer.identifier >> 16u);
result += (uint8_t)(sharedParamsBuffer.identifier >> 24u);
/* Loop through the parameter data array. */
for (byteIdx=0; byteIdx<SHARED_PARAMS_CFG_BUFFER_DATA_LEN; byteIdx++)
{
/* Add parameter data byte to the checksum. */
result += (uint8_t)sharedParamsBuffer.data[byteIdx];
}
/* Determine one's complement. */
result = ~result;
/* Determine two's complement. */
result += 1;
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsCalculateChecksum ***/
/*********************************** end of shared_params.c ****************************/

View File

@ -0,0 +1,57 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_IAR/Boot/shared_params.h
* \brief Shared RAM parameters header file.
* \ingroup Boot_ARMCM4_XMC4_XMC4700_Relax_Kit_IAR
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2018 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
#ifndef SHARED_PARAMS_H
#define SHARED_PARAMS_H
/****************************************************************************************
* Include files
****************************************************************************************/
#include <stdint.h> /* Standard integer types. */
#include <stdbool.h> /* Standard boolean types. */
/****************************************************************************************
* Configuration macros
****************************************************************************************/
/** \brief Configuration macro for specifying the size of the data inside the parameter
* buffer. This is the length in bytes of the actual parameter data, so
* excluding the bufferId and checksum.
*/
#define SHARED_PARAMS_CFG_BUFFER_DATA_LEN (56u)
/****************************************************************************************
* Function prototypes
****************************************************************************************/
void SharedParamsInit(void);
bool SharedParamsReadByIndex(uint32_t idx, uint8_t * value);
bool SharedParamsWriteByIndex(uint32_t idx, uint8_t value);
#endif /* SHARED_PARAMS_H */
/*********************************** end of shared_params.h ****************************/

View File

@ -2,30 +2,32 @@
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_1.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x08004000;
define symbol __ICFEDIT_intvec_start__ = 0x08008000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_IROM1_start__ = 0x08004000;
define symbol __ICFEDIT_region_IROM1_end__ = 0x081FFFFF;
define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
define symbol __ICFEDIT_region_IROM2_end__ = 0x0;
define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
define symbol __ICFEDIT_region_EROM1_end__ = 0x0;
define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
define symbol __ICFEDIT_region_EROM2_end__ = 0x0;
define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
define symbol __ICFEDIT_region_EROM3_end__ = 0x0;
define symbol __ICFEDIT_region_IRAM1_start__ = 0x1FFE8000;
define symbol __ICFEDIT_region_IRAM1_end__ = 0x1FFFFFFF;
define symbol __ICFEDIT_region_IRAM2_start__ = 0x20000000;
define symbol __ICFEDIT_region_IRAM2_end__ = 0x2001FFFF;
define symbol __ICFEDIT_region_IRAM3_start__ = 0x20020000;
define symbol __ICFEDIT_region_IRAM3_end__ = 0x2003FFFF;
define symbol __ICFEDIT_region_ERAM1_start__ = 0x60000000;
define symbol __ICFEDIT_region_ERAM1_end__ = 0x6FFFFFFF;
define symbol __ICFEDIT_region_ERAM2_start__ = 0xA0000000;
define symbol __ICFEDIT_region_ERAM2_end__ = 0xAFFFFFFF;
define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
define symbol __ICFEDIT_region_ERAM3_end__ = 0x0;
define symbol __ICFEDIT_region_IROM1_start__ = 0x08008000;
define symbol __ICFEDIT_region_IROM1_end__ = 0x081FFFFF;
define symbol __ICFEDIT_region_IROM2_start__ = 0x0;
define symbol __ICFEDIT_region_IROM2_end__ = 0x0;
define symbol __ICFEDIT_region_EROM1_start__ = 0x0;
define symbol __ICFEDIT_region_EROM1_end__ = 0x0;
define symbol __ICFEDIT_region_EROM2_start__ = 0x0;
define symbol __ICFEDIT_region_EROM2_end__ = 0x0;
define symbol __ICFEDIT_region_EROM3_start__ = 0x0;
define symbol __ICFEDIT_region_EROM3_end__ = 0x0;
define symbol __ICFEDIT_region_SHARED_start__ = 0x1FFE8000;
define symbol __ICFEDIT_region_SHARED_end__ = 0x1FFE803F;
define symbol __ICFEDIT_region_IRAM1_start__ = 0x1FFE8040;
define symbol __ICFEDIT_region_IRAM1_end__ = 0x1FFFFFFF;
define symbol __ICFEDIT_region_IRAM2_start__ = 0x20000000;
define symbol __ICFEDIT_region_IRAM2_end__ = 0x2001FFFF;
define symbol __ICFEDIT_region_IRAM3_start__ = 0x20020000;
define symbol __ICFEDIT_region_IRAM3_end__ = 0x2003FFFF;
define symbol __ICFEDIT_region_ERAM1_start__ = 0x60000000;
define symbol __ICFEDIT_region_ERAM1_end__ = 0x6FFFFFFF;
define symbol __ICFEDIT_region_ERAM2_start__ = 0xA0000000;
define symbol __ICFEDIT_region_ERAM2_end__ = 0xAFFFFFFF;
define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
define symbol __ICFEDIT_region_ERAM3_end__ = 0x0;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_heap__ = 0x1000;
@ -38,8 +40,8 @@ define region EROM_region = mem:[from __ICFEDIT_region_EROM1_start__ to __IC
| mem:[from __ICFEDIT_region_EROM2_start__ to __ICFEDIT_region_EROM2_end__]
| mem:[from __ICFEDIT_region_EROM3_start__ to __ICFEDIT_region_EROM3_end__];
define region IRAM_region = mem:[from __ICFEDIT_region_IRAM1_start__ to __ICFEDIT_region_IRAM1_end__]
| mem:[from __ICFEDIT_region_IRAM2_start__ to __ICFEDIT_region_IRAM2_end__]
| mem:[from __ICFEDIT_region_IRAM3_start__ to __ICFEDIT_region_IRAM3_end__];
define region IRAM2_region = mem:[from __ICFEDIT_region_IRAM2_start__ to __ICFEDIT_region_IRAM2_end__];
define region ERAM_region = mem:[from __ICFEDIT_region_ERAM1_start__ to __ICFEDIT_region_ERAM1_end__]
| mem:[from __ICFEDIT_region_ERAM2_start__ to __ICFEDIT_region_ERAM2_end__]
| mem:[from __ICFEDIT_region_ERAM3_start__ to __ICFEDIT_region_ERAM3_end__];
@ -57,8 +59,10 @@ if (isdefinedsymbol(__USE_DLIB_PERTHREAD))
}
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place at address mem:__ICFEDIT_region_SHARED_start__ { readwrite section .shared };
place in IROM_region { readonly };
place in EROM_region { readonly section application_specific_ro };
place in IRAM_region { readwrite, block CSTACK, block HEAP };
place in IRAM2_region { readwrite section .iram2 };
place in ERAM_region { readwrite section application_specific_rw };

View File

@ -36,6 +36,8 @@
#include "boot.h" /* bootloader interface driver */
#include "led.h" /* LED driver */
#include "timer.h" /* Timer driver */
#include "net.h" /* TCP/IP server application */
#include "shared_params.h" /* Shared parameters header. */
#endif /* HEADER_H */

View File

@ -25,7 +25,7 @@ if not "%~1" == "" goto debugFile
@echo on
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\common\bin\cspybat" -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Prog\ide\settings\xmc4700.Debug.general.xcl" --backend -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Prog\ide\settings\xmc4700.Debug.driver.xcl"
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\common\bin\cspybat" -f "C:\Work\software\OpenBLT_XMC4700_extras\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Prog\ide\settings\xmc4700.Debug.general.xcl" --backend -f "C:\Work\software\OpenBLT_XMC4700_extras\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Prog\ide\settings\xmc4700.Debug.driver.xcl"
@echo off
goto end
@ -34,7 +34,7 @@ goto end
@echo on
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\common\bin\cspybat" -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Prog\ide\settings\xmc4700.Debug.general.xcl" "--debug_file=%~1" --backend -f "C:\Work\software\OpenBLT\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Prog\ide\settings\xmc4700.Debug.driver.xcl"
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\common\bin\cspybat" -f "C:\Work\software\OpenBLT_XMC4700_extras\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Prog\ide\settings\xmc4700.Debug.general.xcl" "--debug_file=%~1" --backend -f "C:\Work\software\OpenBLT_XMC4700_extras\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Prog\ide\settings\xmc4700.Debug.driver.xcl"
@echo off
:end

View File

@ -2,7 +2,7 @@
"C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\arm\bin\armjlink2.dll"
"C:\Work\software\OpenBLT\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Prog\bin\demoprog_xmc4700.out"
"C:\Work\software\OpenBLT_XMC4700_extras\Target\Demo\ARMCM4_XMC4_XMC4700_Relax_Kit_IAR\Prog\bin\demoprog_xmc4700.out"
--plugin "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\arm\bin\armbat.dll"

View File

@ -4,9 +4,9 @@
<Desktop>
<Static>
<Debug-Log>
<ColumnWidth0>20</ColumnWidth0>
<ColumnWidth1>1861</ColumnWidth1>
</Debug-Log>
<ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1861</ColumnWidth1></Debug-Log>
<Build>
<ColumnWidth0>20</ColumnWidth0>
<ColumnWidth1>1395</ColumnWidth1>
@ -15,28 +15,31 @@
</Build>
<Workspace>
<ColumnWidths>
<Column0>124</Column0>
<Column1>27</Column1>
<Column2>27</Column2>
<Column3>27</Column3>
</ColumnWidths>
<Column0>124</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Disassembly>
<col-names>
<item>Disassembly</item>
<item>_I0</item>
</col-names>
<item>Disassembly</item><item>_I0</item></col-names>
<col-widths>
<item>500</item>
<item>20</item>
</col-widths>
<item>500</item><item>20</item></col-widths>
<DisasmHistory/>
<ShowCodeCoverage>1</ShowCodeCoverage>
<ShowInstrProfiling>1</ShowInstrProfiling>
</Disassembly>
<ShowCodeCoverage>1</ShowCodeCoverage><ShowInstrProfiling>1</ShowInstrProfiling></Disassembly>
</Static>
<Windows>
<Wnd3>
<Wnd0>
<Tabs>
<Tab>
<Identity>TabID-6569-18762</Identity>
@ -51,24 +54,20 @@
<Session/>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab>
</Wnd3>
<Wnd4>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1>
<Tabs>
<Tab>
<Identity>TabID-17318-18765</Identity>
<TabName>Workspace</TabName>
<Factory>Workspace</Factory>
<Session>
<NodeDict>
<ExpandedNode>xmc4700</ExpandedNode>
</NodeDict>
</Session>
<NodeDict><ExpandedNode>xmc4700</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab>
</Wnd4>
<Wnd5>
<SelectedTab>0</SelectedTab></Wnd1><Wnd2>
<Tabs>
<Tab>
<Identity>TabID-28066-18768</Identity>
@ -77,128 +76,21 @@
<Session/>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab>
</Wnd5>
</Windows>
<SelectedTab>0</SelectedTab></Wnd2></Windows>
<Editor>
<Pane>
<Tab>
<Factory>TextEditor</Factory>
<Filename>$WS_DIR$\..\main.c</Filename>
<XPos>0</XPos>
<YPos>0</YPos>
<SelStart>0</SelStart>
<SelEnd>0</SelEnd>
<XPos2>0</XPos2>
<YPos2>27</YPos2>
<SelStart2>2531</SelStart2>
<SelEnd2>2531</SelEnd2>
</Tab>
<ActiveTab>0</ActiveTab>
</Pane>
<ActivePane>0</ActivePane>
<Sizes>
<Pane>
<X>1000000</X>
<Y>1000000</Y>
</Pane>
</Sizes>
<SplitMode>1</SplitMode>
</Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>24</YPos2><SelStart2>2531</SelStart2><SelEnd2>2531</SelEnd2></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\net.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>49</YPos2><SelStart2>5570</SelStart2><SelEnd2>5570</SelEnd2></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top>
<Row0>
<Sizes>
<Toolbar-04E2A5F0>
<key>iaridepm.enu1</key>
</Toolbar-04E2A5F0>
</Sizes>
</Row0>
<Row1>
<Sizes>
<Toolbar-126857B0>
<key>debuggergui.enu1</key>
</Toolbar-126857B0>
</Sizes>
</Row1>
<Row2>
<Sizes>
<Toolbar-12685940>
<key>armjlink2.enu1</key>
</Toolbar-12685940>
</Sizes>
</Row2>
</Top>
<Left>
<Row0>
<Sizes>
<Wnd4>
<Rect>
<Top>-2</Top>
<Left>-2</Left>
<Bottom>716</Bottom>
<Right>198</Right>
<x>-2</x>
<y>-2</y>
<xscreen>200</xscreen>
<yscreen>200</yscreen>
<sizeHorzCX>104167</sizeHorzCX>
<sizeHorzCY>198610</sizeHorzCY>
<sizeVertCX>104167</sizeVertCX>
<sizeVertCY>713009</sizeVertCY>
</Rect>
</Wnd4>
</Sizes>
</Row0>
</Left>
<Right>
<Row0>
<Sizes>
<Wnd5>
<Rect>
<Top>-2</Top>
<Left>-2</Left>
<Bottom>716</Bottom>
<Right>198</Right>
<x>-2</x>
<y>-2</y>
<xscreen>200</xscreen>
<yscreen>200</yscreen>
<sizeHorzCX>104167</sizeHorzCX>
<sizeHorzCY>198610</sizeHorzCY>
<sizeVertCX>104167</sizeVertCX>
<sizeVertCY>713009</sizeVertCY>
</Rect>
</Wnd5>
</Sizes>
</Row0>
</Right>
<Bottom>
<Row0>
<Sizes>
<Wnd3>
<Rect>
<Top>-2</Top>
<Left>-2</Left>
<Bottom>198</Bottom>
<Right>1922</Right>
<x>-2</x>
<y>-2</y>
<xscreen>1924</xscreen>
<yscreen>200</yscreen>
<sizeHorzCX>1002083</sizeHorzCX>
<sizeHorzCY>198610</sizeHorzCY>
<sizeVertCX>104167</sizeVertCX>
<sizeVertCY>198610</sizeVertCY>
</Rect>
</Wnd3>
</Sizes>
</Row0>
</Bottom>
<Float>
<Sizes/>
</Float>
</Positions>
<Top><Row0><Sizes><Toolbar-03DE02B0><key>iaridepm.enu1</key></Toolbar-03DE02B0></Sizes></Row0><Row1><Sizes><Toolbar-13C9F8D0><key>debuggergui.enu1</key></Toolbar-13C9F8D0></Sizes></Row1><Row2><Sizes><Toolbar-13C9FA60><key>armjlink2.enu1</key></Toolbar-13C9FA60></Sizes></Row2></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>716</Bottom><Right>198</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>713009</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>716</Bottom><Right>198</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>713009</sizeVertCY></Rect></Wnd2></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1922</Right><x>-2</x><y>-2</y><xscreen>1924</xscreen><yscreen>200</yscreen><sizeHorzCX>1002083</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198610</sizeVertCY></Rect></Wnd0></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Project>

View File

@ -26,7 +26,7 @@ TraceBufferSize=0x00010000
TraceStallIfFIFOFull=0x00000000
TracePortSize=0x00000004
[DebugChecksum]
Checksum=1309327724
Checksum=1440752563
[Exceptions]
StopOnUncaught=_ 0
StopOnThrow=_ 0

View File

@ -28,7 +28,7 @@
<Windows>
<Wnd2>
<Wnd0>
<Tabs>
<Tab>
<Identity>TabID-16961-13040</Identity>
@ -44,7 +44,7 @@
</Tab>
<Tab><Identity>TabID-8639-16881</Identity><TabName>Find in Files</TabName><Factory>Find-in-Files</Factory><Session/></Tab></Tabs>
<SelectedTab>0</SelectedTab></Wnd2><Wnd3>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1>
<Tabs>
<Tab>
<Identity>TabID-27710-13044</Identity>
@ -56,20 +56,20 @@
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd3></Windows>
<SelectedTab>0</SelectedTab></Wnd1></Windows>
<Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>27</YPos2><SelStart2>2531</SelStart2><SelEnd2>2531</SelEnd2></Tab><ActiveTab>0</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>24</YPos2><SelStart2>2884</SelStart2><SelEnd2>2884</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\net.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>135</YPos2><SelStart2>6630</SelStart2><SelEnd2>6630</SelEnd2></Tab><ActiveTab>1</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-04A71F58><key>iaridepm.enu1</key></Toolbar-04A71F58></Sizes></Row0></Top><Left><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>753</Bottom><Right>475</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>248438</sizeVertCX><sizeVertCY>749752</sizeVertCY></Rect></Wnd3></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>209</Bottom><Right>1922</Right><x>-2</x><y>-2</y><xscreen>1924</xscreen><yscreen>211</yscreen><sizeHorzCX>1002083</sizeHorzCX><sizeHorzCY>209533</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198610</sizeVertCY></Rect></Wnd2></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
<Top><Row0><Sizes><Toolbar-04AB02B0><key>iaridepm.enu1</key></Toolbar-04AB02B0></Sizes></Row0></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>962</Bottom><Right>475</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>248438</sizeVertCX><sizeVertCY>957299</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>962</Bottom><Right>376</Right><x>-2</x><y>-2</y><xscreen>1924</xscreen><yscreen>211</yscreen><sizeHorzCX>1002083</sizeHorzCX><sizeHorzCY>209533</sizeHorzCY><sizeVertCX>196875</sizeVertCX><sizeVertCY>957299</sizeVertCY></Rect></Wnd0></Sizes></Row0></Right><Bottom><Row0><Sizes/></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Workspace>

View File

@ -182,6 +182,7 @@
<option>
<name>CCDefines</name>
<state>XMC4700_F144x2048</state>
<state>XMC_ETH_PHY_KSZ8081RNB</state>
</option>
<option>
<name>CCPreprocFile</name>
@ -313,7 +314,10 @@
<state>$PROJ_DIR$\..\</state>
<state>$PROJ_DIR$\..\lib</state>
<state>$PROJ_DIR$\..\lib\cmsis</state>
<state>$PROJ_DIR$\..\lib\uip</state>
<state>$PROJ_DIR$\..\lib\xmclib\inc</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc</state>
</option>
<option>
<name>CCStdIncCheck</name>
@ -1950,6 +1954,24 @@
<name>$PROJ_DIR$\..\lib\cmsis\core_cmSimd.h</name>
</file>
</group>
<group>
<name>uip</name>
<file>
<name>$PROJ_DIR$\..\lib\uip\clock-arch.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\clock-arch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\netdev.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\netdev.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\uip-conf.h</name>
</file>
</group>
<group>
<name>xmclib</name>
<file>
@ -2209,6 +2231,63 @@
<name>$PROJ_DIR$\..\lib\XMC4700.h</name>
</file>
</group>
<group>
<name>third_party</name>
<group>
<name>uip</name>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\clock.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc-addrlabels.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc-switch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\pt.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arp.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_timer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uiplib.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uiplib.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uipopt.h</name>
</file>
</group>
</group>
<file>
<name>$PROJ_DIR$\..\boot.c</name>
</file>
@ -2227,6 +2306,18 @@
<file>
<name>$PROJ_DIR$\..\main.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\net.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\net.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\startup_XMC4700.s</name>
</file>

View File

@ -2333,6 +2333,24 @@
<name>$PROJ_DIR$\..\lib\cmsis\core_cmSimd.h</name>
</file>
</group>
<group>
<name>uip</name>
<file>
<name>$PROJ_DIR$\..\lib\uip\clock-arch.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\clock-arch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\netdev.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\netdev.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\uip\uip-conf.h</name>
</file>
</group>
<group>
<name>xmclib</name>
<file>
@ -2592,6 +2610,63 @@
<name>$PROJ_DIR$\..\lib\XMC4700.h</name>
</file>
</group>
<group>
<name>third_party</name>
<group>
<name>uip</name>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\clock.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc-addrlabels.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc-switch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\pt.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arch.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_arp.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip_timer.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uiplib.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uiplib.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uipopt.h</name>
</file>
</group>
</group>
<file>
<name>$PROJ_DIR$\..\boot.c</name>
</file>
@ -2610,6 +2685,18 @@
<file>
<name>$PROJ_DIR$\..\main.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\net.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\net.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\startup_XMC4700.s</name>
</file>

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: clock-arch.c,v 1.2 2006/06/12 08:00:31 adam Exp $
*/
/**
* \file
* Implementation of architecture-specific clock functionality
* \author
* Adam Dunkels <adam@sics.se>
*/
#include "header.h" /* generic header */
#include "clock-arch.h"
/*---------------------------------------------------------------------------*/
clock_time_t
clock_time(void)
{
return (clock_time_t)TimerGet();
}
/*---------------------------------------------------------------------------*/

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: clock-arch.h,v 1.2 2006/06/12 08:00:31 adam Exp $
*/
#ifndef __CLOCK_ARCH_H__
#define __CLOCK_ARCH_H__
typedef int clock_time_t;
#define CLOCK_CONF_SECOND 1000
#endif /* __CLOCK_ARCH_H__ */

View File

@ -0,0 +1,296 @@
/*
* Copyright (c) 2001, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: netdev.c,v 1.8 2006/06/07 08:39:58 adam Exp $
*/
/*---------------------------------------------------------------------------*/
#include "header.h" /* generic header */
#include "uip.h"
#include "uip_arp.h"
#include "xmc_gpio.h"
#include "xmc_eth_mac.h"
#include "xmc_eth_phy.h"
#include <string.h>
/*---------------------------------------------------------------------------*/
#define NETDEV_LINKUP_TIMEOUT_MS (5000)
#define NETDEV_DEFAULT_MACADDR0 (0x08)
#define NETDEV_DEFAULT_MACADDR1 (0x00)
#define NETDEV_DEFAULT_MACADDR2 (0x27)
#define NETDEV_DEFAULT_MACADDR3 (0x69)
#define NETDEV_DEFAULT_MACADDR4 (0x5B)
#define NETDEV_DEFAULT_MACADDR5 (0x45)
#define NETDEV_DEFAULT_MACADDR ((uint64_t)NETDEV_DEFAULT_MACADDR0 | \
((uint64_t)NETDEV_DEFAULT_MACADDR1 << 8) | \
((uint64_t)NETDEV_DEFAULT_MACADDR2 << 16) | \
((uint64_t)NETDEV_DEFAULT_MACADDR3 << 24) | \
((uint64_t)NETDEV_DEFAULT_MACADDR4 << 32) | \
((uint64_t)NETDEV_DEFAULT_MACADDR5 << 40))
#define ETH_UIP_0_NUM_RX_BUF (4U)
#define ETH_UIP_0_NUM_TX_BUF (4U)
#define ETH_UIP_0_CRS_DV XMC_GPIO_PORT15, 9U
#define ETH_UIP_0_RXER XMC_GPIO_PORT2, 4U
#define ETH_UIP_0_RXD0 XMC_GPIO_PORT2, 2U
#define ETH_UIP_0_RXD1 XMC_GPIO_PORT2, 3U
#define ETH_UIP_0_TXEN XMC_GPIO_PORT2, 5U
#define ETH_UIP_0_TXD0 XMC_GPIO_PORT2, 8U
#define ETH_UIP_0_TXD1 XMC_GPIO_PORT2, 9U
#define ETH_UIP_0_RMII_CLK XMC_GPIO_PORT15, 8U
#define ETH_UIP_0_MDC XMC_GPIO_PORT2, 7U
#define ETH_UIP_0_MDIO XMC_GPIO_PORT2, 0U
#define ETH_UIP_0_PIN_LIST_SIZE (10U)
#define ETH_UIP_0_PHY_ADDR (0)
/*---------------------------------------------------------------------------*/
#if defined(__ICCARM__)
#pragma data_alignment=4
static XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] @ ".iram2";
#pragma data_alignment=4
static XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] @ ".iram2";
#pragma data_alignment=4
static uint8_t ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] @ ".iram2";
#pragma data_alignment=4
static uint8_t ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] @ ".iram2";
#elif defined(__CC_ARM)
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("RW_IRAM1")));
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("RW_IRAM1")));
#elif defined(__GNUC__)
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("ETH_RAM")));
#else
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_rx_desc[ETH_UIP_0_NUM_RX_BUF];
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t ETH_UIP_0_tx_desc[ETH_UIP_0_NUM_TX_BUF];
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_rx_buf[ETH_UIP_0_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE];
static __attribute__((aligned(4))) uint8_t ETH_UIP_0_tx_buf[ETH_UIP_0_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE];
#endif
const XMC_ETH_PHY_CONFIG_t eth_phy_config =
{
.interface = XMC_ETH_LINK_INTERFACE_RMII,
.enable_auto_negotiate = false,
.duplex = XMC_ETH_LINK_DUPLEX_FULL,
.speed = XMC_ETH_LINK_SPEED_100M
};
XMC_ETH_MAC_t eth_mac =
{
.regs = ETH0,
.address = NETDEV_DEFAULT_MACADDR,
.rx_desc = ETH_UIP_0_rx_desc,
.tx_desc = ETH_UIP_0_tx_desc,
.rx_buf = &ETH_UIP_0_rx_buf[0][0],
.tx_buf = &ETH_UIP_0_tx_buf[0][0],
.num_rx_buf = ETH_UIP_0_NUM_RX_BUF,
.num_tx_buf = ETH_UIP_0_NUM_TX_BUF
};
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
XMC_ETH_MAC_PORT_CTRL_t port_control;
XMC_GPIO_CONFIG_t gpio_config;
gpio_config.output_level = XMC_GPIO_OUTPUT_LEVEL_LOW;
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
/* Initialize GPIO pins. */
XMC_GPIO_Init(ETH_UIP_0_CRS_DV, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXER, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXD0, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RXD1, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXEN, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXD0, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_TXD1, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_RMII_CLK, &gpio_config);
gpio_config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_STRONG_SHARP_EDGE;
gpio_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1;
XMC_GPIO_Init(ETH_UIP_0_MDC, &gpio_config);
gpio_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(ETH_UIP_0_MDIO, &gpio_config);
XMC_GPIO_SetHardwareControl(ETH_UIP_0_MDIO, XMC_GPIO_HWCTRL_PERIPHERAL1);
port_control.mode = XMC_ETH_MAC_PORT_CTRL_MODE_RMII;
port_control.rxd0 = (XMC_ETH_MAC_PORT_CTRL_RXD0_t)0U;
port_control.rxd1 = (XMC_ETH_MAC_PORT_CTRL_RXD1_t)0U;
port_control.clk_rmii = (XMC_ETH_MAC_PORT_CTRL_CLK_RMII_t)2U;
port_control.crs_dv = (XMC_ETH_MAC_PORT_CTRL_CRS_DV_t)2U;
port_control.rxer = (XMC_ETH_MAC_PORT_CTRL_RXER_t)0U;
port_control.mdio = (XMC_ETH_MAC_PORT_CTRL_MDIO_t)1U;
XMC_ETH_MAC_SetPortControl(&eth_mac, port_control);
}
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
uint32_t ulLinkTimeOut;
(void)XMC_ETH_MAC_Init(&eth_mac);
XMC_ETH_MAC_DisableJumboFrame(&eth_mac);
/* Wait for link to become active. */
ulLinkTimeOut = TimerGet() + NETDEV_LINKUP_TIMEOUT_MS;
while (XMC_ETH_PHY_GetLinkStatus(&eth_mac, ETH_UIP_0_PHY_ADDR) == XMC_ETH_LINK_STATUS_DOWN)
{
/* Check for timeout so that the software program can still start if the ethernet
* cable is not connected.
*/
if (TimerGet() >= ulLinkTimeOut)
{
break;
}
}
XMC_ETH_PHY_Init(&eth_mac, ETH_UIP_0_PHY_ADDR, &eth_phy_config);
XMC_ETH_MAC_SetLink(&eth_mac, XMC_ETH_LINK_SPEED_100M, XMC_ETH_LINK_DUPLEX_FULL);
XMC_ETH_MAC_EnableTx(&eth_mac);
XMC_ETH_MAC_EnableRx(&eth_mac);
/* set the default MAC address */
macAddress.addr[0] = NETDEV_DEFAULT_MACADDR0;
macAddress.addr[1] = NETDEV_DEFAULT_MACADDR1;
macAddress.addr[2] = NETDEV_DEFAULT_MACADDR2;
macAddress.addr[3] = NETDEV_DEFAULT_MACADDR3;
macAddress.addr[4] = NETDEV_DEFAULT_MACADDR4;
macAddress.addr[5] = NETDEV_DEFAULT_MACADDR5;
uip_setethaddr(macAddress);
}
/*---------------------------------------------------------------------------*/
void netdev_get_mac(unsigned char * mac_addr)
{
mac_addr[0] = NETDEV_DEFAULT_MACADDR0;
mac_addr[1] = NETDEV_DEFAULT_MACADDR1;
mac_addr[2] = NETDEV_DEFAULT_MACADDR2;
mac_addr[3] = NETDEV_DEFAULT_MACADDR3;
mac_addr[4] = NETDEV_DEFAULT_MACADDR4;
mac_addr[5] = NETDEV_DEFAULT_MACADDR5;
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{
uint32_t result = 0;
uint32_t framelen;
/* Check if a new frame was received. */
framelen = XMC_ETH_MAC_GetRxFrameSize(&eth_mac);
/* Only process the frame if the length is valid. */
if ((framelen > 0U) && (framelen <= (uint32_t)XMC_ETH_MAC_BUF_SIZE))
{
XMC_ETH_MAC_ReadFrame(&eth_mac, uip_buf, framelen);
result = framelen;
}
/* Give the result back to the caller. */
return result;
}
/*---------------------------------------------------------------------------*/
void netdev_send(void)
{
uint8_t *buffer;
uint32_t idx;
/* Only send the frame if the length is valid. */
if ((uip_len > 0U) && (uip_len <= (uint32_t)XMC_ETH_MAC_BUF_SIZE))
{
if (XMC_ETH_MAC_IsTxDescriptorOwnedByDma(&eth_mac))
{
XMC_ETH_MAC_ResumeTx(&eth_mac);
}
else
{
buffer = XMC_ETH_MAC_GetTxBuffer(&eth_mac);
for (idx = 0; idx < uip_len; idx++)
{
buffer[idx] = uip_buf[idx];
}
XMC_ETH_MAC_SetTxBufferSize(&eth_mac, uip_len);
/* Return the Tx descriptor but do not use the XMC_ETH_MAC_ReturnTxDescriptor().
* This function enables the 'checksum insertion control' feature by setting the
* ETH_MAC_DMA_TDES0_CIC in the eth_mac.tx_desc[eth_mac.tx_index].status. When
* this feature is enabled, an incorrect checksum of 0x0000 is always added to
* ICMP reponse messages such as the PING reply.
*/
eth_mac.tx_ts_index = eth_mac.tx_index;
eth_mac.tx_desc[eth_mac.tx_index].status |= ETH_MAC_DMA_TDES0_OWN;
eth_mac.tx_index++;
if (eth_mac.tx_index == eth_mac.num_tx_buf)
{
eth_mac.tx_index = 0U;
}
eth_mac.frame_end = NULL;
XMC_ETH_MAC_ResumeTx(&eth_mac);
}
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2001, Adam Dunkels.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Dunkels.
* 4. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: netdev.h,v 1.1 2002/01/10 06:22:56 adam Exp $
*
*/
#ifndef __NETDEV_H__
#define __NETDEV_H__
void netdev_init(void);
void netdev_init_mac(void);
void netdev_get_mac(unsigned char * mac_addr);
unsigned int netdev_read(void);
void netdev_send(void);
#endif /* __NETDEV_H__ */

View File

@ -0,0 +1,160 @@
/**
* \addtogroup uipopt
* @{
*/
/**
* \name Project-specific configuration options
* @{
*
* uIP has a number of configuration options that can be overridden
* for each project. These are kept in a project-specific uip-conf.h
* file and all configuration names have the prefix UIP_CONF.
*/
/*
* Copyright (c) 2006, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the uIP TCP/IP stack
*
* $Id: uip-conf.h,v 1.6 2006/06/12 08:00:31 adam Exp $
*/
/**
* \file
* An example uIP configuration file
* \author
* Adam Dunkels <adam@sics.se>
*/
#ifndef __UIP_CONF_H__
#define __UIP_CONF_H__
/**
* 8 bit datatype
*
* This typedef defines the 8-bit type used throughout uIP.
*
* \hideinitializer
*/
typedef unsigned char u8_t;
/**
* 16 bit datatype
*
* This typedef defines the 16-bit type used throughout uIP.
*
* \hideinitializer
*/
typedef unsigned short u16_t;
/**
* Statistics datatype
*
* This typedef defines the dataype used for keeping statistics in
* uIP.
*
* \hideinitializer
*/
typedef unsigned short uip_stats_t;
/**
* Maximum number of TCP connections.
*
* \hideinitializer
*/
#define UIP_CONF_MAX_CONNECTIONS 1
/**
* Maximum number of listening TCP ports.
*
* \hideinitializer
*/
#define UIP_CONF_MAX_LISTENPORTS 1
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 1
/**
* UDP Maximum Connections
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CONNS 1
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 0
/**
* uIP buffer size.
*
* \hideinitializer
*/
#define UIP_CONF_BUFFER_SIZE 1600
/**
* CPU byte order.
*
* \hideinitializer
*/
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
/**
* Logging on or off
*
* \hideinitializer
*/
#define UIP_CONF_LOGGING 0
/**
* uIP statistics on or off
*
* \hideinitializer
*/
#define UIP_CONF_STATISTICS 0
/* Here we include the header file for the application(s) we use in
our project. */
#include "header.h"
#include "net.h"
#include "dhcpc.h"
#endif /* __UIP_CONF_H__ */
/** @} */
/** @} */

View File

@ -48,14 +48,25 @@ void main(void)
{
/* initialize the microcontroller */
Init();
/* initialize the shared parameters module */
SharedParamsInit();
/* initialize the network application */
NetInit();
/* initialize the bootloader interface */
BootComInit();
/* the shared parameter at index 0 is used as a boolean flag to indicate if the
* bootloader should initialize the TCP/IP network stack. by default this flag
* should be reset.
*/
SharedParamsWriteByIndex(0, 0);
/* start the infinite program loop */
while (1)
{
/* toggle LED with a fixed frequency */
LedToggle();
/* run the network task */
NetTask();
/* check for bootloader activation request */
BootComCheckActivationRequest();
}

View File

@ -0,0 +1,253 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_IAR/Prog/net.c
* \brief Network application for the uIP TCP/IP stack.
* \ingroup Prog_ARMCM4_XMC4_XMC4700_Relax_Kit_IAR
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2014 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
/****************************************************************************************
* Include files
****************************************************************************************/
#include "header.h" /* generic header */
#include "netdev.h"
#include "uip.h"
#include "uip_arp.h"
/****************************************************************************************
* Macro definitions
****************************************************************************************/
/** \brief Delta time for the uIP periodic timer. */
#define NET_UIP_PERIODIC_TIMER_MS (500)
/** \brief Delta time for the uIP ARP timer. */
#define NET_UIP_ARP_TIMER_MS (10000)
/** \brief Macro for accessing the Ethernet header information in the buffer */
#define NET_UIP_HEADER_BUF ((struct uip_eth_hdr *)&uip_buf[0])
/****************************************************************************************
* Local data declarations
****************************************************************************************/
/** \brief Holds the time out value of the uIP periodic timer. */
static unsigned long periodicTimerTimeOut;
/** \brief Holds the time out value of the uIP ARP timer. */
static unsigned long ARPTimerTimeOut;
#if (BOOT_COM_NET_DHCP_ENABLE > 0)
/** \brief Holds the MAC address which is used by the DHCP client. */
static struct uip_eth_addr macAddress;
#endif
/************************************************************************************//**
** \brief Initializes the TCP/IP network communication interface.
** \return none.
**
****************************************************************************************/
void NetInit(void)
{
uip_ipaddr_t ipaddr;
/* initialize the network device */
netdev_init();
/* initialize the timer variables */
periodicTimerTimeOut = TimerGet() + NET_UIP_PERIODIC_TIMER_MS;
ARPTimerTimeOut = TimerGet() + NET_UIP_ARP_TIMER_MS;
/* initialize the uIP TCP/IP stack. */
uip_init();
#if (BOOT_COM_NET_DHCP_ENABLE == 0)
/* set the IP address */
uip_ipaddr(ipaddr, BOOT_COM_NET_IPADDR0, BOOT_COM_NET_IPADDR1, BOOT_COM_NET_IPADDR2,
BOOT_COM_NET_IPADDR3);
uip_sethostaddr(ipaddr);
/* set the network mask */
uip_ipaddr(ipaddr, BOOT_COM_NET_NETMASK0, BOOT_COM_NET_NETMASK1, BOOT_COM_NET_NETMASK2,
BOOT_COM_NET_NETMASK3);
uip_setnetmask(ipaddr);
/* set the gateway address */
uip_ipaddr(ipaddr, BOOT_COM_NET_GATEWAY0, BOOT_COM_NET_GATEWAY1, BOOT_COM_NET_GATEWAY2,
BOOT_COM_NET_GATEWAY3);
uip_setdraddr(ipaddr);
#else
/* set the IP address */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_sethostaddr(ipaddr);
/* set the network mask */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_setnetmask(ipaddr);
/* set the gateway address */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_setdraddr(ipaddr);
#endif
/* start listening on the configured port for XCP transfers on TCP/IP */
uip_listen(HTONS(BOOT_COM_NET_PORT));
/* initialize the MAC and set the MAC address */
netdev_init_mac();
#if (BOOT_COM_NET_DHCP_ENABLE > 0)
/* initialize the DHCP client application and send the initial request. */
netdev_get_mac(&macAddress.addr[0]);
dhcpc_init(&macAddress.addr[0], 6);
dhcpc_request();
#endif
} /*** end of NetInit ***/
/************************************************************************************//**
** \brief The uIP network application that detects the XCP connect command on the
** port used by the bootloader. This indicates that the bootloader should
** be activated.
** \return none.
**
****************************************************************************************/
void NetApp(void)
{
unsigned char *newDataPtr;
if (uip_connected())
{
return;
}
if (uip_newdata())
{
/* a new XCP command was received. check if this is the connect command and in this
* case activate the bootloader. with XCP on TCP/IP the first 4 bytes contain a
* counter value in which we are not really interested.
*/
newDataPtr = uip_appdata;
newDataPtr += 4;
/* check if this was an XCP CONNECT command */
if ((newDataPtr[0] == 0xff) && (newDataPtr[1] == 0x00))
{
/* the shared parameter at index 0 is used as a boolean flag to indicate if the
* bootloader should initialize the TCP/IP network stack. we just received a
* firmware update request from the TCP/IP network and we are about to active
* the bootloader for a firmware update via TCP/IP. At this point we should
* set the flag to make sure the bootloader initializes its TCP/IP network stack.
*/
SharedParamsWriteByIndex(0, 1);
/* connection request received so start the bootloader */
BootActivate();
}
}
} /*** end of NetApp ***/
/************************************************************************************//**
** \brief Runs the TCP/IP server task.
** \return none.
**
****************************************************************************************/
void NetTask(void)
{
unsigned long connection;
unsigned long packetLen;
/* check for an RX packet and read it. */
packetLen = netdev_read();
if (packetLen > 0)
{
/* set uip_len for uIP stack usage */
uip_len = (unsigned short)packetLen;
/* process incoming IP packets here. */
if (NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_IP))
{
uip_arp_ipin();
uip_input();
/* if the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if (uip_len > 0)
{
uip_arp_out();
netdev_send();
uip_len = 0;
}
}
/* process incoming ARP packets here. */
else if (NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_ARP))
{
uip_arp_arpin();
/* if the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if (uip_len > 0)
{
netdev_send();
uip_len = 0;
}
}
}
/* process TCP/IP Periodic Timer here. */
if (TimerGet() >= periodicTimerTimeOut)
{
periodicTimerTimeOut += NET_UIP_PERIODIC_TIMER_MS;
for (connection = 0; connection < UIP_CONNS; connection++)
{
uip_periodic(connection);
/* If the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if (uip_len > 0)
{
uip_arp_out();
netdev_send();
uip_len = 0;
}
}
#if UIP_UDP
for (connection = 0; connection < UIP_UDP_CONNS; connection++)
{
uip_udp_periodic(connection);
/* If the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if(uip_len > 0)
{
uip_arp_out();
netdev_send();
uip_len = 0;
}
}
#endif
}
/* process ARP Timer here. */
if (TimerGet() >= ARPTimerTimeOut)
{
ARPTimerTimeOut += NET_UIP_ARP_TIMER_MS;
uip_arp_timer();
}
} /*** end of NetServerTask ***/
/*********************************** end of net.c **************************************/

View File

@ -0,0 +1,61 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_IAR/Prog/net.h
* \brief Network application for the uIP TCP/IP stack.
* \ingroup Prog_ARMCM4_XMC4_XMC4700_Relax_Kit_IAR
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2014 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
#ifndef NET_H
#define NET_H
/****************************************************************************************
* Macro definitions
****************************************************************************************/
#ifndef UIP_APPCALL
#define UIP_APPCALL NetApp
#endif /* UIP_APPCALL */
/****************************************************************************************
* Type definitions
****************************************************************************************/
/** \brief Define the uip_tcp_appstate_t datatype. This is the state of our tcp/ip
* application, and the memory required for this state is allocated together
* with each TCP connection. One application state for each TCP connection.
*/
typedef struct net_state
{
unsigned char unused;
} uip_tcp_appstate_t;
/****************************************************************************************
* Function prototypes
****************************************************************************************/
void NetInit(void);
void NetApp(void);
void NetTask(void);
#endif /* NET_H */
/*********************************** end of net.h **************************************/

View File

@ -0,0 +1,301 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_IAR/Prog/shared_params.c
* \brief Shared RAM parameters source file.
* \ingroup Prog_ARMCM4_XMC4_XMC4700_Relax_Kit_IAR
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2018 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
/****************************************************************************************
* Include files
****************************************************************************************/
#include <stddef.h> /* Standard definitions (NULL). */
#include "shared_params.h" /* Shared parameters header. */
/****************************************************************************************
* Macro definitions
****************************************************************************************/
/** \brief Constant parameter buffer identifier. This value is always located as the
* start of the buffer to validate the the RAM contains valid shared parameters.
*/
#define SHARED_PARAMS_BUFFER_ID (0xCE42E7A2u)
/****************************************************************************************
* Type definitions
****************************************************************************************/
/** \brief Layout of the shared parameters RAM buffer. */
typedef struct t_shared_params_buffer
{
/** \brief Fixed buffer identifier to validate that the RAM contains valid shared
* parameters.
*/
uint32_t identifier;
/** \brief Array for the actual parameter data. */
uint8_t data[SHARED_PARAMS_CFG_BUFFER_DATA_LEN];
/** \brief Checksum value of all the bytes in the buffer, excluding this checksum
* value of obvious reasons. The checksum is calculated as the Two's
* complement of the sum of the bytes.
*/
uint16_t checksum;
} tSharedParamsBuffer;
/****************************************************************************************
* Global data declarations
****************************************************************************************/
/** \brief Declaration of the actual parameter buffer that this module manages.
* \warning For the shared RAM parameters to work properly for sharing information
* between the bootloader and user program, it is important that this
* variable is linked to the exact same RAM address in both the bootloader
* and the user program. Additionally, it should be configured such that the
* C-startup code does NOT zero its contents during system initialization. This
* is the code that runs in the reset event handler, before function main() is
* called.
* For GCC based embedded toolchains, the solution is to assign this variable
* to a custom section, in this case called ".shared". Then in the linker
* script, add the following to the SECTIONS:
*
* .shared (NOLOAD) :
* {
* . = ALIGN(4);
* _sshared = .;
* __shared_start__ = _sshared;
* *(.shared)
* *(.shared.*)
* KEEP(*(.shared))
* . = ALIGN(4);
* _eshared = .;
* __shared_end__ = _eshared;
* } >SHARED
*
* Next, add a new MEMORY entry for SHARED at the start of RAM and reduce
* the length of the remaining RAM:
*
* SHARED (xrw) : ORIGIN = 0x200000C0, LENGTH = 64
* RAM (xrw) : ORIGIN = 0x20000100, LENGTH = 32K - 192 - 64
*
* Note that the previous example is for an STM32F0 microcontroller where
* the first 192 (0xC0) bytes in RAM are reserved for the user program
* vector table.
*
* \remark This same approach can be applied with other toolchains such as Keil MDK
* and IAR EWARM. Consult the compiler and linker user manuals of your
* toolchain to find out how to place a RAM variable at a fixed memory address
* and to prevent the C-startup code from zeroing its contents.
* Here are a few links to get you started:
* * IAR EWARM:
* https://www.iar.com/support/tech-notes/compiler/
* linker-error-for-absolute-located-variable/
* * Keil MDK:
* http://www.keil.com/support/docs/3480.htm
*/
__no_init static tSharedParamsBuffer sharedParamsBuffer @ ".shared";
/****************************************************************************************
* Function prototypes
****************************************************************************************/
static bool SharedParamsValidateBuffer(void);
static void SharedParamsWriteChecksum(void);
static bool SharedParamsVerifyChecksum(void);
static uint16_t SharedParamsCalculateChecksum(void);
/************************************************************************************//**
** \brief Initializes the shared RAM parameters module.
** \return none.
**
****************************************************************************************/
void SharedParamsInit(void)
{
uint32_t byteIdx;
/* The shared parameter buffer does not get initialized by the C-startup code. Another
* previously running program could have initialized it, in which case it is ready
* for use and nothing more needs to be done.
*/
if (!SharedParamsValidateBuffer())
{
/* The shared parameter buffer was not yet initialized by a running program. This
* typically happens after a cold reset where the RAM contents were lost. In this
* case we need to explicitly configure and initialize it, since the C-startup code
* was configured to not do this.
*
* The initialization consists of setting the buffer identifier, zeroing the
* actual parameter data and updating the checksum at the end.
*/
sharedParamsBuffer.identifier = SHARED_PARAMS_BUFFER_ID;
for (byteIdx=0; byteIdx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN; byteIdx++)
{
sharedParamsBuffer.data[byteIdx] = 0;
}
SharedParamsWriteChecksum();
}
} /*** end of SharedParamsInit ***/
/************************************************************************************//**
** \brief Reads a data byte from the shared parameter buffer at the specified index.
** \param idx Index into the parameter data array. A valid value is between 0 and
** (SHARED_PARAMS_CFG_BUFFER_DATA_LEN - 1).
** \param value Pointer to where the read data value is stored.
** \return True if successful, false otherwise.
**
****************************************************************************************/
bool SharedParamsReadByIndex(uint32_t idx, uint8_t * value)
{
bool result = false;
/* Only continue if the buffer and the specified parameters are valid. */
if ( (SharedParamsValidateBuffer()) &&
(idx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN) &&
(value != NULL) )
{
/* Read the value and update the result. */
*value = sharedParamsBuffer.data[idx];
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsReadByIndex ***/
/************************************************************************************//**
** \brief Writes a data byte to the shared parameter buffer at the specified index.
** \param idx Index into the parameter data array. A valid value is between 0 and
** (SHARED_PARAMS_CFG_BUFFER_DATA_LEN - 1).
** \param value Value to write.
** \return True if successful, false otherwise.
**
****************************************************************************************/
bool SharedParamsWriteByIndex(uint32_t idx, uint8_t value)
{
bool result = false;
/* Only continue if the buffer and the specified parameters are valid. */
if ( (SharedParamsValidateBuffer()) &&
(idx < SHARED_PARAMS_CFG_BUFFER_DATA_LEN) )
{
/* Write the value. */
sharedParamsBuffer.data[idx] = value;
/* Update the checksum since the contents were just changed. */
SharedParamsWriteChecksum();
/* Update the result. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsWriteByIndex ***/
/************************************************************************************//**
** \brief Validates the shared parameter buffer contents by looking at the table
** identifier and verifying its checksum.
** \return True if successful, false otherwise.
**
****************************************************************************************/
static bool SharedParamsValidateBuffer(void)
{
bool result = false;
/* Perform validation. */
if ( (sharedParamsBuffer.identifier == SHARED_PARAMS_BUFFER_ID) &&
(SharedParamsVerifyChecksum()) )
{
/* The shared parameter buffer is valid, so update the result value. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsValitabeTable ***/
/************************************************************************************//**
** \brief Calculates and writes the checksum into the buffer.
** \return none.
**
****************************************************************************************/
static void SharedParamsWriteChecksum(void)
{
/* Calculate and write the checksum. */
sharedParamsBuffer.checksum = SharedParamsCalculateChecksum();
} /*** end of SharedParamsWriteChecksum ***/
/************************************************************************************//**
** \brief Calculates and verifies the checksum that is currently present in the
** buffer.
** \return True is the checksum is correct, false otherwise.
**
****************************************************************************************/
static bool SharedParamsVerifyChecksum(void)
{
bool result = false;
/* Calculate and verify the checksum. */
if (SharedParamsCalculateChecksum() == sharedParamsBuffer.checksum)
{
/* Checksum is correct, so update the result value. */
result = true;
}
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsVerifyChecksum ***/
/************************************************************************************//**
** \brief Calculates and returns the checksum value for the current contents in the
** buffer. The checksum is calculated by taking the sum of all bytes in the
** parameter buffer (excluding the checksum at the end) and them taking the
** two's complement value of it.
** \return The calculated checksum value.
**
****************************************************************************************/
static uint16_t SharedParamsCalculateChecksum(void)
{
uint16_t result = 0;
uint32_t byteIdx;
/* Add the identifier bytes to the checksum. */
result += (uint8_t)sharedParamsBuffer.identifier;
result += (uint8_t)(sharedParamsBuffer.identifier >> 8u);
result += (uint8_t)(sharedParamsBuffer.identifier >> 16u);
result += (uint8_t)(sharedParamsBuffer.identifier >> 24u);
/* Loop through the parameter data array. */
for (byteIdx=0; byteIdx<SHARED_PARAMS_CFG_BUFFER_DATA_LEN; byteIdx++)
{
/* Add parameter data byte to the checksum. */
result += (uint8_t)sharedParamsBuffer.data[byteIdx];
}
/* Determine one's complement. */
result = ~result;
/* Determine two's complement. */
result += 1;
/* Give the result back to the caller. */
return result;
} /*** end of SharedParamsCalculateChecksum ***/
/*********************************** end of shared_params.c ****************************/

View File

@ -0,0 +1,57 @@
/************************************************************************************//**
* \file Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_IAR/Prog/shared_params.h
* \brief Shared RAM parameters header file.
* \ingroup Prog_ARMCM4_XMC4_XMC4700_Relax_Kit_IAR
* \internal
*----------------------------------------------------------------------------------------
* C O P Y R I G H T
*----------------------------------------------------------------------------------------
* Copyright (c) 2018 by Feaser http://www.feaser.com All rights reserved
*
*----------------------------------------------------------------------------------------
* L I C E N S E
*----------------------------------------------------------------------------------------
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You have received a copy of the GNU General Public License along with OpenBLT. It
* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy.
*
* \endinternal
****************************************************************************************/
#ifndef SHARED_PARAMS_H
#define SHARED_PARAMS_H
/****************************************************************************************
* Include files
****************************************************************************************/
#include <stdint.h> /* Standard integer types. */
#include <stdbool.h> /* Standard boolean types. */
/****************************************************************************************
* Configuration macros
****************************************************************************************/
/** \brief Configuration macro for specifying the size of the data inside the parameter
* buffer. This is the length in bytes of the actual parameter data, so
* excluding the bufferId and checksum.
*/
#define SHARED_PARAMS_CFG_BUFFER_DATA_LEN (56u)
/****************************************************************************************
* Function prototypes
****************************************************************************************/
void SharedParamsInit(void);
bool SharedParamsReadByIndex(uint32_t idx, uint8_t * value);
bool SharedParamsWriteByIndex(uint32_t idx, uint8_t value);
#endif /* SHARED_PARAMS_H */
/*********************************** end of shared_params.h ****************************/

View File

@ -176,7 +176,7 @@ static const tFlashSector flashLayout[] =
* overwritten during a firmware update.
*/
/* { 0x0c000000, 0x04000, 0}, flash sector 0 - reserved for bootloader */
{ 0x0c004000, 0x04000, 1}, /* flash sector 1 - 16kb */
/* { 0x0c004000, 0x04000, 1}, flash sector 1 - reserved for bootloader */
{ 0x0c008000, 0x04000, 2}, /* flash sector 2 - 16kb */
{ 0x0c00c000, 0x04000, 3}, /* flash sector 3 - 16kb */
{ 0x0c010000, 0x04000, 4}, /* flash sector 4 - 16kb */