- added TCP/IP networking support to the STM32-E407 demo bootloader.

git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@96 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
Frank Voorburg 2014-07-22 09:26:57 +00:00
parent 0ca620b3ac
commit 7fe571d82e
105 changed files with 47363 additions and 8461 deletions

View File

@ -108,6 +108,82 @@
#define BOOT_COM_UART_CHANNEL_INDEX (5)
/* 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 configued with the macros
* 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.
*/
/** \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 Configure the 1st byte of the IP address */
#define BOOT_COM_NET_IPADDR0 (169)
/** \brief Configure the 2nd byte of the IP address */
#define BOOT_COM_NET_IPADDR1 (254)
/** \brief Configure the 3rd byte of the IP address */
#define BOOT_COM_NET_IPADDR2 (19)
/** \brief Configure the 4th byte of the IP address */
#define BOOT_COM_NET_IPADDR3 (63)
/** \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 (0)
/** \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 (169)
/** \brief Configure the 2nd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY1 (254)
/** \brief Configure the 3rd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY2 (19)
/** \brief Configure the 4th byte of the gateway address */
#define BOOT_COM_NET_GATEWAY3 (1)
/** \brief Enable/disable a hook function that is called when the IP address is about
* to be set. This allows a dynamic override of the BOOT_COM_NET_IPADDRx values.
*/
#define BOOT_COM_NET_IPADDR_HOOK_ENABLE (0)
/** \brief Enable/disable a hook function that is called when the netmask is about
* to be set. This allows a dynamic override of the BOOT_COM_NET_NETMASKx values.
*/
#define BOOT_COM_NET_NETMASK_HOOK_ENABLE (0)
/** \brief Enable/disable a hook function that is called when the gateway address is
* about to be set. This allows a dynamic override of the BOOT_COM_NET_GATEWAYx
* values.
*/
#define BOOT_COM_NET_GATEWAY_HOOK_ENABLE (0)
/****************************************************************************************
* B A C K D O O R C O N F I G U R A T I O N
****************************************************************************************/
#if (BOOT_COM_NET_ENABLE > 0)
/* Override the default time that the backdoor is open if firmware updates via TCP/IP
* are supported. in this case a reactivation of the bootloader results in a re-
* initialization of the ethernet MAC. when directly connected to the ethernet port of
* a PC this will go relatively fast (depending on what MS Windows is being used), but
* when connected to the network via a router this can take several seconds. feel free to
* shorten/lengthen this time for finetuning. the only downside of a long backdoor open
* time is that the starting of the user program will also be delayed for this time.
*
* Also note that when the target is directly connected to the ethernet port of a PC,
* the checkbox "Automatically retry socket connection" should be checked in the
* Microboot settings. if connecting via a router the uncheck this checkbox.
*/
#define BACKDOOR_ENTRY_TIMEOUT_MS (10000)
#endif
/****************************************************************************************
* F I L E S Y S T E M I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/

View File

@ -1,7 +1,7 @@
<!DOCTYPE CrossStudio_Project_File>
<solution Name="stm32f407_crossworks" target="8" version="2">
<project Name="openbtl_olimex_stm32e407">
<configuration Name="Common" Placement="Flash" Target="STM32F407ZG" arm_architecture="v7EM" arm_core_type="Cortex-M4" arm_fpu_type="FPv4-SP-D16" arm_gcc_target="arm-unknown-eabi" arm_linker_heap_size="128" arm_linker_jtag_pad_pre_dr="1" arm_linker_jtag_pad_pre_ir="5" arm_linker_process_stack_size="0" arm_linker_stack_size="128" arm_simulator_memory_simulation_filename="$(TargetsDir)/STM32/STM32SimulatorMemory.dll" arm_simulator_memory_simulation_parameter="STM32F407ZG;0x100000;0x20000" arm_target_debug_interface_type="ADIv5" arm_target_interface_type="Default" arm_target_loader_applicable_loaders="Flash" arm_target_loader_default_loader="Flash" arm_target_loader_parameter="8000000" arm_use_gcc_libraries="Yes" build_intermediate_directory="$(Configuration)/../../obj" build_output_directory="$(ProjectDir)/../bin" c_only_additional_options="-I./..;-I./../lib/stdperiphlib;-I./../lib/stdperiphlib/CMSIS/Device/ST/STM32F4xx/Include;-I./../lib/stdperiphlib/CMSIS/Include;-I./../lib/fatfs;-I./../lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc;-I./../../../../Source;-I./../../../../Source/ARMCM4_STM32;-I./../../../../Source/third_party/fatfs/src" c_preprocessor_definitions="USE_STDPERIPH_DRIVER;HSE_VALUE=12000000;VECT_TAB_FLASH" c_user_include_directories="$(TargetsDir)/STM32/include" gcc_optimization_level="Level 1" link_IOLibraryName="target" link_include_standard_libraries="Yes" linker_keep_symbols="_vectors;EntryFromProg" linker_memory_map_file="$(TargetsDir)/STM32/STM32F407ZG_MemoryMap.xml" linker_output_format="srec" linker_printf_enabled="No" linker_printf_width_precision_supported="No" linker_scanf_enabled="No" linker_section_placement_file="$(StudioDir)/targets/Cortex_M/flash_placement.xml" oscillator_frequency="8MHz" project_directory="" project_type="Executable" property_groups_file_path="$(TargetsDir)/STM32/propertyGroups.xml" target_get_partname_script="GetPartName()" target_match_partname_script="MatchPartName(&quot;$(Target)&quot;)" target_reset_script="Reset()"/>
<configuration Name="Common" Placement="Flash" Target="STM32F407ZG" arm_architecture="v7EM" arm_core_type="Cortex-M4" arm_fpu_type="FPv4-SP-D16" arm_gcc_target="arm-unknown-eabi" arm_linker_heap_size="128" arm_linker_jtag_pad_pre_dr="1" arm_linker_jtag_pad_pre_ir="5" arm_linker_process_stack_size="0" arm_linker_stack_size="128" arm_simulator_memory_simulation_filename="$(TargetsDir)/STM32/STM32SimulatorMemory.dll" arm_simulator_memory_simulation_parameter="STM32F407ZG;0x100000;0x20000" arm_target_debug_interface_type="ADIv5" arm_target_interface_type="Default" arm_target_loader_applicable_loaders="Flash" arm_target_loader_default_loader="Flash" arm_target_loader_parameter="8000000" arm_use_gcc_libraries="Yes" build_intermediate_directory="$(Configuration)/../../obj" build_output_directory="$(ProjectDir)/../bin" c_only_additional_options="-I./..;-I./../lib/ethernetlib/inc;-I./../lib/ethernetlib/src;-I./../lib/uip;-I./../lib/stdperiphlib;-I./../lib/stdperiphlib/CMSIS/Device/ST/STM32F4xx/Include;-I./../lib/stdperiphlib/CMSIS/Include;-I./../lib/fatfs;-I./../lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc;-I./../../../../Source;-I./../../../../Source/ARMCM4_STM32;-I./../../../../Source/third_party/fatfs/src;-I./../../../../Source/third_party/uip/uip" c_preprocessor_definitions="USE_STDPERIPH_DRIVER;HSE_VALUE=12000000;VECT_TAB_FLASH" c_user_include_directories="$(TargetsDir)/STM32/include" gcc_optimization_level="Level 1" link_IOLibraryName="target" link_include_standard_libraries="Yes" linker_keep_symbols="_vectors;EntryFromProg" linker_memory_map_file="$(TargetsDir)/STM32/STM32F407ZG_MemoryMap.xml" linker_output_format="srec" linker_printf_enabled="No" linker_printf_width_precision_supported="No" linker_scanf_enabled="No" linker_section_placement_file="$(StudioDir)/targets/Cortex_M/flash_placement.xml" oscillator_frequency="8MHz" project_directory="" project_type="Executable" property_groups_file_path="$(TargetsDir)/STM32/propertyGroups.xml" target_get_partname_script="GetPartName()" target_match_partname_script="MatchPartName(&quot;$(Target)&quot;)" target_reset_script="Reset()"/>
<configuration Name="Flash" arm_target_flash_loader_file_path="$(TargetsDir)/STM32/Release/STM32F2xx_Loader_rpc.elf" arm_target_flash_loader_type="LIBMEM RPC Loader" arm_target_loader_can_erase_all="Yes" arm_target_loader_can_lock_all="No" arm_target_loader_can_lock_range="No" arm_target_loader_can_unlock_all="No" arm_target_loader_can_unlock_range="No" target_reset_script="FLASHReset()"/>
<folder Name="Source Files">
<configuration Name="Common" filter="c;cpp;cxx;cc;h;s;asm;inc"/>
@ -79,6 +79,17 @@
<file file_name="../lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.c"/>
<file file_name="../lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_wwdg.c"/>
</folder>
<folder Name="ethernetlib" file_name="">
<file file_name="../lib/ethernetlib/inc/stm32_eth.h"/>
<file file_name="../lib/ethernetlib/src/stm32_eth.c"/>
</folder>
<folder Name="uip" file_name="">
<file file_name="../lib/uip/clock-arch.c"/>
<file file_name="../lib/uip/clock-arch.h"/>
<file file_name="../lib/uip/netdev.c"/>
<file file_name="../lib/uip/netdev.h"/>
<file file_name="../lib/uip/uip-conf.h"/>
</folder>
</folder>
<file file_name="../hooks.c"/>
<file file_name="../main.c"/>
@ -128,7 +139,31 @@
<file file_name="../../../../Source/third_party/fatfs/src/integer.h"/>
<file file_name="../../../../Source/third_party/fatfs/src/option/unicode.c"/>
</folder>
<folder Name="uip" file_name="">
<file file_name="../../../../Source/third_party/uip/uip/clock.h"/>
<file file_name="../../../../Source/third_party/uip/uip/lc.h"/>
<file file_name="../../../../Source/third_party/uip/uip/lc-addrlabels.h"/>
<file file_name="../../../../Source/third_party/uip/uip/lc-switch.h"/>
<file file_name="../../../../Source/third_party/uip/uip/Makefile.include"/>
<file file_name="../../../../Source/third_party/uip/uip/pt.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip.c"/>
<file file_name="../../../../Source/third_party/uip/uip/uip.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip_arch.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip_arp.c"/>
<file file_name="../../../../Source/third_party/uip/uip/uip_arp.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip_timer.c"/>
<file file_name="../../../../Source/third_party/uip/uip/uip_timer.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip-fw.c"/>
<file file_name="../../../../Source/third_party/uip/uip/uip-fw.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uiplib.c"/>
<file file_name="../../../../Source/third_party/uip/uip/uiplib.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip-neighbor.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uipopt.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip-split.h"/>
</folder>
</folder>
<file file_name="../../../../Source/net.c"/>
<file file_name="../../../../Source/net.h"/>
</folder>
</folder>
<folder Name="System Files" file_name="">

View File

@ -64,7 +64,7 @@
</Watch4>
<Files>
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Boot\main.c" y="54" path="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Boot\main.c" left="0" selected="0" name="unnamed" top="50" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Boot\blt_conf.h" y="99" path="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Boot\blt_conf.h" left="18" selected="1" name="unnamed" top="72" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Boot\blt_conf.h" y="148" path="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Boot\blt_conf.h" left="18" selected="1" name="unnamed" top="113" />
</Files>
<ARMCrossStudioWindow activeProject="openbtl_olimex_stm32e407" autoConnectTarget="SEGGER J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Work\software\OpenBLT\Target\Source\third_party\fatfs\src\option" fileDialogDefaultFilter="*.c" autoConnectCapabilities="266111" debugSearchPath="" buildConfiguration="THUMB Debug" />
<ARMCrossStudioWindow activeProject="openbtl_olimex_stm32e407" autoConnectTarget="SEGGER J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Work\software\OpenBLT\Target\Source\third_party\uip\uip" fileDialogDefaultFilter="*.c" autoConnectCapabilities="266111" debugSearchPath="" buildConfiguration="THUMB Debug" />
</session>

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,451 @@
/*
* 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 "stm32f4xx.h" /* STM32 registers */
#include "stm32f4xx_conf.h" /* STM32 peripheral drivers */
#include "stm32_eth.h" /* STM32 ethernet library */
#include <string.h> /* for memcpy */
/*---------------------------------------------------------------------------*/
#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)
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void);
static void netdev_RxDscrInit(void);
/*---------------------------------------------------------------------------*/
typedef union _TranDesc0_t
{
uint32_t Data;
struct {
uint32_t DB : 1;
uint32_t UF : 1;
uint32_t ED : 1;
uint32_t CC : 4;
uint32_t VF : 1;
uint32_t EC : 1;
uint32_t LC : 1;
uint32_t NC : 1;
uint32_t LSC : 1;
uint32_t IPE : 1;
uint32_t FF : 1;
uint32_t JT : 1;
uint32_t ES : 1;
uint32_t IHE : 1;
uint32_t : 3;
uint32_t TCH : 1;
uint32_t TER : 1;
uint32_t CIC : 2;
uint32_t : 2;
uint32_t DP : 1;
uint32_t DC : 1;
uint32_t FS : 1;
uint32_t LSEG : 1;
uint32_t IC : 1;
uint32_t OWN : 1;
};
} TranDesc0_t, * pTranDesc0_t;
typedef union _TranDesc1_t
{
uint32_t Data;
struct {
uint32_t TBS1 :13;
uint32_t : 3;
uint32_t TBS2 :12;
uint32_t : 3;
};
} TranDesc1_t, * pTranDesc1_t;
typedef union _RecDesc0_t
{
uint32_t Data;
struct {
uint32_t RMAM_PCE : 1;
uint32_t CE : 1;
uint32_t DE : 1;
uint32_t RE : 1;
uint32_t RWT : 1;
uint32_t FT : 1;
uint32_t LC : 1;
uint32_t IPHCE : 1;
uint32_t LS : 1;
uint32_t FS : 1;
uint32_t VLAN : 1;
uint32_t OE : 1;
uint32_t LE : 1;
uint32_t SAF : 1;
uint32_t DERR : 1;
uint32_t ES : 1;
uint32_t FL :14;
uint32_t AFM : 1;
uint32_t OWN : 1;
};
} RecDesc0_t, * pRecDesc0_t;
typedef union _recDesc1_t
{
uint32_t Data;
struct {
uint32_t RBS1 :13;
uint32_t : 1;
uint32_t RCH : 1;
uint32_t RER : 1;
uint32_t RBS2 :14;
uint32_t DIC : 1;
};
} RecDesc1_t, * pRecDesc1_t;
typedef union _EnetDmaDesc_t
{
uint32_t Data[4];
// Rx DMA descriptor
struct
{
RecDesc0_t RxDesc0;
RecDesc1_t RxDesc1;
uint32_t * pBuffer;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Rx;
// Tx DMA descriptor
struct
{
TranDesc0_t TxDesc0;
TranDesc1_t TxDesc1;
uint32_t * pBuffer1;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Tx;
} EnetDmaDesc_t, * pEnetDmaDesc_t;
/*---------------------------------------------------------------------------*/
uint8_t RxBuff[UIP_CONF_BUFFER_SIZE] __attribute__ ((aligned (4)));
uint8_t TxBuff[UIP_CONF_BUFFER_SIZE] __attribute__ ((aligned (4)));
EnetDmaDesc_t EnetDmaRx __attribute__((aligned (128)));
EnetDmaDesc_t EnetDmaTx __attribute__ ((aligned (128)));
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
ETH_InitTypeDef ETH_InitStructure;
/* Enable ETHERNET clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx |
RCC_AHB1Periph_ETH_MAC_Rx | RCC_AHB1Periph_ETH_MAC_PTP, ENABLE);
/* Enable GPIOs clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOG, ENABLE);
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/*Select RMII Interface*/
SYSCFG_ETH_MediaInterfaceConfig(SYSCFG_ETH_MediaInterface_RMII);
/* ETHERNET pins configuration */
/* PA
ETH_RMII_REF_CLK: PA1
ETH_RMII_MDIO: PA2
ETH_RMII_MDINT: PA3
ETH_RMII_CRS_DV: PA7
*/
/* Configure PA1, PA2, PA3 and PA7*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Connect PA1, PA2, PA3 and PA7 to ethernet module*/
GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_ETH);
/* PB
ETH_RMII_TX_EN: PG11
*/
/* Configure PG11*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG11 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource11, GPIO_AF_ETH);
/* PC
ETH_RMII_MDC: PC1
ETH_RMII_RXD0: PC4
ETH_RMII_RXD1: PC5
*/
/* Configure PC1, PC4 and PC5*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Connect PC1, PC4 and PC5 to ethernet module*/
GPIO_PinAFConfig(GPIOC, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource5, GPIO_AF_ETH);
/* PG
ETH_RMII_TXD0: PG13
ETH_RMII_TXD1: PG14
*/
/* Configure PG13 and PG14*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG13 and PG14 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource13, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOG, GPIO_PinSource14, GPIO_AF_ETH);
/* Reset ETHERNET on AHB Bus */
ETH_DeInit();
/* Software reset */
ETH_SoftwareReset();
/* Wait for software reset */
while(ETH_GetSoftwareResetStatus()==SET);
/* ETHERNET Configuration ------------------------------------------------------*/
/* Call ETH_StructInit if you don't like to configure all ETH_InitStructure parameter */
ETH_StructInit(&ETH_InitStructure);
/* Fill ETH_InitStructure parametrs */
/*------------------------ MAC -----------------------------------*/
ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Disable ;
ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable;
ETH_InitStructure.ETH_RetryTransmission = ETH_RetryTransmission_Disable;
ETH_InitStructure.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;
ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Enable;
ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;
ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;
ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
ETH_InitStructure.ETH_Mode = ETH_Mode_FullDuplex;
ETH_InitStructure.ETH_Speed = ETH_Speed_100M;
unsigned int PhyAddr;
union {
uint32_t HI_LO;
struct
{
uint16_t LO;
uint16_t HI;
};
} PHYID;
for(PhyAddr = 0; 32 > PhyAddr; PhyAddr++)
{
// datasheet for the ks8721bl ethernet controller (http://www.micrel.com/_PDF/Ethernet/datasheets/ks8721bl-sl.pdf)
// page 20 --> PHY Identifier 1 and 2
PHYID.HI = ETH_ReadPHYRegister(PhyAddr,2); // 0x0022
PHYID.LO = ETH_ReadPHYRegister(PhyAddr,3); // 0x1619
if ((0x00221619 == PHYID.HI_LO) || (0x0007C0F1 == PHYID.HI_LO))
break;
}
if (32 < PhyAddr)
{
ASSERT_RT(BLT_FALSE);
}
/* Configure Ethernet */
if(0 == ETH_Init(&ETH_InitStructure, PhyAddr))
{
ASSERT_RT(BLT_FALSE);
}
netdev_TxDscrInit();
netdev_RxDscrInit();
ETH_Start();
}
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
/* 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);
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{
uint32_t size;
/*check for validity*/
if(0 == EnetDmaRx.Rx.RxDesc0.OWN)
{
/*Get the size of the packet*/
size = EnetDmaRx.Rx.RxDesc0.FL; // CRC
memcpy(uip_buf, RxBuff, size); //string.h library*/
}
else
{
return 0;
}
/* Give the buffer back to ENET */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Start the receive operation */
ETH->DMARPDR = 1;
/* Return no error */
return size;
}
/*---------------------------------------------------------------------------*/
void netdev_send(void)
{
while(EnetDmaTx.Tx.TxDesc0.OWN);
/* Copy the application buffer to the driver buffer
Using this MEMCOPY_L2L_BY4 makes the copy routine faster
than memcpy */
memcpy(TxBuff, uip_buf, uip_len);
/* Assign ENET address to Temp Tx Array */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Setting the Frame Length*/
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.LSEG = 1;
EnetDmaTx.Tx.TxDesc0.FS = 1;
EnetDmaTx.Tx.TxDesc0.DC = 0;
EnetDmaTx.Tx.TxDesc0.DP = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
EnetDmaTx.Tx.TxDesc1.TBS1 = (uip_len&0xFFF);
/* Start the ENET by setting the VALID bit in dmaPackStatus of current descr*/
EnetDmaTx.Tx.TxDesc0.OWN = 1;
/* Start the transmit operation */
ETH->DMATPDR = 1;
}
/*---------------------------------------------------------------------------*/
static void netdev_RxDscrInit(void)
{
/* Initialization */
/* Assign temp Rx array to the ENET buffer */
EnetDmaRx.Rx.pBuffer = (uint32_t *)RxBuff;
/* Initialize RX ENET Status and control */
EnetDmaRx.Rx.RxDesc0.Data = 0;
/* Initialize the next descriptor- In our case its single descriptor */
EnetDmaRx.Rx.pEnetDmaNextDesc = &EnetDmaRx;
EnetDmaRx.Rx.RxDesc1.Data = 0;
EnetDmaRx.Rx.RxDesc1.RER = 0; // end of ring
EnetDmaRx.Rx.RxDesc1.RCH = 1; // end of ring
/* Set the max packet size */
EnetDmaRx.Rx.RxDesc1.RBS1 = UIP_CONF_BUFFER_SIZE;
/* Setting the VALID bit */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Setting the RX NEXT Descriptor Register inside the ENET */
ETH->DMARDLAR = (uint32_t)&EnetDmaRx;
}
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void)
{
/* ENET Start Address */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Next Descriptor Address */
EnetDmaTx.Tx.pEnetDmaNextDesc = &EnetDmaTx;
/* Initialize ENET status and control */
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
/* Tx next set to Tx descriptor base */
ETH->DMATDLAR = (uint32_t)&EnetDmaTx;
}

View File

@ -0,0 +1,46 @@
/*
* 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);
unsigned int netdev_read(void);
void netdev_send(void);
#endif /* __NETDEV_H__ */

View File

@ -0,0 +1,151 @@
/**
* \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
/**
* uIP buffer size.
*
* \hideinitializer
*/
#define UIP_CONF_BUFFER_SIZE 1600
/**
* CPU byte order.
*
* \hideinitializer
*/
#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN
/**
* Logging on or off
*
* \hideinitializer
*/
#define UIP_CONF_LOGGING 0
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 0
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 1
/**
* 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"
#endif /* __UIP_CONF_H__ */
/** @} */
/** @} */

View File

@ -87,7 +87,7 @@ void BootComCheckActivationRequest(void)
** \return none.
**
****************************************************************************************/
static void BootActivate(void)
void BootActivate(void)
{
/* perform software reset to activate the bootoader again */
NVIC_SystemReset();

View File

@ -38,6 +38,7 @@
****************************************************************************************/
void BootComInit(void);
void BootComCheckActivationRequest(void);
void BootActivate(void);
#endif /* BOOT_H */

View File

@ -43,6 +43,7 @@
#include "irq.h" /* IRQ driver */
#include "led.h" /* LED driver */
#include "timer.h" /* Timer driver */
#include "net.h" /* TCP/IP server application */
#endif /* HEADER_H */

View File

@ -1,7 +1,7 @@
<!DOCTYPE CrossStudio_Project_File>
<solution Name="stm32f407_crossworks" target="8" version="2">
<project Name="demoprog_olimex_stm32e407">
<configuration Name="Common" Placement="Flash" Target="STM32F407ZG" arm_architecture="v7EM" arm_core_type="Cortex-M4" arm_fpu_type="FPv4-SP-D16" arm_gcc_target="arm-unknown-eabi" arm_linker_heap_size="128" arm_linker_jtag_pad_pre_dr="1" arm_linker_jtag_pad_pre_ir="5" arm_linker_process_stack_size="0" arm_linker_stack_size="128" arm_simulator_memory_simulation_filename="$(TargetsDir)/STM32/STM32SimulatorMemory.dll" arm_simulator_memory_simulation_parameter="STM32F407ZG;0x100000;0x20000" arm_target_debug_interface_type="ADIv5" arm_target_interface_type="Default" arm_target_loader_applicable_loaders="Flash" arm_target_loader_default_loader="Flash" arm_target_loader_parameter="8000000" arm_use_gcc_libraries="Yes" build_intermediate_directory="$(Configuration)/../../obj" build_output_directory="$(ProjectDir)/../bin" c_only_additional_options="-I./..;-I./../lib/stdperiphlib;-I./../lib/stdperiphlib/CMSIS/Device/ST/STM32F4xx/Include;-I./../lib/stdperiphlib/CMSIS/Include;-I./../lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc" c_preprocessor_definitions="USE_STDPERIPH_DRIVER;HSE_VALUE=12000000;VECT_TAB_FLASH" c_user_include_directories="$(TargetsDir)/STM32/include" gcc_optimization_level="Level 1" link_IOLibraryName="target" link_include_standard_libraries="Yes" linker_keep_symbols="_vectors;EntryFromProg" linker_memory_map_file="$(TargetsDir)/STM32/STM32F407ZG_MemoryMap.xml" linker_output_format="srec" linker_printf_enabled="No" linker_printf_width_precision_supported="No" linker_scanf_enabled="No" linker_section_placement_file="$(StudioDir)/targets/Cortex_M/flash_placement.xml" oscillator_frequency="8MHz" project_directory="" project_type="Executable" property_groups_file_path="$(TargetsDir)/STM32/propertyGroups.xml" target_get_partname_script="GetPartName()" target_match_partname_script="MatchPartName(&quot;$(Target)&quot;)" target_reset_script="Reset()"/>
<configuration Name="Common" Placement="Flash" Target="STM32F407ZG" arm_architecture="v7EM" arm_core_type="Cortex-M4" arm_fpu_type="FPv4-SP-D16" arm_gcc_target="arm-unknown-eabi" arm_linker_heap_size="128" arm_linker_jtag_pad_pre_dr="1" arm_linker_jtag_pad_pre_ir="5" arm_linker_process_stack_size="0" arm_linker_stack_size="128" arm_simulator_memory_simulation_filename="$(TargetsDir)/STM32/STM32SimulatorMemory.dll" arm_simulator_memory_simulation_parameter="STM32F407ZG;0x100000;0x20000" arm_target_debug_interface_type="ADIv5" arm_target_interface_type="Default" arm_target_loader_applicable_loaders="Flash" arm_target_loader_default_loader="Flash" arm_target_loader_parameter="8000000" arm_use_gcc_libraries="Yes" build_intermediate_directory="$(Configuration)/../../obj" build_output_directory="$(ProjectDir)/../bin" c_only_additional_options="-I./..;-I./../lib/ethernetlib/inc;-I./../lib/ethernetlib/src;-I./../lib/uip;-I./../lib/stdperiphlib;-I./../lib/stdperiphlib/CMSIS/Device/ST/STM32F4xx/Include;-I./../lib/stdperiphlib/CMSIS/Include;-I./../lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc;-I./../../../../Source/third_party/uip/uip" c_preprocessor_definitions="USE_STDPERIPH_DRIVER;HSE_VALUE=12000000;VECT_TAB_FLASH" c_user_include_directories="$(TargetsDir)/STM32/include" gcc_optimization_level="Level 1" link_IOLibraryName="target" link_include_standard_libraries="Yes" linker_keep_symbols="_vectors;EntryFromProg" linker_memory_map_file="$(TargetsDir)/STM32/STM32F407ZG_MemoryMap.xml" linker_output_format="srec" linker_printf_enabled="No" linker_printf_width_precision_supported="No" linker_scanf_enabled="No" linker_section_placement_file="$(StudioDir)/targets/Cortex_M/flash_placement.xml" oscillator_frequency="8MHz" project_directory="" project_type="Executable" property_groups_file_path="$(TargetsDir)/STM32/propertyGroups.xml" target_get_partname_script="GetPartName()" target_match_partname_script="MatchPartName(&quot;$(Target)&quot;)" target_reset_script="Reset()"/>
<configuration Name="Flash" arm_target_flash_loader_file_path="$(TargetsDir)/STM32/Release/STM32F2xx_Loader_rpc.elf" arm_target_flash_loader_type="LIBMEM RPC Loader" arm_target_loader_can_erase_all="Yes" arm_target_loader_can_lock_all="No" arm_target_loader_can_lock_range="No" arm_target_loader_can_unlock_all="No" arm_target_loader_can_unlock_range="No" target_reset_script="FLASHReset()"/>
<folder Name="Source Files">
<configuration Name="Common" filter="c;cpp;cxx;cc;h;s;asm;inc"/>
@ -75,6 +75,17 @@
<file file_name="../lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_wwdg.c"/>
<file file_name="../lib/stdperiphlib/stm32f4xx_conf.h"/>
</folder>
<folder Name="ethernetlib" file_name="">
<file file_name="../lib/ethernetlib/inc/stm32_eth.h"/>
<file file_name="../lib/ethernetlib/src/stm32_eth.c"/>
</folder>
<folder Name="uip" file_name="">
<file file_name="../lib/uip/clock-arch.c"/>
<file file_name="../lib/uip/clock-arch.h"/>
<file file_name="../lib/uip/netdev.c"/>
<file file_name="../lib/uip/netdev.h"/>
<file file_name="../lib/uip/uip-conf.h"/>
</folder>
</folder>
<file file_name="../boot.c"/>
<file file_name="../boot.h"/>
@ -88,6 +99,31 @@
<file file_name="../timer.c"/>
<file file_name="../timer.h"/>
<file file_name="../vectors.c"/>
<file file_name="../net.c"/>
<file file_name="../net.h"/>
<folder Name="third_party" file_name="">
<folder Name="uip" file_name="">
<file file_name="../../../../Source/third_party/uip/uip/clock.h"/>
<file file_name="../../../../Source/third_party/uip/uip/lc.h"/>
<file file_name="../../../../Source/third_party/uip/uip/lc-addrlabels.h"/>
<file file_name="../../../../Source/third_party/uip/uip/lc-switch.h"/>
<file file_name="../../../../Source/third_party/uip/uip/pt.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip.c"/>
<file file_name="../../../../Source/third_party/uip/uip/uip.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip_arch.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip_arp.c"/>
<file file_name="../../../../Source/third_party/uip/uip/uip_arp.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip_timer.c"/>
<file file_name="../../../../Source/third_party/uip/uip/uip_timer.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip-fw.c"/>
<file file_name="../../../../Source/third_party/uip/uip/uip-fw.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uiplib.c"/>
<file file_name="../../../../Source/third_party/uip/uip/uiplib.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip-neighbor.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uipopt.h"/>
<file file_name="../../../../Source/third_party/uip/uip/uip-split.h"/>
</folder>
</folder>
</folder>
</folder>
</folder>

View File

@ -66,7 +66,7 @@
</Watch4>
<Files>
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Prog\main.c" y="68" path="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Prog\main.c" left="0" selected="0" name="unnamed" top="39" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Prog\boot.c" y="21" path="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Prog\boot.c" left="0" selected="1" name="unnamed" top="21" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Prog\boot.c" y="21" path="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Prog\boot.c" left="18" selected="1" name="unnamed" top="21" />
</Files>
<ARMCrossStudioWindow activeProject="demoprog_olimex_stm32e407" autoConnectTarget="SEGGER J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Work\software\OpenBLT\Target\Demo\ARMCM4_STM32_Olimex_STM32E407_Crossworks\Prog\lib\stdperiphlib" fileDialogDefaultFilter="*.c" autoConnectCapabilities="266111" debugSearchPath="" buildConfiguration="THUMB Debug" />
<ARMCrossStudioWindow activeProject="demoprog_olimex_stm32e407" autoConnectTarget="SEGGER J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Work\software\OpenBLT\Target\Source\third_party\uip\uip" fileDialogDefaultFilter="*.c" autoConnectCapabilities="266111" debugSearchPath="" buildConfiguration="THUMB Debug" />
</session>

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 "header.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,442 @@
/*
* 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 "header.h"
#include "stm32_eth.h" /* STM32 ethernet library */
#include <string.h> /* for memcpy */
/*---------------------------------------------------------------------------*/
#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)
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void);
static void netdev_RxDscrInit(void);
/*---------------------------------------------------------------------------*/
typedef union _TranDesc0_t
{
uint32_t Data;
struct {
uint32_t DB : 1;
uint32_t UF : 1;
uint32_t ED : 1;
uint32_t CC : 4;
uint32_t VF : 1;
uint32_t EC : 1;
uint32_t LC : 1;
uint32_t NC : 1;
uint32_t LSC : 1;
uint32_t IPE : 1;
uint32_t FF : 1;
uint32_t JT : 1;
uint32_t ES : 1;
uint32_t IHE : 1;
uint32_t : 3;
uint32_t TCH : 1;
uint32_t TER : 1;
uint32_t CIC : 2;
uint32_t : 2;
uint32_t DP : 1;
uint32_t DC : 1;
uint32_t FS : 1;
uint32_t LSEG : 1;
uint32_t IC : 1;
uint32_t OWN : 1;
};
} TranDesc0_t, * pTranDesc0_t;
typedef union _TranDesc1_t
{
uint32_t Data;
struct {
uint32_t TBS1 :13;
uint32_t : 3;
uint32_t TBS2 :12;
uint32_t : 3;
};
} TranDesc1_t, * pTranDesc1_t;
typedef union _RecDesc0_t
{
uint32_t Data;
struct {
uint32_t RMAM_PCE : 1;
uint32_t CE : 1;
uint32_t DE : 1;
uint32_t RE : 1;
uint32_t RWT : 1;
uint32_t FT : 1;
uint32_t LC : 1;
uint32_t IPHCE : 1;
uint32_t LS : 1;
uint32_t FS : 1;
uint32_t VLAN : 1;
uint32_t OE : 1;
uint32_t LE : 1;
uint32_t SAF : 1;
uint32_t DERR : 1;
uint32_t ES : 1;
uint32_t FL :14;
uint32_t AFM : 1;
uint32_t OWN : 1;
};
} RecDesc0_t, * pRecDesc0_t;
typedef union _recDesc1_t
{
uint32_t Data;
struct {
uint32_t RBS1 :13;
uint32_t : 1;
uint32_t RCH : 1;
uint32_t RER : 1;
uint32_t RBS2 :14;
uint32_t DIC : 1;
};
} RecDesc1_t, * pRecDesc1_t;
typedef union _EnetDmaDesc_t
{
uint32_t Data[4];
// Rx DMA descriptor
struct
{
RecDesc0_t RxDesc0;
RecDesc1_t RxDesc1;
uint32_t * pBuffer;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Rx;
// Tx DMA descriptor
struct
{
TranDesc0_t TxDesc0;
TranDesc1_t TxDesc1;
uint32_t * pBuffer1;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Tx;
} EnetDmaDesc_t, * pEnetDmaDesc_t;
/*---------------------------------------------------------------------------*/
uint8_t RxBuff[UIP_CONF_BUFFER_SIZE] __attribute__ ((aligned (4)));
uint8_t TxBuff[UIP_CONF_BUFFER_SIZE] __attribute__ ((aligned (4)));
EnetDmaDesc_t EnetDmaRx __attribute__((aligned (128)));
EnetDmaDesc_t EnetDmaTx __attribute__ ((aligned (128)));
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
ETH_InitTypeDef ETH_InitStructure;
/* Enable ETHERNET clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx |
RCC_AHB1Periph_ETH_MAC_Rx | RCC_AHB1Periph_ETH_MAC_PTP, ENABLE);
/* Enable GPIOs clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOG, ENABLE);
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/*Select RMII Interface*/
SYSCFG_ETH_MediaInterfaceConfig(SYSCFG_ETH_MediaInterface_RMII);
/* ETHERNET pins configuration */
/* PA
ETH_RMII_REF_CLK: PA1
ETH_RMII_MDIO: PA2
ETH_RMII_MDINT: PA3
ETH_RMII_CRS_DV: PA7
*/
/* Configure PA1, PA2, PA3 and PA7*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Connect PA1, PA2, PA3 and PA7 to ethernet module*/
GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_ETH);
/* PB
ETH_RMII_TX_EN: PG11
*/
/* Configure PG11*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG11 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource11, GPIO_AF_ETH);
/* PC
ETH_RMII_MDC: PC1
ETH_RMII_RXD0: PC4
ETH_RMII_RXD1: PC5
*/
/* Configure PC1, PC4 and PC5*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Connect PC1, PC4 and PC5 to ethernet module*/
GPIO_PinAFConfig(GPIOC, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource5, GPIO_AF_ETH);
/* PG
ETH_RMII_TXD0: PG13
ETH_RMII_TXD1: PG14
*/
/* Configure PG13 and PG14*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG13 and PG14 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource13, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOG, GPIO_PinSource14, GPIO_AF_ETH);
/* Reset ETHERNET on AHB Bus */
ETH_DeInit();
/* Software reset */
ETH_SoftwareReset();
/* Wait for software reset */
while(ETH_GetSoftwareResetStatus()==SET);
/* ETHERNET Configuration ------------------------------------------------------*/
/* Call ETH_StructInit if you don't like to configure all ETH_InitStructure parameter */
ETH_StructInit(&ETH_InitStructure);
/* Fill ETH_InitStructure parametrs */
/*------------------------ MAC -----------------------------------*/
ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Disable ;
ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable;
ETH_InitStructure.ETH_RetryTransmission = ETH_RetryTransmission_Disable;
ETH_InitStructure.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;
ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Enable;
ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;
ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;
ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
ETH_InitStructure.ETH_Mode = ETH_Mode_FullDuplex;
ETH_InitStructure.ETH_Speed = ETH_Speed_100M;
unsigned int PhyAddr;
union {
uint32_t HI_LO;
struct
{
uint16_t LO;
uint16_t HI;
};
} PHYID;
for(PhyAddr = 0; 32 > PhyAddr; PhyAddr++)
{
// datasheet for the ks8721bl ethernet controller (http://www.micrel.com/_PDF/Ethernet/datasheets/ks8721bl-sl.pdf)
// page 20 --> PHY Identifier 1 and 2
PHYID.HI = ETH_ReadPHYRegister(PhyAddr,2); // 0x0022
PHYID.LO = ETH_ReadPHYRegister(PhyAddr,3); // 0x1619
if ((0x00221619 == PHYID.HI_LO) || (0x0007C0F1 == PHYID.HI_LO))
break;
}
/* Configure Ethernet */
ETH_Init(&ETH_InitStructure, PhyAddr);
netdev_TxDscrInit();
netdev_RxDscrInit();
ETH_Start();
}
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
/* 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);
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{
uint32_t size;
/*check for validity*/
if(0 == EnetDmaRx.Rx.RxDesc0.OWN)
{
/*Get the size of the packet*/
size = EnetDmaRx.Rx.RxDesc0.FL; // CRC
memcpy(uip_buf, RxBuff, size); //string.h library*/
}
else
{
return 0;
}
/* Give the buffer back to ENET */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Start the receive operation */
ETH->DMARPDR = 1;
/* Return no error */
return size;
}
/*---------------------------------------------------------------------------*/
void netdev_send(void)
{
while(EnetDmaTx.Tx.TxDesc0.OWN);
/* Copy the application buffer to the driver buffer
Using this MEMCOPY_L2L_BY4 makes the copy routine faster
than memcpy */
memcpy(TxBuff, uip_buf, uip_len);
/* Assign ENET address to Temp Tx Array */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Setting the Frame Length*/
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.LSEG = 1;
EnetDmaTx.Tx.TxDesc0.FS = 1;
EnetDmaTx.Tx.TxDesc0.DC = 0;
EnetDmaTx.Tx.TxDesc0.DP = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
EnetDmaTx.Tx.TxDesc1.TBS1 = (uip_len&0xFFF);
/* Start the ENET by setting the VALID bit in dmaPackStatus of current descr*/
EnetDmaTx.Tx.TxDesc0.OWN = 1;
/* Start the transmit operation */
ETH->DMATPDR = 1;
}
/*---------------------------------------------------------------------------*/
static void netdev_RxDscrInit(void)
{
/* Initialization */
/* Assign temp Rx array to the ENET buffer */
EnetDmaRx.Rx.pBuffer = (uint32_t *)RxBuff;
/* Initialize RX ENET Status and control */
EnetDmaRx.Rx.RxDesc0.Data = 0;
/* Initialize the next descriptor- In our case its single descriptor */
EnetDmaRx.Rx.pEnetDmaNextDesc = &EnetDmaRx;
EnetDmaRx.Rx.RxDesc1.Data = 0;
EnetDmaRx.Rx.RxDesc1.RER = 0; // end of ring
EnetDmaRx.Rx.RxDesc1.RCH = 1; // end of ring
/* Set the max packet size */
EnetDmaRx.Rx.RxDesc1.RBS1 = UIP_CONF_BUFFER_SIZE;
/* Setting the VALID bit */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Setting the RX NEXT Descriptor Register inside the ENET */
ETH->DMARDLAR = (uint32_t)&EnetDmaRx;
}
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void)
{
/* ENET Start Address */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Next Descriptor Address */
EnetDmaTx.Tx.pEnetDmaNextDesc = &EnetDmaTx;
/* Initialize ENET status and control */
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
/* Tx next set to Tx descriptor base */
ETH->DMATDLAR = (uint32_t)&EnetDmaTx;
}

View File

@ -0,0 +1,46 @@
/*
* 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);
unsigned int netdev_read(void);
void netdev_send(void);
#endif /* __NETDEV_H__ */

View File

@ -0,0 +1,151 @@
/**
* \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
/**
* uIP buffer size.
*
* \hideinitializer
*/
#define UIP_CONF_BUFFER_SIZE 1600
/**
* CPU byte order.
*
* \hideinitializer
*/
#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN
/**
* Logging on or off
*
* \hideinitializer
*/
#define UIP_CONF_LOGGING 0
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 0
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 1
/**
* 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"
#endif /* __UIP_CONF_H__ */
/** @} */
/** @} */

View File

@ -53,6 +53,8 @@ void main(void)
{
/* initialize the microcontroller */
Init();
/* initialize the network application */
NetInit();
/* initialize the bootloader interface */
BootComInit();
@ -61,6 +63,8 @@ void main(void)
{
/* toggle LED with a fixed frequency */
LedToggle();
/* run the network task */
NetTask();
/* check for bootloader activation request */
BootComCheckActivationRequest();
}

View File

@ -1,7 +1,7 @@
MEMORY
{
UNPLACED_SECTIONS (wx) : ORIGIN = 0x100000000, LENGTH = 0
FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 0x00100000-0x8000
FLASH (rx) : ORIGIN = 0x0800C000, LENGTH = 0x00100000-0xC000
DATA_SRAM (wx) : ORIGIN = 0x10000000, LENGTH = 0x00010000
SYSTEM (wx) : ORIGIN = 0x1fff0000, LENGTH = 0x00007a10
OPTION (wx) : ORIGIN = 0x1fffc000, LENGTH = 0x00000008
@ -28,7 +28,7 @@ MEMORY
SECTIONS
{
__FLASH_segment_start__ = 0x08008000;
__FLASH_segment_start__ = 0x0800C000;
__FLASH_segment_end__ = 0x08100000;
__DATA_SRAM_segment_start__ = 0x10000000;
__DATA_SRAM_segment_end__ = 0x10010000;

View File

@ -0,0 +1,211 @@
/************************************************************************************//**
* \file Demo\ARMCM3_LM3S_EK_LM3S6965_IAR\Prog\net.c
* \brief Network application for the uIP TCP/IP stack.
* \ingroup Prog_ARMCM3_LM3S_EK_LM3S6965_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 should have received a copy of the GNU General Public License along with OpenBLT.
* If not, see <http://www.gnu.org/licenses/>.
*
* A special exception to the GPL is included to allow you to distribute a combined work
* that includes OpenBLT without being obliged to provide the source code for any
* proprietary components. The exception text is included at the bottom of the license
* file <license.html>.
*
* \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;
/************************************************************************************//**
** \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();
/* 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);
/* 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();
} /*** 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))
{
/* 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;
}
}
}
/* 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,66 @@
/************************************************************************************//**
* \file Demo\ARMCM3_LM3S_EK_LM3S6965_IAR\Prog\net.h
* \brief Network application for the uIP TCP/IP stack.
* \ingroup Prog_ARMCM3_LM3S_EK_LM3S6965_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 should have received a copy of the GNU General Public License along with OpenBLT.
* If not, see <http://www.gnu.org/licenses/>.
*
* A special exception to the GPL is included to allow you to distribute a combined work
* that includes OpenBLT without being obliged to provide the source code for any
* proprietary components. The exception text is included at the bottom of the license
* file <license.html>.
*
* \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

@ -7,43 +7,45 @@ start address 0x08000000
Program Header:
LOAD off 0x00008000 vaddr 0x08000000 paddr 0x08000000 align 2**15
filesz 0x00005e50 memsz 0x00005e50 flags r-x
LOAD off 0x00010000 vaddr 0x20000000 paddr 0x08005e50 align 2**15
filesz 0x00000020 memsz 0x0000183c flags rw-
filesz 0x00007f98 memsz 0x00007f98 flags r-x
LOAD off 0x00010000 vaddr 0x20000000 paddr 0x08007f98 align 2**15
filesz 0x00000020 memsz 0x00000020 flags rw-
LOAD off 0x00010080 vaddr 0x20000080 paddr 0x08008080 align 2**15
filesz 0x00000000 memsz 0x00002ce4 flags rw-
private flags = 5000202: [Version5 EABI] [soft-float ABI] [has entry point]
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00005e50 08000000 08000000 00008000 2**2
0 .text 00007f98 08000000 08000000 00008000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000020 20000000 08005e50 00010000 2**2
1 .data 00000020 20000000 08007f98 00010000 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 0000181c 20000020 08005e70 00010020 2**3
2 .bss 00002ce4 20000080 08008080 00010080 2**7
ALLOC
3 .debug_info 0000e1fa 00000000 00000000 00010020 2**0
3 .debug_info 00012d6c 00000000 00000000 00010020 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_abbrev 000028bd 00000000 00000000 0001e21a 2**0
4 .debug_abbrev 00003711 00000000 00000000 00022d8c 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_loc 00009eca 00000000 00000000 00020ad7 2**0
5 .debug_loc 0000b735 00000000 00000000 0002649d 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_aranges 00000c10 00000000 00000000 0002a9a1 2**0
6 .debug_aranges 000010d8 00000000 00000000 00031bd2 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_ranges 00000ba0 00000000 00000000 0002b5b1 2**0
7 .debug_ranges 00001008 00000000 00000000 00032caa 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_line 000044b6 00000000 00000000 0002c151 2**0
8 .debug_line 00005d54 00000000 00000000 00033cb2 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_str 00003a4f 00000000 00000000 00030607 2**0
9 .debug_str 0000553c 00000000 00000000 00039a06 2**0
CONTENTS, READONLY, DEBUGGING
10 .comment 00000030 00000000 00000000 00034056 2**0
10 .comment 00000030 00000000 00000000 0003ef42 2**0
CONTENTS, READONLY
11 .ARM.attributes 00000033 00000000 00000000 00034086 2**0
11 .ARM.attributes 00000033 00000000 00000000 0003ef72 2**0
CONTENTS, READONLY
12 .debug_frame 00001f58 00000000 00000000 000340bc 2**2
12 .debug_frame 00002ab4 00000000 00000000 0003efa8 2**2
CONTENTS, READONLY, DEBUGGING
SYMBOL TABLE:
08000000 l d .text 00000000 .text
20000000 l d .data 00000000 .data
20000020 l d .bss 00000000 .bss
20000080 l d .bss 00000000 .bss
00000000 l d .debug_info 00000000 .debug_info
00000000 l d .debug_abbrev 00000000 .debug_abbrev
00000000 l d .debug_loc 00000000 .debug_loc
@ -57,255 +59,335 @@ SYMBOL TABLE:
00000000 l df *ABS* 00000000 vectors.c
00000000 l df *ABS* 00000000 cstart.c
080001d4 l F .text 00000000 zero_loop2
080053ea l F .text 00000000 zero_loop
08007482 l F .text 00000000 zero_loop
00000000 l df *ABS* 00000000 hooks.c
080054b0 l O .text 00000020 firmwareFilename
20000020 l O .bss 00000228 logfile
080075e8 l O .text 00000020 firmwareFilename
20000080 l O .bss 00000228 logfile
00000000 l df *ABS* 00000000 main.c
00000000 l df *ABS* 00000000 mmc.c
08000400 l F .text 0000004e CmdResp2Error
08000450 l F .text 00000130 CmdResp1Error
08000580 l F .text 0000024e SDEnWideBus
20000248 l O .bss 00000001 TransferError
200002a8 l O .bss 00000001 TransferError
20000000 l O .data 00000004 DMAEndOfTransfer
2000024c l O .bss 00000018 SDIO_DataInitStructure
20000264 l O .bss 00000010 CSD_Tab
20000274 l O .bss 00000004 CardType
20000278 l O .bss 00000010 CID_Tab
20000288 l O .bss 00000004 TransferEnd
2000028c l O .bss 00000018 SDIO_InitStructure
200002a4 l O .bss 00000004 RCA
200002a8 l O .bss 00000058 SDCardInfo
20000300 l O .bss 00000014 SDIO_CmdInitStructure
200002ac l O .bss 00000018 SDIO_DataInitStructure
200002c4 l O .bss 00000010 CSD_Tab
200002d4 l O .bss 00000004 CardType
200002d8 l O .bss 00000010 CID_Tab
200002e8 l O .bss 00000004 TransferEnd
200002ec l O .bss 00000018 SDIO_InitStructure
20000304 l O .bss 00000004 RCA
20000308 l O .bss 00000058 SDCardInfo
20000360 l O .bss 00000014 SDIO_CmdInitStructure
20000004 l O .data 00000001 Stat
20000314 l O .bss 00000004 StopCondition
20000374 l O .bss 00000004 StopCondition
00000000 l df *ABS* 00000000 stm32_eth.c
00000000 l df *ABS* 00000000 netdev.c
00000000 l df *ABS* 00000000 stm32f4xx_flash.c
00000000 l df *ABS* 00000000 stm32f4xx_gpio.c
00000000 l df *ABS* 00000000 stm32f4xx_rcc.c
20000008 l O .data 00000010 APBAHBPrescTable
00000000 l df *ABS* 00000000 stm32f4xx_sdio.c
00000000 l df *ABS* 00000000 stm32f4xx_syscfg.c
00000000 l df *ABS* 00000000 stm32f4xx_usart.c
00000000 l df *ABS* 00000000 system_stm32f4xx.c
00000000 l df *ABS* 00000000 ff.c
08001da8 l F .text 00000012 mem_cpy
08001dbc l F .text 0000001e ld_clust
08001ddc l F .text 0000001e sum_sfn
08001dfc l F .text 00000096 check_fs
08001e94 l F .text 00000076 sync_window
08001f0c l F .text 00000032 move_window
08001f40 l F .text 00000038 validate
08001f78 l F .text 00000394 chk_mounted
0800230c l F .text 0000012c get_fileinfo
08002438 l F .text 000000bc sync_fs
080025f8 l F .text 00000098 dir_sdi
080027a0 l F .text 000000cc create_chain
0800286c l F .text 0000012a dir_next
08002998 l F .text 000001a2 dir_find
08002b3c l F .text 00000332 follow_path
08002e70 l F .text 00000130 dir_read
08002fa0 l F .text 00000058 dir_remove
08002ff8 l F .text 0000006e remove_chain
08003100 l F .text 00000236 dir_register
20000318 l O .bss 00000200 LfnBuf
20000518 l O .bss 00000002 Fsid
080054f4 l O .text 00000080 ExCvt
08005574 l O .text 0000000d LfnOfs
2000051c l O .bss 00000004 FatFs
0800261c l F .text 00000012 mem_cpy
08002630 l F .text 0000001e ld_clust
08002650 l F .text 0000001e sum_sfn
08002670 l F .text 00000096 check_fs
08002708 l F .text 00000076 sync_window
08002780 l F .text 00000032 move_window
080027b4 l F .text 00000038 validate
080027ec l F .text 00000394 chk_mounted
08002b80 l F .text 0000012c get_fileinfo
08002cac l F .text 000000bc sync_fs
08002e6c l F .text 00000098 dir_sdi
08003014 l F .text 000000cc create_chain
080030e0 l F .text 0000012a dir_next
0800320c l F .text 000001a2 dir_find
080033b0 l F .text 00000332 follow_path
080036e4 l F .text 00000130 dir_read
08003814 l F .text 00000058 dir_remove
0800386c l F .text 0000006e remove_chain
08003974 l F .text 00000236 dir_register
20000378 l O .bss 00000200 LfnBuf
20000578 l O .bss 00000002 Fsid
08007640 l O .text 00000080 ExCvt
080076c0 l O .text 0000000d LfnOfs
2000057c l O .bss 00000004 FatFs
00000000 l df *ABS* 00000000 unicode.c
08005584 l O .text 000001e0 tbl_lower.4259
08005764 l O .text 00000100 Tbl
08005864 l O .text 000001e0 tbl_upper.4260
080076d0 l O .text 000001e0 tbl_lower.4259
080078b0 l O .text 00000100 Tbl
080079b0 l O .text 000001e0 tbl_upper.4260
00000000 l df *ABS* 00000000 uip.c
08004550 l F .text 0000004c chksum
0800459c l F .text 00000042 upper_layer_chksum
08004660 l F .text 00000030 uip_add_rcv_nxt
20000580 l O .bss 00000002 tmp16
20000582 l O .bss 00000002 ipid
20000584 l O .bss 00000004 iss
20000588 l O .bss 00000002 lastport
20000594 l O .bss 00000001 c
20000595 l O .bss 00000001 opt
00000000 l df *ABS* 00000000 uip_arp.c
08005680 l F .text 00000116 uip_arp_update
20000596 l O .bss 00000001 i
20000597 l O .bss 00000001 tmpage
20000598 l O .bss 00000060 arp_table
08007b90 l O .text 00000006 broadcast_ethaddr
200005f8 l O .bss 00000001 c
200005f9 l O .bss 00000001 arptime
200005fc l O .bss 00000004 ipaddr
00000000 l df *ABS* 00000000 boot.c
00000000 l df *ABS* 00000000 com.c
20000520 l O .bss 00000001 comEntryStateConnect
20000600 l O .bss 00000001 comEntryStateConnect
20000018 l O .data 00000001 comActiveInterface
20000524 l O .bss 00000040 xcpCtoReqPacket.4403
20000604 l O .bss 00000040 xcpCtoReqPacket.4419
00000000 l df *ABS* 00000000 net.c
20000644 l O .bss 00000004 ARPTimerTimeOut
20000648 l O .bss 00000004 periodicTimerTimeOut
00000000 l df *ABS* 00000000 xcp.c
08003e40 l F .text 00000016 XcpSetCtoError
08005a44 l O .text 00000008 xcpStationId
20000564 l O .bss 0000004c xcpInfo
08005ec4 l F .text 00000016 XcpSetCtoError
08007b98 l O .text 00000008 xcpStationId
2000064c l O .bss 0000004c xcpInfo
00000000 l df *ABS* 00000000 backdoor.c
200005b0 l O .bss 00000001 backdoorOpen
200005b4 l O .bss 00000004 backdoorOpenTime
20000698 l O .bss 00000001 backdoorOpen
2000069c l O .bss 00000004 backdoorOpenTime
00000000 l df *ABS* 00000000 cop.c
00000000 l df *ABS* 00000000 file.c
08004294 l F .text 0000002e FileLibByteNibbleToChar
080042c4 l F .text 00000020 FileLibByteToHexString
080042e4 l F .text 00000046 FileLibLongToIntString
0800432c l F .text 00000066 FileLibHexStringToByte
200005b8 l O .bss 00000040 loggingStr
200005f8 l O .bss 00000001 firmwareUpdateState
200005fc l O .bss 00000008 eraseInfo
20000604 l O .bss 00000458 fatFsObjects
20000a5c l O .bss 00000184 lineParseObject
0800631c l F .text 0000002e FileLibByteNibbleToChar
0800634c l F .text 00000020 FileLibByteToHexString
0800636c l F .text 00000046 FileLibLongToIntString
080063b4 l F .text 00000066 FileLibHexStringToByte
200006a0 l O .bss 00000040 loggingStr
200006e0 l O .bss 00000001 firmwareUpdateState
200006e4 l O .bss 00000008 eraseInfo
200006ec l O .bss 00000458 fatFsObjects
20000b44 l O .bss 00000184 lineParseObject
00000000 l df *ABS* 00000000 assert.c
20000be0 l O .bss 00000004 assert_failure_file
20000be4 l O .bss 00000004 assert_failure_line
20000cc8 l O .bss 00000004 assert_failure_file
20000ccc l O .bss 00000004 assert_failure_line
00000000 l df *ABS* 00000000 can.c
08005c30 l O .text 00000024 canTiming
08007d84 l O .text 00000024 canTiming
00000000 l df *ABS* 00000000 cpu.c
00000000 l df *ABS* 00000000 flash.c
08004d98 l F .text 00000044 FlashGetSector
08004ddc l F .text 00000078 FlashWriteBlock
08004e54 l F .text 00000062 FlashSwitchBlock
08004eb8 l F .text 00000084 FlashAddToBlock
08005c54 l O .text 00000030 flashSectorNumToMask
08005c84 l O .text 00000078 flashLayout
20000be8 l O .bss 00000204 bootBlockInfo
20000dec l O .bss 00000204 blockInfo
08006e24 l F .text 00000044 FlashGetSector
08006e68 l F .text 00000078 FlashWriteBlock
08006ee0 l F .text 00000062 FlashSwitchBlock
08006f44 l F .text 00000084 FlashAddToBlock
08007da8 l O .text 00000030 flashSectorNumToMask
08007dd8 l O .text 0000006c flashLayout
20000cd0 l O .bss 00000204 bootBlockInfo
20000ed4 l O .bss 00000204 blockInfo
00000000 l df *ABS* 00000000 uart.c
08005140 l F .text 00000042 UartTransmitByte
08005184 l F .text 0000002c UartReceiveByte
20000ff0 l O .bss 00000041 xcpCtoReqPacket.7782
20001034 l O .bss 00000001 xcpCtoRxLength.7783
20001035 l O .bss 00000001 xcpCtoRxInProgress.7784
080071d8 l F .text 00000042 UartTransmitByte
0800721c l F .text 0000002c UartReceiveByte
200010d8 l O .bss 00000041 xcpCtoReqPacket.7784
2000111c l O .bss 00000001 xcpCtoRxLength.7785
2000111d l O .bss 00000001 xcpCtoRxInProgress.7786
00000000 l df *ABS* 00000000 nvm.c
00000000 l df *ABS* 00000000 timer.c
20001038 l O .bss 00000004 millisecond_counter
20001120 l O .bss 00000004 millisecond_counter
00000000 l df *ABS* 00000000 memcpy-stub.c
00000000 l df *ABS* 00000000 memset.c
00000000 l df *ABS* 00000000 ctype_.c
00000000 l df *ABS* 00000000
00000800 l *ABS* 00000000 __STACKSIZE__
08003d10 g F .text 00000044 ComInit
08004f58 g F .text 00000050 FlashWrite
08003bb0 g F .text 0000004e f_gets
08001678 g F .text 0000002c FLASH_Unlock
08004a90 g F .text 0000001c AssertFailure
0800250c g F .text 000000ea get_fat
08004cbc g F .text 00000088 CanReceivePacket
080053a8 g F .text 00000058 reset_handler
0800189c g F .text 00000028 GPIO_PinAFConfig
0800535c g F .text 00000022 TimerUpdate
08003e88 g F .text 00000010 XcpPacketTransmitted
08003d54 g F .text 00000054 ComTask
08001b64 g F .text 0000000c SDIO_ClearFlag
08005b28 g F .text 0000004c ComInit
08006fe4 g F .text 00000050 FlashWrite
08004424 g F .text 0000004e f_gets
08001ebc g F .text 0000002c FLASH_Unlock
08001b3c g F .text 00000012 ETH_FlushTransmitFIFO
08006b18 g F .text 0000001c AssertFailure
08002d80 g F .text 000000ea get_fat
08006d44 g F .text 00000088 CanReceivePacket
08007440 g F .text 00000058 reset_handler
080020e0 g F .text 00000028 GPIO_PinAFConfig
080073f4 g F .text 00000022 TimerUpdate
08005f0c g F .text 00000010 XcpPacketTransmitted
08001690 g F .text 0000009e ETH_StructInit
08005b74 g F .text 0000007c ComTask
080023cc g F .text 0000000c SDIO_ClearFlag
080014b8 g F .text 00000018 SD_GetStatus
080017c0 g F .text 0000003e FLASH_ProgramWord
08003e28 g F .text 0000000e ComSetConnectEntryState
08001a88 g F .text 0000000c SDIO_SetPowerState
08003cdc g F .text 0000001c BootInit
08004458 g F .text 00000038 FileSrecVerifyChecksum
08004268 g F .text 00000022 BackDoorInit
08001c7c g F .text 0000000c USART_GetFlagStatus
08004290 g F .text 00000002 CopService
08005e50 g .text 00000000 _etext
08002004 g F .text 0000003e FLASH_ProgramWord
08005c78 g F .text 0000000e ComSetConnectEntryState
080022f0 g F .text 0000000c SDIO_SetPowerState
08001808 g F .text 000002be ETH_Init
20001e90 g O .bss 00000002 uip_len
2000058c g O .bss 00000006 uip_ethaddr
080045e0 g F .text 0000007e uip_add32
08005af4 g F .text 0000001c BootInit
080064e0 g F .text 00000038 FileSrecVerifyChecksum
080062f0 g F .text 00000022 BackDoorInit
08002250 g F .text 00000024 RCC_AHB1PeriphResetCmd
080024f0 g F .text 0000000c USART_GetFlagStatus
08006318 g F .text 00000002 CopService
08007f98 g .text 00000000 _etext
080012a4 g F .text 0000019a SD_WriteBlock
08003cac g F .text 0000002e ff_wtoupper
08005408 g F .text 000000a6 memcpy
08004610 g F .text 00000480 FileTask
0800534c g F .text 0000000e TimerReset
08004520 g F .text 0000002e ff_wtoupper
08001e0c g F .text 00000050 netdev_read
08004728 g F .text 00000f1e uip_process
080071cc g F .text 0000000a FlashGetUserProgBaseAddress
08001678 g F .text 00000018 ETH_DeInit
080074a0 g F .text 000000a6 memcpy
08006698 g F .text 00000480 FileTask
080073e4 g F .text 0000000e TimerReset
080014d0 g F .text 00000038 disk_initialize
20001e94 g O .bss 00000004 uip_sappdata
08001bc0 g F .text 00000226 netdev_init
20001e98 g O .bss 00000004 uip_acc32
08004690 g F .text 00000024 uip_ipchksum
08000c20 g F .text 000002b6 SD_GetCardInfo
08001b50 g F .text 00000014 SDIO_GetFlagStatus
08001c74 g F .text 00000008 USART_ReceiveData
08003cf8 g F .text 00000018 BootTask
080023b8 g F .text 00000014 SDIO_GetFlagStatus
080024e8 g F .text 00000008 USART_ReceiveData
08005b10 g F .text 00000018 BootTask
0800148c g F .text 0000002c SD_GetState
08005034 g F .text 00000058 FlashWriteChecksum
080070c0 g F .text 00000058 FlashWriteChecksum
08000ed8 g F .text 00000084 SD_EnableWideBusOperation
080019e8 g F .text 00000024 RCC_APB2PeriphClockCmd
08001ad4 g F .text 0000000e SDIO_GetCommandResponse
08003dac g F .text 00000034 ComTransmitPacket
08001800 g F .text 00000090 GPIO_Init
0800222c g F .text 00000024 RCC_APB2PeriphClockCmd
0800233c g F .text 0000000e SDIO_GetCommandResponse
08005bf4 g F .text 0000004a ComTransmitPacket
08002044 g F .text 00000090 GPIO_Init
08001508 g F .text 00000032 disk_status
08004490 g F .text 0000017e FileSrecParseLine
08001c50 g F .text 0000001c USART_Cmd
08006518 g F .text 0000017e FileSrecParseLine
080046f4 g F .text 00000032 uip_listen
080024c4 g F .text 0000001c USART_Cmd
08001e5c g F .text 00000060 netdev_send
0800160c g F .text 00000062 disk_ioctl
080043d4 g F .text 00000036 FileHandleFirmwareUpdateRequest
080019c4 g F .text 00000024 RCC_APB1PeriphClockCmd
08003068 g F .text 00000098 gen_numname
0800645c g F .text 00000036 FileHandleFirmwareUpdateRequest
08002208 g F .text 00000024 RCC_APB1PeriphClockCmd
080038dc g F .text 00000098 gen_numname
20001e9c g O .bss 00000001 uip_flags
20001180 g O .bss 00000010 EnetDmaRx
08000280 g F .text 00000042 FileFirmwareUpdateCompletedHook
08003e74 g F .text 00000012 XcpIsConnected
08003af4 g F .text 000000bc f_unlink
080052f0 g F .text 00000008 NvmInit
08004f3c g F .text 0000001a FlashInit
080016a4 g F .text 00000012 FLASH_Lock
2000103c g .bss 00000000 _ebss
08003c00 g F .text 00000034 f_putc
08003c34 g F .text 0000002c f_puts
08005394 g F .text 00000012 UnusedISR
08001a7c g F .text 0000000c SDIO_ClockCmd
08003da8 g F .text 00000002 ComFree
08001b00 g F .text 00000030 SDIO_DataConfig
080051b0 g F .text 0000003e UartInit
080018c4 g F .text 000000da RCC_GetClocksFreq
08005300 g F .text 00000008 NvmErase
08001b70 g F .text 000000de USART_Init
20000020 g .bss 00000000 _bss
080038fc g F .text 00000014 f_close
080016c4 g F .text 00000054 FLASH_GetStatus
08003e98 g F .text 00000384 XcpPacketReceived
080016b8 g F .text 0000000c FLASH_ClearFlag
08001718 g F .text 00000038 FLASH_WaitForLastOperation
080034d0 g F .text 000001a8 f_read
080050f4 g F .text 0000004c FlashDone
08005ef8 g F .text 00000012 XcpIsConnected
08004368 g F .text 000000bc f_unlink
08001ac8 g F .text 00000026 ETH_MACTransmissionCmd
08007388 g F .text 00000008 NvmInit
08006fc8 g F .text 0000001a FlashInit
08001ee8 g F .text 00000012 FLASH_Lock
20002564 g .bss 00000000 _ebss
08004474 g F .text 00000034 f_putc
080044a8 g F .text 0000002c f_puts
0800742c g F .text 00000012 UnusedISR
080022e4 g F .text 0000000c SDIO_ClockCmd
08005bf0 g F .text 00000002 ComFree
08002368 g F .text 00000030 SDIO_DataConfig
08001b18 g F .text 00000012 ETH_SoftwareReset
080017a0 g F .text 00000068 ETH_WritePHYRegister
08007248 g F .text 0000003e UartInit
08002108 g F .text 000000da RCC_GetClocksFreq
08007398 g F .text 00000008 NvmErase
08001de8 g F .text 00000022 netdev_init_mac
080023e4 g F .text 000000de USART_Init
20000080 g .bss 00000000 _bss
08004170 g F .text 00000014 f_close
08001f08 g F .text 00000054 FLASH_GetStatus
08005f1c g F .text 00000384 XcpPacketReceived
080046b4 g F .text 0000000a uip_tcpchksum
08001efc g F .text 0000000c FLASH_ClearFlag
08001f5c g F .text 00000038 FLASH_WaitForLastOperation
08001b78 g F .text 00000026 ETH_DMAReceptionCmd
08003d44 g F .text 000001a8 f_read
08007180 g F .text 0000004c FlashDone
08000f88 g F .text 00000172 SD_Init
08000188 g F .text 00000064 EntryFromProg
20001ea0 g O .bss 00000004 uip_appdata
20001ea4 g O .bss 00000004 uip_conn
08001b2c g F .text 00000010 ETH_GetSoftwareResetStatus
08000f5c g F .text 0000002c SD_SelectDeselect
08004c14 g F .text 000000a8 CanTransmitPacket
08001aa4 g F .text 00000030 SDIO_SendCommand
08006c9c g F .text 000000a8 CanTransmitPacket
0800230c g F .text 00000030 SDIO_SendCommand
08001730 g F .text 0000006e ETH_ReadPHYRegister
20001ea8 g O .bss 00000068 uip_conns
08001670 g F .text 00000008 get_fattime
08003e58 g F .text 0000001c XcpInit
08004394 g F .text 0000002c FileInit
08001b30 g F .text 0000000e SDIO_ReadData
08004fa8 g F .text 0000008a FlashErase
08005edc g F .text 0000001c XcpInit
0800641c g F .text 0000002c FileInit
08002398 g F .text 0000000e SDIO_ReadData
08005924 g F .text 000001d0 uip_arp_out
08007034 g F .text 0000008a FlashErase
08007548 g F .text 0000009e memset
080002c4 g F .text 00000020 FileFirmwareUpdateErrorHook
08000344 g F .text 000000bc main
08001750 g F .text 0000006e FLASH_EraseSector
08003850 g F .text 000000ac f_sync
08001f94 g F .text 0000006e FLASH_EraseSector
080040c4 g F .text 000000ac f_sync
08001440 g F .text 0000004c SD_SendStatus
0800440c g F .text 0000004c FileSrecGetLineType
08005310 g F .text 00000012 NvmDone
08003338 g F .text 0000002a f_mount
080051f0 g F .text 00000066 UartTransmitPacket
08005308 g F .text 00000008 NvmVerifyChecksum
08004d70 g F .text 0000001e CpuMemCopy
08001ae4 g F .text 0000001a SDIO_GetResponse
08001c88 g F .text 00000120 SystemInit
08002690 g F .text 0000010e put_fat
08003910 g F .text 00000198 f_lseek
08003e04 g F .text 00000024 ComGetActiveInterfaceMaxTxLen
08005258 g F .text 00000098 UartReceivePacket
08006494 g F .text 0000004c FileSrecGetLineType
080073a8 g F .text 00000012 NvmDone
08003bac g F .text 0000002a f_mount
08007288 g F .text 00000066 UartTransmitPacket
080073a0 g F .text 00000008 NvmVerifyChecksum
08006dfc g F .text 0000001e CpuMemCopy
0800234c g F .text 0000001a SDIO_GetResponse
080024fc g F .text 00000120 SystemInit
08002f04 g F .text 0000010e put_fat
08004184 g F .text 00000198 f_lseek
080023d8 g F .text 0000000a SYSCFG_ETH_MediaInterfaceConfig
080057f0 g F .text 00000134 uip_arp_arpin
08005c5c g F .text 0000001c ComGetActiveInterfaceMaxTxLen
080072f0 g F .text 00000098 UartReceivePacket
08000244 g F .text 0000000a FileGetFirmwareFilenameHook
080010fc g F .text 000001a6 SD_ReadBlock
08005798 g F .text 00000058 uip_arp_timer
20001f10 g O .bss 00000002 uip_listenports
20001f14 g O .bss 00000004 uip_draddr
20000000 g .data 00000000 _data
08003aa8 g F .text 0000004a f_stat
0800428c g F .text 00000002 CopInit
08004d90 g F .text 00000008 CpuReset
08001ba0 g F .text 00000020 ETH_Start
20001190 g O .bss 00000640 RxBuff
0800431c g F .text 0000004a f_stat
08006314 g F .text 00000002 CopInit
08006e1c g F .text 00000008 CpuReset
080007d0 g F .text 0000002c SD_Detect
08004aac g F .text 00000168 CanInit
080052f8 g F .text 00000008 NvmWrite
08004d44 g F .text 0000002c CpuStartUserProgram
080024f4 g F .text 00000016 clust2sect
2000183c g .bss 00000000 _estack
08001c6c g F .text 00000008 USART_SendData
0800508c g F .text 00000068 FlashVerifyChecksum
08006b34 g F .text 00000168 CanInit
08007390 g F .text 00000008 NvmWrite
08006dcc g F .text 00000030 CpuStartUserProgram
08002d68 g F .text 00000016 clust2sect
20002d64 g .bss 00000000 _estack
080024e0 g F .text 00000008 USART_SendData
08007118 g F .text 00000068 FlashVerifyChecksum
08005d04 g F .text 00000044 NetTransmitPacket
20000020 g .data 00000000 _edata
080043c0 g F .text 00000014 FileIsIdle
08003678 g F .text 000001d8 f_write
08006448 g F .text 00000014 FileIsIdle
08005648 g F .text 0000000a htons
08003eec g F .text 000001d8 f_write
08000000 g O .text 00000188 _vectab
08003364 g F .text 0000016a f_open
08003bd8 g F .text 0000016a f_open
080015a0 g F .text 0000006c disk_write
08001af0 g F .text 00000026 ETH_MACReceptionCmd
080002e4 g F .text 00000060 FileFirmwareUpdateLogHook
200017d0 g O .bss 00000640 TxBuff
2000001c g O .data 00000004 __ctype_ptr__
08003e38 g F .text 00000008 ComIsConnected
08005d4c g O .text 00000101 _ctype_
08001a48 g F .text 00000034 SDIO_Init
08005c88 g F .text 00000008 ComIsConnected
08007e94 g O .text 00000101 _ctype_
08001b50 g F .text 00000026 ETH_DMATransmissionCmd
080022b0 g F .text 00000034 SDIO_Init
08000200 g F .text 00000044 FileIsFirmwareUpdateRequestedHook
080046c0 g F .text 00000032 uip_init
080007fc g F .text 0000027e SD_PowerON
08003de0 g F .text 00000024 ComGetActiveInterfaceMaxRxLen
080019a0 g F .text 00000024 RCC_AHB1PeriphClockCmd
08005c40 g F .text 0000001c ComGetActiveInterfaceMaxRxLen
080021e4 g F .text 00000024 RCC_AHB1PeriphClockCmd
08005d48 g F .text 0000010a NetReceivePacket
0800153c g F .text 00000064 disk_read
0800421c g F .text 0000004a BackDoorCheck
2000103c g .bss 00000000 _stack
08001a0c g F .text 00000024 RCC_APB2PeriphResetCmd
08003c60 g F .text 0000004a ff_convert
08005380 g F .text 00000012 TimerGet
08001a94 g F .text 00000010 SDIO_GetPowerState
080062a0 g F .text 0000004e BackDoorCheck
20002564 g .bss 00000000 _stack
08002274 g F .text 00000024 RCC_APB2PeriphResetCmd
20001f18 g O .bss 00000004 uip_netmask
20001f1c g O .bss 00000004 uip_hostaddr
080044d4 g F .text 0000004a ff_convert
08007418 g F .text 00000012 TimerGet
080022fc g F .text 00000010 SDIO_GetPowerState
20001e80 g O .bss 00000010 EnetDmaTx
08005e54 g F .text 00000070 NetApp
08005c90 g F .text 00000074 NetInit
08000a7c g F .text 000001a4 SD_InitializeCards
08001890 g F .text 0000000c GPIO_ReadInputDataBit
08005324 g F .text 00000028 TimerInit
08001b40 g F .text 0000000e SDIO_WriteData
080020d4 g F .text 0000000c GPIO_ReadInputDataBit
080073bc g F .text 00000028 TimerInit
080023a8 g F .text 0000000e SDIO_WriteData
20001f20 g O .bss 00000642 uip_buf
08005654 g F .text 0000002a uip_send
20002562 g O .bss 00000002 uip_slen
08000250 g F .text 00000030 FileFirmwareUpdateStartedHook
08001a30 g F .text 00000018 SDIO_DeInit
08002298 g F .text 00000018 SDIO_DeInit

View File

@ -108,6 +108,82 @@
#define BOOT_COM_UART_CHANNEL_INDEX (5)
/* 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 configued with the macros
* 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.
*/
/** \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 Configure the 1st byte of the IP address */
#define BOOT_COM_NET_IPADDR0 (169)
/** \brief Configure the 2nd byte of the IP address */
#define BOOT_COM_NET_IPADDR1 (254)
/** \brief Configure the 3rd byte of the IP address */
#define BOOT_COM_NET_IPADDR2 (19)
/** \brief Configure the 4th byte of the IP address */
#define BOOT_COM_NET_IPADDR3 (63)
/** \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 (0)
/** \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 (169)
/** \brief Configure the 2nd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY1 (254)
/** \brief Configure the 3rd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY2 (19)
/** \brief Configure the 4th byte of the gateway address */
#define BOOT_COM_NET_GATEWAY3 (1)
/** \brief Enable/disable a hook function that is called when the IP address is about
* to be set. This allows a dynamic override of the BOOT_COM_NET_IPADDRx values.
*/
#define BOOT_COM_NET_IPADDR_HOOK_ENABLE (0)
/** \brief Enable/disable a hook function that is called when the netmask is about
* to be set. This allows a dynamic override of the BOOT_COM_NET_NETMASKx values.
*/
#define BOOT_COM_NET_NETMASK_HOOK_ENABLE (0)
/** \brief Enable/disable a hook function that is called when the gateway address is
* about to be set. This allows a dynamic override of the BOOT_COM_NET_GATEWAYx
* values.
*/
#define BOOT_COM_NET_GATEWAY_HOOK_ENABLE (0)
/****************************************************************************************
* B A C K D O O R C O N F I G U R A T I O N
****************************************************************************************/
#if (BOOT_COM_NET_ENABLE > 0)
/* Override the default time that the backdoor is open if firmware updates via TCP/IP
* are supported. in this case a reactivation of the bootloader results in a re-
* initialization of the ethernet MAC. when directly connected to the ethernet port of
* a PC this will go relatively fast (depending on what MS Windows is being used), but
* when connected to the network via a router this can take several seconds. feel free to
* shorten/lengthen this time for finetuning. the only downside of a long backdoor open
* time is that the starting of the user program will also be delayed for this time.
*
* Also note that when the target is directly connected to the ethernet port of a PC,
* the checkbox "Automatically retry socket connection" should be checked in the
* Microboot settings. if connecting via a router the uncheck this checkbox.
*/
#define BACKDOOR_ENTRY_TIMEOUT_MS (10000)
#endif
/****************************************************************************************
* F I L E S Y S T E M I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/

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,451 @@
/*
* 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 "stm32f4xx.h" /* STM32 registers */
#include "stm32f4xx_conf.h" /* STM32 peripheral drivers */
#include "stm32_eth.h" /* STM32 ethernet library */
#include <string.h> /* for memcpy */
/*---------------------------------------------------------------------------*/
#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)
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void);
static void netdev_RxDscrInit(void);
/*---------------------------------------------------------------------------*/
typedef union _TranDesc0_t
{
uint32_t Data;
struct {
uint32_t DB : 1;
uint32_t UF : 1;
uint32_t ED : 1;
uint32_t CC : 4;
uint32_t VF : 1;
uint32_t EC : 1;
uint32_t LC : 1;
uint32_t NC : 1;
uint32_t LSC : 1;
uint32_t IPE : 1;
uint32_t FF : 1;
uint32_t JT : 1;
uint32_t ES : 1;
uint32_t IHE : 1;
uint32_t : 3;
uint32_t TCH : 1;
uint32_t TER : 1;
uint32_t CIC : 2;
uint32_t : 2;
uint32_t DP : 1;
uint32_t DC : 1;
uint32_t FS : 1;
uint32_t LSEG : 1;
uint32_t IC : 1;
uint32_t OWN : 1;
};
} TranDesc0_t, * pTranDesc0_t;
typedef union _TranDesc1_t
{
uint32_t Data;
struct {
uint32_t TBS1 :13;
uint32_t : 3;
uint32_t TBS2 :12;
uint32_t : 3;
};
} TranDesc1_t, * pTranDesc1_t;
typedef union _RecDesc0_t
{
uint32_t Data;
struct {
uint32_t RMAM_PCE : 1;
uint32_t CE : 1;
uint32_t DE : 1;
uint32_t RE : 1;
uint32_t RWT : 1;
uint32_t FT : 1;
uint32_t LC : 1;
uint32_t IPHCE : 1;
uint32_t LS : 1;
uint32_t FS : 1;
uint32_t VLAN : 1;
uint32_t OE : 1;
uint32_t LE : 1;
uint32_t SAF : 1;
uint32_t DERR : 1;
uint32_t ES : 1;
uint32_t FL :14;
uint32_t AFM : 1;
uint32_t OWN : 1;
};
} RecDesc0_t, * pRecDesc0_t;
typedef union _recDesc1_t
{
uint32_t Data;
struct {
uint32_t RBS1 :13;
uint32_t : 1;
uint32_t RCH : 1;
uint32_t RER : 1;
uint32_t RBS2 :14;
uint32_t DIC : 1;
};
} RecDesc1_t, * pRecDesc1_t;
typedef union _EnetDmaDesc_t
{
uint32_t Data[4];
// Rx DMA descriptor
struct
{
RecDesc0_t RxDesc0;
RecDesc1_t RxDesc1;
uint32_t * pBuffer;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Rx;
// Tx DMA descriptor
struct
{
TranDesc0_t TxDesc0;
TranDesc1_t TxDesc1;
uint32_t * pBuffer1;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Tx;
} EnetDmaDesc_t, * pEnetDmaDesc_t;
/*---------------------------------------------------------------------------*/
uint8_t RxBuff[UIP_CONF_BUFFER_SIZE] __attribute__ ((aligned (4)));
uint8_t TxBuff[UIP_CONF_BUFFER_SIZE] __attribute__ ((aligned (4)));
EnetDmaDesc_t EnetDmaRx __attribute__((aligned (128)));
EnetDmaDesc_t EnetDmaTx __attribute__ ((aligned (128)));
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
ETH_InitTypeDef ETH_InitStructure;
/* Enable ETHERNET clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx |
RCC_AHB1Periph_ETH_MAC_Rx | RCC_AHB1Periph_ETH_MAC_PTP, ENABLE);
/* Enable GPIOs clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOG, ENABLE);
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/*Select RMII Interface*/
SYSCFG_ETH_MediaInterfaceConfig(SYSCFG_ETH_MediaInterface_RMII);
/* ETHERNET pins configuration */
/* PA
ETH_RMII_REF_CLK: PA1
ETH_RMII_MDIO: PA2
ETH_RMII_MDINT: PA3
ETH_RMII_CRS_DV: PA7
*/
/* Configure PA1, PA2, PA3 and PA7*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Connect PA1, PA2, PA3 and PA7 to ethernet module*/
GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_ETH);
/* PB
ETH_RMII_TX_EN: PG11
*/
/* Configure PG11*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG11 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource11, GPIO_AF_ETH);
/* PC
ETH_RMII_MDC: PC1
ETH_RMII_RXD0: PC4
ETH_RMII_RXD1: PC5
*/
/* Configure PC1, PC4 and PC5*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Connect PC1, PC4 and PC5 to ethernet module*/
GPIO_PinAFConfig(GPIOC, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource5, GPIO_AF_ETH);
/* PG
ETH_RMII_TXD0: PG13
ETH_RMII_TXD1: PG14
*/
/* Configure PG13 and PG14*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG13 and PG14 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource13, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOG, GPIO_PinSource14, GPIO_AF_ETH);
/* Reset ETHERNET on AHB Bus */
ETH_DeInit();
/* Software reset */
ETH_SoftwareReset();
/* Wait for software reset */
while(ETH_GetSoftwareResetStatus()==SET);
/* ETHERNET Configuration ------------------------------------------------------*/
/* Call ETH_StructInit if you don't like to configure all ETH_InitStructure parameter */
ETH_StructInit(&ETH_InitStructure);
/* Fill ETH_InitStructure parametrs */
/*------------------------ MAC -----------------------------------*/
ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Disable ;
ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable;
ETH_InitStructure.ETH_RetryTransmission = ETH_RetryTransmission_Disable;
ETH_InitStructure.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;
ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Enable;
ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;
ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;
ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
ETH_InitStructure.ETH_Mode = ETH_Mode_FullDuplex;
ETH_InitStructure.ETH_Speed = ETH_Speed_100M;
unsigned int PhyAddr;
union {
uint32_t HI_LO;
struct
{
uint16_t LO;
uint16_t HI;
};
} PHYID;
for(PhyAddr = 0; 32 > PhyAddr; PhyAddr++)
{
// datasheet for the ks8721bl ethernet controller (http://www.micrel.com/_PDF/Ethernet/datasheets/ks8721bl-sl.pdf)
// page 20 --> PHY Identifier 1 and 2
PHYID.HI = ETH_ReadPHYRegister(PhyAddr,2); // 0x0022
PHYID.LO = ETH_ReadPHYRegister(PhyAddr,3); // 0x1619
if ((0x00221619 == PHYID.HI_LO) || (0x0007C0F1 == PHYID.HI_LO))
break;
}
if (32 < PhyAddr)
{
ASSERT_RT(BLT_FALSE);
}
/* Configure Ethernet */
if(0 == ETH_Init(&ETH_InitStructure, PhyAddr))
{
ASSERT_RT(BLT_FALSE);
}
netdev_TxDscrInit();
netdev_RxDscrInit();
ETH_Start();
}
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
/* 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);
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{
uint32_t size;
/*check for validity*/
if(0 == EnetDmaRx.Rx.RxDesc0.OWN)
{
/*Get the size of the packet*/
size = EnetDmaRx.Rx.RxDesc0.FL; // CRC
memcpy(uip_buf, RxBuff, size); //string.h library*/
}
else
{
return 0;
}
/* Give the buffer back to ENET */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Start the receive operation */
ETH->DMARPDR = 1;
/* Return no error */
return size;
}
/*---------------------------------------------------------------------------*/
void netdev_send(void)
{
while(EnetDmaTx.Tx.TxDesc0.OWN);
/* Copy the application buffer to the driver buffer
Using this MEMCOPY_L2L_BY4 makes the copy routine faster
than memcpy */
memcpy(TxBuff, uip_buf, uip_len);
/* Assign ENET address to Temp Tx Array */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Setting the Frame Length*/
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.LSEG = 1;
EnetDmaTx.Tx.TxDesc0.FS = 1;
EnetDmaTx.Tx.TxDesc0.DC = 0;
EnetDmaTx.Tx.TxDesc0.DP = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
EnetDmaTx.Tx.TxDesc1.TBS1 = (uip_len&0xFFF);
/* Start the ENET by setting the VALID bit in dmaPackStatus of current descr*/
EnetDmaTx.Tx.TxDesc0.OWN = 1;
/* Start the transmit operation */
ETH->DMATPDR = 1;
}
/*---------------------------------------------------------------------------*/
static void netdev_RxDscrInit(void)
{
/* Initialization */
/* Assign temp Rx array to the ENET buffer */
EnetDmaRx.Rx.pBuffer = (uint32_t *)RxBuff;
/* Initialize RX ENET Status and control */
EnetDmaRx.Rx.RxDesc0.Data = 0;
/* Initialize the next descriptor- In our case its single descriptor */
EnetDmaRx.Rx.pEnetDmaNextDesc = &EnetDmaRx;
EnetDmaRx.Rx.RxDesc1.Data = 0;
EnetDmaRx.Rx.RxDesc1.RER = 0; // end of ring
EnetDmaRx.Rx.RxDesc1.RCH = 1; // end of ring
/* Set the max packet size */
EnetDmaRx.Rx.RxDesc1.RBS1 = UIP_CONF_BUFFER_SIZE;
/* Setting the VALID bit */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Setting the RX NEXT Descriptor Register inside the ENET */
ETH->DMARDLAR = (uint32_t)&EnetDmaRx;
}
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void)
{
/* ENET Start Address */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Next Descriptor Address */
EnetDmaTx.Tx.pEnetDmaNextDesc = &EnetDmaTx;
/* Initialize ENET status and control */
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
/* Tx next set to Tx descriptor base */
ETH->DMATDLAR = (uint32_t)&EnetDmaTx;
}

View File

@ -0,0 +1,46 @@
/*
* 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);
unsigned int netdev_read(void);
void netdev_send(void);
#endif /* __NETDEV_H__ */

View File

@ -0,0 +1,151 @@
/**
* \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
/**
* uIP buffer size.
*
* \hideinitializer
*/
#define UIP_CONF_BUFFER_SIZE 1600
/**
* CPU byte order.
*
* \hideinitializer
*/
#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN
/**
* Logging on or off
*
* \hideinitializer
*/
#define UIP_CONF_LOGGING 0
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 0
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 1
/**
* 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"
#endif /* __UIP_CONF_H__ */
/** @} */
/** @} */

View File

@ -40,6 +40,13 @@ hooks.c \
main.c \
./lib/fatfs/ffconf.h \
./lib/fatfs/mmc.c \
./lib/ethernetlib/inc/stm32_eth.h \
./lib/ethernetlib/src/stm32_eth.c \
./lib/uip/clock-arch.c \
./lib/uip/clock-arch.h \
./lib/uip/netdev.c \
./lib/uip/netdev.h \
./lib/uip/uip-conf.h \
./lib/stdperiphlib/stm32f4xx_conf.h \
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/misc.h \
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_adc.h \
@ -110,10 +117,30 @@ main.c \
../../../Source/third_party/fatfs/src/ff.h \
../../../Source/third_party/fatfs/src/integer.h \
../../../Source/third_party/fatfs/src/option/unicode.c \
../../../Source/third_party/uip/uip/clock.h \
../../../Source/third_party/uip/uip/lc-addrlabels.h \
../../../Source/third_party/uip/uip/lc-switch.h \
../../../Source/third_party/uip/uip/lc.h \
../../../Source/third_party/uip/uip/pt.h \
../../../Source/third_party/uip/uip/uip-fw.h \
../../../Source/third_party/uip/uip/uip-neighbor.h \
../../../Source/third_party/uip/uip/uip-split.h \
../../../Source/third_party/uip/uip/uip.c \
../../../Source/third_party/uip/uip/uip.h \
../../../Source/third_party/uip/uip/uip_arch.h \
../../../Source/third_party/uip/uip/uip_arp.c \
../../../Source/third_party/uip/uip/uip_arp.h \
../../../Source/third_party/uip/uip/uip_timer.c \
../../../Source/third_party/uip/uip/uip_timer.h \
../../../Source/third_party/uip/uip/uiplib.c \
../../../Source/third_party/uip/uip/uiplib.h \
../../../Source/third_party/uip/uip/uipopt.h \
../../../Source/boot.c \
../../../Source/boot.h \
../../../Source/com.c \
../../../Source/com.h \
../../../Source/net.c \
../../../Source/net.h \
../../../Source/xcp.c \
../../../Source/xcp.h \
../../../Source/backdoor.c \

View File

@ -3,47 +3,49 @@ bin/demoprog_olimex_stm32e407.elf: file format elf32-littlearm
bin/demoprog_olimex_stm32e407.elf
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x08008000
start address 0x0800c000
Program Header:
LOAD off 0x00008000 vaddr 0x08008000 paddr 0x08008000 align 2**15
filesz 0x00000e70 memsz 0x00000e70 flags r-x
LOAD off 0x00010000 vaddr 0x20000000 paddr 0x08008e70 align 2**15
filesz 0x00000014 memsz 0x00000868 flags rw-
LOAD off 0x00000000 vaddr 0x08008000 paddr 0x08008000 align 2**15
filesz 0x00007128 memsz 0x00007128 flags r-x
LOAD off 0x00008000 vaddr 0x20000000 paddr 0x0800f128 align 2**15
filesz 0x00000014 memsz 0x00000014 flags rw-
LOAD off 0x00008080 vaddr 0x20000080 paddr 0x0800f200 align 2**15
filesz 0x00000000 memsz 0x00001c9c flags rw-
private flags = 5000202: [Version5 EABI] [soft-float ABI] [has entry point]
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000e70 08008000 08008000 00008000 2**2
0 .text 00003128 0800c000 0800c000 00004000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000014 20000000 08008e70 00010000 2**2
1 .data 00000014 20000000 0800f128 00008000 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000854 20000014 08008e84 00010014 2**2
2 .bss 00001c9c 20000080 0800f200 00008080 2**7
ALLOC
3 .debug_info 00004f05 00000000 00000000 00010014 2**0
3 .debug_info 00009528 00000000 00000000 00008014 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_abbrev 00001212 00000000 00000000 00014f19 2**0
4 .debug_abbrev 00001e7d 00000000 00000000 0001153c 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_loc 000023a4 00000000 00000000 0001612b 2**0
5 .debug_loc 00003ba9 00000000 00000000 000133b9 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_aranges 00000538 00000000 00000000 000184cf 2**0
6 .debug_aranges 000009f8 00000000 00000000 00016f62 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_ranges 00000478 00000000 00000000 00018a07 2**0
7 .debug_ranges 000008d8 00000000 00000000 0001795a 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_line 00001b4c 00000000 00000000 00018e7f 2**0
8 .debug_line 0000321a 00000000 00000000 00018232 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_str 00001e2c 00000000 00000000 0001a9cb 2**0
9 .debug_str 000038bb 00000000 00000000 0001b44c 2**0
CONTENTS, READONLY, DEBUGGING
10 .comment 00000030 00000000 00000000 0001c7f7 2**0
10 .comment 00000030 00000000 00000000 0001ed07 2**0
CONTENTS, READONLY
11 .ARM.attributes 00000033 00000000 00000000 0001c827 2**0
11 .ARM.attributes 00000033 00000000 00000000 0001ed37 2**0
CONTENTS, READONLY
12 .debug_frame 000009d0 00000000 00000000 0001c85c 2**2
12 .debug_frame 000014a4 00000000 00000000 0001ed6c 2**2
CONTENTS, READONLY, DEBUGGING
SYMBOL TABLE:
08008000 l d .text 00000000 .text
0800c000 l d .text 00000000 .text
20000000 l d .data 00000000 .data
20000014 l d .bss 00000000 .bss
20000080 l d .bss 00000000 .bss
00000000 l d .debug_info 00000000 .debug_info
00000000 l d .debug_abbrev 00000000 .debug_abbrev
00000000 l d .debug_loc 00000000 .debug_loc
@ -56,68 +58,148 @@ SYMBOL TABLE:
00000000 l d .debug_frame 00000000 .debug_frame
00000000 l df *ABS* 00000000 vectors.c
00000000 l df *ABS* 00000000 boot.c
0800818c l F .text 00000022 NVIC_SystemReset
080081b0 l F .text 00000038 UartReceiveByte
20000014 l O .bss 00000041 xcpCtoReqPacket.7486
20000058 l O .bss 00000001 xcpCtoRxLength.7487
20000059 l O .bss 00000001 xcpCtoRxInProgress.7488
08008e4c l O .text 00000024 canTiming
0800c18c l F .text 00000022 NVIC_SystemReset
0800c1b0 l F .text 00000038 UartReceiveByte
20000080 l O .bss 00000041 xcpCtoReqPacket.7497
200000c4 l O .bss 00000001 xcpCtoRxLength.7498
200000c5 l O .bss 00000001 xcpCtoRxInProgress.7499
0800f0fc l O .text 00000024 canTiming
00000000 l df *ABS* 00000000 cstart.c
08008518 l F .text 00000000 zero_loop
0800c524 l F .text 00000000 zero_loop
00000000 l df *ABS* 00000000 irq.c
00000000 l df *ABS* 00000000 led.c
2000005c l O .bss 00000004 timer_counter_last.7467
20000060 l O .bss 00000001 led_toggle_state.7466
200000c8 l O .bss 00000004 timer_counter_last.7478
200000cc l O .bss 00000001 led_toggle_state.7477
00000000 l df *ABS* 00000000 net.c
200000d0 l O .bss 00000004 ARPTimerTimeOut
200000d4 l O .bss 00000004 periodicTimerTimeOut
00000000 l df *ABS* 00000000 main.c
00000000 l df *ABS* 00000000 timer.c
20000064 l O .bss 00000004 millisecond_counter
200000d8 l O .bss 00000004 millisecond_counter
00000000 l df *ABS* 00000000 stm32_eth.c
00000000 l df *ABS* 00000000 netdev.c
00000000 l df *ABS* 00000000 stm32f4xx_can.c
00000000 l df *ABS* 00000000 stm32f4xx_gpio.c
00000000 l df *ABS* 00000000 stm32f4xx_rcc.c
20000000 l O .data 00000010 APBAHBPrescTable
00000000 l df *ABS* 00000000 stm32f4xx_syscfg.c
00000000 l df *ABS* 00000000 stm32f4xx_usart.c
00000000 l df *ABS* 00000000 system_stm32f4xx.c
00000000 l df *ABS* 00000000 uip.c
0800d96c l F .text 0000004c chksum
0800d9b8 l F .text 00000046 upper_layer_chksum
0800da80 l F .text 00000036 uip_add_rcv_nxt
200000dc l O .bss 00000002 tmp16
200000de l O .bss 00000002 ipid
200000e0 l O .bss 00000004 iss
200000e4 l O .bss 00000002 lastport
200000f0 l O .bss 00000001 c
200000f1 l O .bss 00000001 opt
00000000 l df *ABS* 00000000 uip_arp.c
0800eb2c l F .text 00000116 uip_arp_update
200000f2 l O .bss 00000001 i
200000f3 l O .bss 00000001 tmpage
200000f4 l O .bss 00000060 arp_table
0800f120 l O .text 00000006 broadcast_ethaddr
20000154 l O .bss 00000001 c
20000155 l O .bss 00000001 arptime
20000158 l O .bss 00000004 ipaddr
00000000 l df *ABS* 00000000 memcpy-stub.c
00000000 l df *ABS* 00000000 memset.c
00000000 l df *ABS* 00000000
00000800 l *ABS* 00000000 __STACKSIZE__
080084d4 g F .text 00000060 reset_handler
08008a90 g F .text 00000028 GPIO_PinAFConfig
08008800 g F .text 00000126 CAN_FilterInit
08008540 g F .text 00000004 IrqInterruptEnable
08008d2c g F .text 0000000c USART_GetFlagStatus
08008e70 g .text 00000000 _etext
080086bc g F .text 00000010 TimerISRHandler
0800ce0c g F .text 00000012 ETH_FlushTransmitFIFO
0800c4e0 g F .text 00000060 reset_handler
0800d580 g F .text 00000028 GPIO_PinAFConfig
0800c930 g F .text 0000009e ETH_StructInit
0800d2f0 g F .text 00000126 CAN_FilterInit
0800c54c g F .text 00000004 IrqInterruptEnable
0800caa8 g F .text 000002f0 ETH_Init
20000e90 g O .bss 00000002 uip_len
200000e8 g O .bss 00000006 uip_ethaddr
0800da00 g F .text 0000007e uip_add32
0800d6f0 g F .text 00000024 RCC_AHB1PeriphResetCmd
0800d84c g F .text 0000000c USART_GetFlagStatus
0800f128 g .text 00000000 _etext
0800d100 g F .text 00000056 netdev_read
0800db5c g F .text 00000fc4 uip_process
0800c900 g F .text 00000010 TimerISRHandler
0800c914 g F .text 0000001c ETH_DeInit
0800efb4 g F .text 000000a6 memcpy
20000e94 g O .bss 00000004 uip_sappdata
0800ceb0 g F .text 0000022a netdev_init
20000e98 g O .bss 00000004 uip_acc32
0800dab8 g F .text 0000002c uip_ipchksum
20000010 g O .data 00000004 SystemCoreClock
08008d24 g F .text 00000008 USART_ReceiveData
08008bdc g F .text 00000024 RCC_APB2PeriphClockCmd
080089f8 g F .text 00000090 GPIO_Init
08008d08 g F .text 0000001c USART_Cmd
08008bb8 g F .text 00000024 RCC_APB1PeriphClockCmd
080086d0 g F .text 00000042 CAN_DeInit
20000068 g .bss 00000000 _ebss
080086cc g F .text 00000002 UnusedISR
08008544 g F .text 00000056 LedInit
08008a88 g F .text 00000004 GPIO_SetBits
08008ab8 g F .text 000000da RCC_GetClocksFreq
08008c24 g F .text 000000e4 USART_Init
08008948 g F .text 00000096 CAN_Receive
08008714 g F .text 000000ea CAN_Init
20000014 g .bss 00000000 _bss
08008928 g F .text 00000020 CAN_StructInit
08008a8c g F .text 00000004 GPIO_ResetBits
0800861c g F .text 0000004a main
080089e0 g F .text 00000018 CAN_MessagePending
080081e8 g F .text 000001e8 BootComInit
08008d38 g F .text 00000112 SystemInit
08008c00 g F .text 00000024 RCC_APB1PeriphResetCmd
0800d844 g F .text 00000008 USART_ReceiveData
0800d6cc g F .text 00000024 RCC_APB2PeriphClockCmd
0800d4e8 g F .text 00000090 GPIO_Init
0800db28 g F .text 00000032 uip_listen
0800d828 g F .text 0000001c USART_Cmd
0800d158 g F .text 00000066 netdev_send
0800d6a8 g F .text 00000024 RCC_APB1PeriphClockCmd
20000e9c g O .bss 00000001 uip_flags
20000180 g O .bss 00000010 EnetDmaRx
0800d1c0 g F .text 00000042 CAN_DeInit
0800cd98 g F .text 00000026 ETH_MACTransmissionCmd
0800c4d4 g F .text 0000000c BootActivate
2000151c g .bss 00000000 _ebss
0800c910 g F .text 00000002 UnusedISR
0800c550 g F .text 00000056 LedInit
0800d578 g F .text 00000004 GPIO_SetBits
0800c6f0 g F .text 0000015c NetTask
0800cde8 g F .text 00000012 ETH_SoftwareReset
0800ca40 g F .text 00000068 ETH_WritePHYRegister
0800d5a8 g F .text 000000da RCC_GetClocksFreq
0800d0dc g F .text 00000022 netdev_init_mac
0800d744 g F .text 000000e4 USART_Init
0800d438 g F .text 00000096 CAN_Receive
0800d204 g F .text 000000ea CAN_Init
20000080 g .bss 00000000 _bss
0800d418 g F .text 00000020 CAN_StructInit
0800dae4 g F .text 00000010 uip_tcpchksum
0800ce48 g F .text 00000026 ETH_DMAReceptionCmd
20000ea0 g O .bss 00000004 uip_appdata
0800d57c g F .text 00000004 GPIO_ResetBits
20000ea4 g O .bss 00000004 uip_conn
0800cdfc g F .text 00000010 ETH_GetSoftwareResetStatus
0800c9d0 g F .text 0000006e ETH_ReadPHYRegister
20000ea8 g O .bss 0000001e uip_conns
0800eddc g F .text 000001d6 uip_arp_out
0800f05c g F .text 0000009e memset
0800c84c g F .text 0000005e main
0800d4d0 g F .text 00000018 CAN_MessagePending
0800c1e8 g F .text 000001e8 BootComInit
0800d858 g F .text 00000112 SystemInit
0800d738 g F .text 0000000a SYSCFG_ETH_MediaInterfaceConfig
0800ec9c g F .text 00000140 uip_arp_arpin
0800ec44 g F .text 00000058 uip_arp_timer
20000ec8 g O .bss 00000002 uip_listenports
20000ecc g O .bss 00000004 uip_draddr
0800d714 g F .text 00000024 RCC_APB1PeriphResetCmd
20000000 g .data 00000000 _data
0800859c g F .text 0000007e LedToggle
20000868 g .bss 00000000 _estack
0800c5a8 g F .text 0000007e LedToggle
0800ce70 g F .text 0000003e ETH_Start
20000190 g O .bss 00000640 RxBuff
20001d1c g .bss 00000000 _estack
20000014 g .data 00000000 _edata
08008000 g O .text 0000018c _vectab
080083d0 g F .text 00000104 BootComCheckActivationRequest
08008b94 g F .text 00000024 RCC_AHB1PeriphClockCmd
20000068 g .bss 00000000 _stack
080086b0 g F .text 0000000c TimerGet
08008668 g F .text 00000046 TimerInit
0800eb20 g F .text 0000000a htons
0800c000 g O .text 0000018c _vectab
0800cdc0 g F .text 00000026 ETH_MACReceptionCmd
200007d0 g O .bss 00000640 TxBuff
0800c3d0 g F .text 00000104 BootComCheckActivationRequest
0800ce20 g F .text 00000026 ETH_DMATransmissionCmd
0800daf4 g F .text 00000032 uip_init
0800d684 g F .text 00000024 RCC_AHB1PeriphClockCmd
2000151c g .bss 00000000 _stack
20000ed0 g O .bss 00000004 uip_netmask
20000ed4 g O .bss 00000004 uip_hostaddr
0800c8f4 g F .text 0000000c TimerGet
20000e80 g O .bss 00000010 EnetDmaTx
0800c6b8 g F .text 00000038 NetApp
0800c628 g F .text 00000090 NetInit
0800c8ac g F .text 00000046 TimerInit
20000ed8 g O .bss 00000642 uip_buf
2000151a g O .bss 00000002 uip_slen

View File

@ -87,7 +87,7 @@ void BootComCheckActivationRequest(void)
** \return none.
**
****************************************************************************************/
static void BootActivate(void)
void BootActivate(void)
{
/* perform software reset to activate the bootoader again */
NVIC_SystemReset();

View File

@ -38,6 +38,7 @@
****************************************************************************************/
void BootComInit(void);
void BootComCheckActivationRequest(void);
void BootActivate(void);
#endif /* BOOT_H */

View File

@ -43,6 +43,7 @@
#include "irq.h" /* IRQ driver */
#include "led.h" /* LED driver */
#include "timer.h" /* Timer driver */
#include "net.h" /* TCP/IP server application */
#endif /* HEADER_H */

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 "header.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,442 @@
/*
* 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 "header.h"
#include "stm32_eth.h" /* STM32 ethernet library */
#include <string.h> /* for memcpy */
/*---------------------------------------------------------------------------*/
#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)
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void);
static void netdev_RxDscrInit(void);
/*---------------------------------------------------------------------------*/
typedef union _TranDesc0_t
{
uint32_t Data;
struct {
uint32_t DB : 1;
uint32_t UF : 1;
uint32_t ED : 1;
uint32_t CC : 4;
uint32_t VF : 1;
uint32_t EC : 1;
uint32_t LC : 1;
uint32_t NC : 1;
uint32_t LSC : 1;
uint32_t IPE : 1;
uint32_t FF : 1;
uint32_t JT : 1;
uint32_t ES : 1;
uint32_t IHE : 1;
uint32_t : 3;
uint32_t TCH : 1;
uint32_t TER : 1;
uint32_t CIC : 2;
uint32_t : 2;
uint32_t DP : 1;
uint32_t DC : 1;
uint32_t FS : 1;
uint32_t LSEG : 1;
uint32_t IC : 1;
uint32_t OWN : 1;
};
} TranDesc0_t, * pTranDesc0_t;
typedef union _TranDesc1_t
{
uint32_t Data;
struct {
uint32_t TBS1 :13;
uint32_t : 3;
uint32_t TBS2 :12;
uint32_t : 3;
};
} TranDesc1_t, * pTranDesc1_t;
typedef union _RecDesc0_t
{
uint32_t Data;
struct {
uint32_t RMAM_PCE : 1;
uint32_t CE : 1;
uint32_t DE : 1;
uint32_t RE : 1;
uint32_t RWT : 1;
uint32_t FT : 1;
uint32_t LC : 1;
uint32_t IPHCE : 1;
uint32_t LS : 1;
uint32_t FS : 1;
uint32_t VLAN : 1;
uint32_t OE : 1;
uint32_t LE : 1;
uint32_t SAF : 1;
uint32_t DERR : 1;
uint32_t ES : 1;
uint32_t FL :14;
uint32_t AFM : 1;
uint32_t OWN : 1;
};
} RecDesc0_t, * pRecDesc0_t;
typedef union _recDesc1_t
{
uint32_t Data;
struct {
uint32_t RBS1 :13;
uint32_t : 1;
uint32_t RCH : 1;
uint32_t RER : 1;
uint32_t RBS2 :14;
uint32_t DIC : 1;
};
} RecDesc1_t, * pRecDesc1_t;
typedef union _EnetDmaDesc_t
{
uint32_t Data[4];
// Rx DMA descriptor
struct
{
RecDesc0_t RxDesc0;
RecDesc1_t RxDesc1;
uint32_t * pBuffer;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Rx;
// Tx DMA descriptor
struct
{
TranDesc0_t TxDesc0;
TranDesc1_t TxDesc1;
uint32_t * pBuffer1;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Tx;
} EnetDmaDesc_t, * pEnetDmaDesc_t;
/*---------------------------------------------------------------------------*/
uint8_t RxBuff[UIP_CONF_BUFFER_SIZE] __attribute__ ((aligned (4)));
uint8_t TxBuff[UIP_CONF_BUFFER_SIZE] __attribute__ ((aligned (4)));
EnetDmaDesc_t EnetDmaRx __attribute__((aligned (128)));
EnetDmaDesc_t EnetDmaTx __attribute__ ((aligned (128)));
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
ETH_InitTypeDef ETH_InitStructure;
/* Enable ETHERNET clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx |
RCC_AHB1Periph_ETH_MAC_Rx | RCC_AHB1Periph_ETH_MAC_PTP, ENABLE);
/* Enable GPIOs clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOG, ENABLE);
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/*Select RMII Interface*/
SYSCFG_ETH_MediaInterfaceConfig(SYSCFG_ETH_MediaInterface_RMII);
/* ETHERNET pins configuration */
/* PA
ETH_RMII_REF_CLK: PA1
ETH_RMII_MDIO: PA2
ETH_RMII_MDINT: PA3
ETH_RMII_CRS_DV: PA7
*/
/* Configure PA1, PA2, PA3 and PA7*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Connect PA1, PA2, PA3 and PA7 to ethernet module*/
GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_ETH);
/* PB
ETH_RMII_TX_EN: PG11
*/
/* Configure PG11*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG11 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource11, GPIO_AF_ETH);
/* PC
ETH_RMII_MDC: PC1
ETH_RMII_RXD0: PC4
ETH_RMII_RXD1: PC5
*/
/* Configure PC1, PC4 and PC5*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Connect PC1, PC4 and PC5 to ethernet module*/
GPIO_PinAFConfig(GPIOC, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource5, GPIO_AF_ETH);
/* PG
ETH_RMII_TXD0: PG13
ETH_RMII_TXD1: PG14
*/
/* Configure PG13 and PG14*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG13 and PG14 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource13, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOG, GPIO_PinSource14, GPIO_AF_ETH);
/* Reset ETHERNET on AHB Bus */
ETH_DeInit();
/* Software reset */
ETH_SoftwareReset();
/* Wait for software reset */
while(ETH_GetSoftwareResetStatus()==SET);
/* ETHERNET Configuration ------------------------------------------------------*/
/* Call ETH_StructInit if you don't like to configure all ETH_InitStructure parameter */
ETH_StructInit(&ETH_InitStructure);
/* Fill ETH_InitStructure parametrs */
/*------------------------ MAC -----------------------------------*/
ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Disable ;
ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable;
ETH_InitStructure.ETH_RetryTransmission = ETH_RetryTransmission_Disable;
ETH_InitStructure.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;
ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Enable;
ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;
ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;
ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
ETH_InitStructure.ETH_Mode = ETH_Mode_FullDuplex;
ETH_InitStructure.ETH_Speed = ETH_Speed_100M;
unsigned int PhyAddr;
union {
uint32_t HI_LO;
struct
{
uint16_t LO;
uint16_t HI;
};
} PHYID;
for(PhyAddr = 0; 32 > PhyAddr; PhyAddr++)
{
// datasheet for the ks8721bl ethernet controller (http://www.micrel.com/_PDF/Ethernet/datasheets/ks8721bl-sl.pdf)
// page 20 --> PHY Identifier 1 and 2
PHYID.HI = ETH_ReadPHYRegister(PhyAddr,2); // 0x0022
PHYID.LO = ETH_ReadPHYRegister(PhyAddr,3); // 0x1619
if ((0x00221619 == PHYID.HI_LO) || (0x0007C0F1 == PHYID.HI_LO))
break;
}
/* Configure Ethernet */
ETH_Init(&ETH_InitStructure, PhyAddr);
netdev_TxDscrInit();
netdev_RxDscrInit();
ETH_Start();
}
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
/* 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);
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{
uint32_t size;
/*check for validity*/
if(0 == EnetDmaRx.Rx.RxDesc0.OWN)
{
/*Get the size of the packet*/
size = EnetDmaRx.Rx.RxDesc0.FL; // CRC
memcpy(uip_buf, RxBuff, size); //string.h library*/
}
else
{
return 0;
}
/* Give the buffer back to ENET */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Start the receive operation */
ETH->DMARPDR = 1;
/* Return no error */
return size;
}
/*---------------------------------------------------------------------------*/
void netdev_send(void)
{
while(EnetDmaTx.Tx.TxDesc0.OWN);
/* Copy the application buffer to the driver buffer
Using this MEMCOPY_L2L_BY4 makes the copy routine faster
than memcpy */
memcpy(TxBuff, uip_buf, uip_len);
/* Assign ENET address to Temp Tx Array */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Setting the Frame Length*/
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.LSEG = 1;
EnetDmaTx.Tx.TxDesc0.FS = 1;
EnetDmaTx.Tx.TxDesc0.DC = 0;
EnetDmaTx.Tx.TxDesc0.DP = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
EnetDmaTx.Tx.TxDesc1.TBS1 = (uip_len&0xFFF);
/* Start the ENET by setting the VALID bit in dmaPackStatus of current descr*/
EnetDmaTx.Tx.TxDesc0.OWN = 1;
/* Start the transmit operation */
ETH->DMATPDR = 1;
}
/*---------------------------------------------------------------------------*/
static void netdev_RxDscrInit(void)
{
/* Initialization */
/* Assign temp Rx array to the ENET buffer */
EnetDmaRx.Rx.pBuffer = (uint32_t *)RxBuff;
/* Initialize RX ENET Status and control */
EnetDmaRx.Rx.RxDesc0.Data = 0;
/* Initialize the next descriptor- In our case its single descriptor */
EnetDmaRx.Rx.pEnetDmaNextDesc = &EnetDmaRx;
EnetDmaRx.Rx.RxDesc1.Data = 0;
EnetDmaRx.Rx.RxDesc1.RER = 0; // end of ring
EnetDmaRx.Rx.RxDesc1.RCH = 1; // end of ring
/* Set the max packet size */
EnetDmaRx.Rx.RxDesc1.RBS1 = UIP_CONF_BUFFER_SIZE;
/* Setting the VALID bit */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Setting the RX NEXT Descriptor Register inside the ENET */
ETH->DMARDLAR = (uint32_t)&EnetDmaRx;
}
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void)
{
/* ENET Start Address */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Next Descriptor Address */
EnetDmaTx.Tx.pEnetDmaNextDesc = &EnetDmaTx;
/* Initialize ENET status and control */
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
/* Tx next set to Tx descriptor base */
ETH->DMATDLAR = (uint32_t)&EnetDmaTx;
}

View File

@ -0,0 +1,46 @@
/*
* 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);
unsigned int netdev_read(void);
void netdev_send(void);
#endif /* __NETDEV_H__ */

View File

@ -0,0 +1,151 @@
/**
* \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
/**
* uIP buffer size.
*
* \hideinitializer
*/
#define UIP_CONF_BUFFER_SIZE 1600
/**
* CPU byte order.
*
* \hideinitializer
*/
#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN
/**
* Logging on or off
*
* \hideinitializer
*/
#define UIP_CONF_LOGGING 0
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 0
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 1
/**
* 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"
#endif /* __UIP_CONF_H__ */
/** @} */
/** @} */

View File

@ -53,6 +53,8 @@ void main(void)
{
/* initialize the microcontroller */
Init();
/* initialize the network application */
NetInit();
/* initialize the bootloader interface */
BootComInit();
@ -61,6 +63,8 @@ void main(void)
{
/* toggle LED with a fixed frequency */
LedToggle();
/* run the network task */
NetTask();
/* check for bootloader activation request */
BootComCheckActivationRequest();
}

View File

@ -43,10 +43,19 @@ irq.c \
irq.h \
led.c \
led.h \
net.c \
net.h \
main.c \
timer.c \
timer.h \
vectors.c \
./lib/ethernetlib/inc/stm32_eth.h \
./lib/ethernetlib/src/stm32_eth.c \
./lib/uip/clock-arch.c \
./lib/uip/clock-arch.h \
./lib/uip/netdev.c \
./lib/uip/netdev.h \
./lib/uip/uip-conf.h \
./lib/stdperiphlib/stm32f4xx_conf.h \
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/misc.h \
./lib/stdperiphlib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_adc.h \
@ -111,7 +120,27 @@ vectors.c \
./lib/stdperiphlib/CMSIS/Include/core_cmInstr.h \
./lib/stdperiphlib/CMSIS/Device/ST/STM32F4xx/Source/system_stm32f4xx.c \
./lib/stdperiphlib/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h \
./lib/stdperiphlib/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h
./lib/stdperiphlib/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h \
../../../Source/third_party/uip/uip/clock.h \
../../../Source/third_party/uip/uip/lc-addrlabels.h \
../../../Source/third_party/uip/uip/lc-switch.h \
../../../Source/third_party/uip/uip/lc.h \
../../../Source/third_party/uip/uip/pt.h \
../../../Source/third_party/uip/uip/uip-fw.c \
../../../Source/third_party/uip/uip/uip-fw.h \
../../../Source/third_party/uip/uip/uip-neighbor.h \
../../../Source/third_party/uip/uip/uip-split.h \
../../../Source/third_party/uip/uip/uip.c \
../../../Source/third_party/uip/uip/uip.h \
../../../Source/third_party/uip/uip/uiplib.c \
../../../Source/third_party/uip/uip/uiplib.h \
../../../Source/third_party/uip/uip/uipopt.h \
../../../Source/third_party/uip/uip/uip_arch.h \
../../../Source/third_party/uip/uip/uip_arp.c \
../../../Source/third_party/uip/uip/uip_arp.h \
../../../Source/third_party/uip/uip/uip_timer.c \
../../../Source/third_party/uip/uip/uip_timer.h
#|---------------------------------------------------------------------------------------|

View File

@ -1,6 +1,6 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 1024K-32K
FLASH (rx) : ORIGIN = 0x0800C000, LENGTH = 1024K-48K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
}

View File

@ -0,0 +1,211 @@
/************************************************************************************//**
* \file Demo\ARMCM3_LM3S_EK_LM3S6965_IAR\Prog\net.c
* \brief Network application for the uIP TCP/IP stack.
* \ingroup Prog_ARMCM3_LM3S_EK_LM3S6965_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 should have received a copy of the GNU General Public License along with OpenBLT.
* If not, see <http://www.gnu.org/licenses/>.
*
* A special exception to the GPL is included to allow you to distribute a combined work
* that includes OpenBLT without being obliged to provide the source code for any
* proprietary components. The exception text is included at the bottom of the license
* file <license.html>.
*
* \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;
/************************************************************************************//**
** \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();
/* 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);
/* 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();
} /*** 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))
{
/* 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;
}
}
}
/* 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,66 @@
/************************************************************************************//**
* \file Demo\ARMCM3_LM3S_EK_LM3S6965_IAR\Prog\net.h
* \brief Network application for the uIP TCP/IP stack.
* \ingroup Prog_ARMCM3_LM3S_EK_LM3S6965_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 should have received a copy of the GNU General Public License along with OpenBLT.
* If not, see <http://www.gnu.org/licenses/>.
*
* A special exception to the GPL is included to allow you to distribute a combined work
* that includes OpenBLT without being obliged to provide the source code for any
* proprietary components. The exception text is included at the bottom of the license
* file <license.html>.
*
* \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

@ -110,6 +110,82 @@
#define BOOT_COM_UART_CHANNEL_INDEX (5)
/* 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 configued with the macros
* 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.
*/
/** \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 Configure the 1st byte of the IP address */
#define BOOT_COM_NET_IPADDR0 (169)
/** \brief Configure the 2nd byte of the IP address */
#define BOOT_COM_NET_IPADDR1 (254)
/** \brief Configure the 3rd byte of the IP address */
#define BOOT_COM_NET_IPADDR2 (19)
/** \brief Configure the 4th byte of the IP address */
#define BOOT_COM_NET_IPADDR3 (63)
/** \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 (0)
/** \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 (169)
/** \brief Configure the 2nd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY1 (254)
/** \brief Configure the 3rd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY2 (19)
/** \brief Configure the 4th byte of the gateway address */
#define BOOT_COM_NET_GATEWAY3 (1)
/** \brief Enable/disable a hook function that is called when the IP address is about
* to be set. This allows a dynamic override of the BOOT_COM_NET_IPADDRx values.
*/
#define BOOT_COM_NET_IPADDR_HOOK_ENABLE (0)
/** \brief Enable/disable a hook function that is called when the netmask is about
* to be set. This allows a dynamic override of the BOOT_COM_NET_NETMASKx values.
*/
#define BOOT_COM_NET_NETMASK_HOOK_ENABLE (0)
/** \brief Enable/disable a hook function that is called when the gateway address is
* about to be set. This allows a dynamic override of the BOOT_COM_NET_GATEWAYx
* values.
*/
#define BOOT_COM_NET_GATEWAY_HOOK_ENABLE (0)
/****************************************************************************************
* B A C K D O O R C O N F I G U R A T I O N
****************************************************************************************/
#if (BOOT_COM_NET_ENABLE > 0)
/* Override the default time that the backdoor is open if firmware updates via TCP/IP
* are supported. in this case a reactivation of the bootloader results in a re-
* initialization of the ethernet MAC. when directly connected to the ethernet port of
* a PC this will go relatively fast (depending on what MS Windows is being used), but
* when connected to the network via a router this can take several seconds. feel free to
* shorten/lengthen this time for finetuning. the only downside of a long backdoor open
* time is that the starting of the user program will also be delayed for this time.
*
* Also note that when the target is directly connected to the ethernet port of a PC,
* the checkbox "Automatically retry socket connection" should be checked in the
* Microboot settings. if connecting via a router the uncheck this checkbox.
*/
#define BACKDOOR_ENTRY_TIMEOUT_MS (10000)
#endif
/****************************************************************************************
* F I L E S Y S T E M I N T E R F A C E C O N F I G U R A T I O N
****************************************************************************************/

View File

@ -19,7 +19,7 @@
<Column0>124</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
<Column0>125</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Disassembly>
<col-names>
@ -39,7 +39,7 @@
<Wnd2>
<Wnd0>
<Tabs>
<Tab>
<Identity>TabID-30829-10739</Identity>
@ -55,7 +55,7 @@
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd2><Wnd4>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1>
<Tabs>
<Tab>
<Identity>TabID-8810-10743</Identity>
@ -67,7 +67,7 @@
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd4><Wnd5>
<SelectedTab>0</SelectedTab></Wnd1><Wnd3>
<Tabs>
<Tab>
<Identity>TabID-19558-10746</Identity>
@ -77,20 +77,20 @@
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd5></Windows>
<SelectedTab>0</SelectedTab></Wnd3></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>33</YPos2><SelStart2>2963</SelStart2><SelEnd2>2963</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>57</YPos2><SelStart2>4708</SelStart2><SelEnd2>4708</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>42</YPos2><SelStart2>2963</SelStart2><SelEnd2>2963</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>132</YPos2><SelStart2>8735</SelStart2><SelEnd2>8735</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-02beba70><key>iaridepm.enu1</key></Toolbar-02beba70></Sizes></Row0><Row1><Sizes><Toolbar-0b155910><key>debuggergui.enu1</key></Toolbar-0b155910></Sizes></Row1></Top><Left><Row0><Sizes><Wnd4><Rect><Top>-2</Top><Left>-2</Left><Bottom>741</Bottom><Right>198</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198413</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>737103</sizeVertCY></Rect></Wnd4></Sizes></Row0></Left><Right><Row0><Sizes><Wnd5><Rect><Top>-2</Top><Left>-2</Left><Bottom>741</Bottom><Right>461</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198413</sizeHorzCY><sizeVertCX>241146</sizeVertCX><sizeVertCY>737103</sizeVertCY></Rect></Wnd5></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd2><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>198413</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198413</sizeVertCY></Rect></Wnd2></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
<Top><Row0><Sizes><Toolbar-02aeba70><key>iaridepm.enu1</key></Toolbar-02aeba70></Sizes></Row0><Row1><Sizes><Toolbar-0c6f6a88><key>debuggergui.enu1</key></Toolbar-0c6f6a88></Sizes></Row1></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>741</Bottom><Right>199</Right><x>-2</x><y>-2</y><xscreen>201</xscreen><yscreen>200</yscreen><sizeHorzCX>104688</sizeHorzCX><sizeHorzCY>198413</sizeHorzCY><sizeVertCX>104688</sizeVertCX><sizeVertCY>737103</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>741</Bottom><Right>460</Right><x>-2</x><y>-2</y><xscreen>201</xscreen><yscreen>200</yscreen><sizeHorzCX>104688</sizeHorzCX><sizeHorzCY>198413</sizeHorzCY><sizeVertCX>240625</sizeVertCX><sizeVertCY>737103</sizeVertCY></Rect></Wnd3></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>198413</sizeHorzCY><sizeVertCX>104688</sizeVertCX><sizeVertCY>198413</sizeVertCY></Rect></Wnd0></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Project>

View File

@ -9,7 +9,7 @@ TriggerName=main
LimitSize=0
ByteLimit=50
[DebugChecksum]
Checksum=-2067015847
Checksum=-1915269868
[Exceptions]
StopOnUncaught=_ 0
StopOnThrow=_ 0

View File

@ -12,7 +12,7 @@
<Column0>338</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
<Column0>322</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
</Workspace>
<Build>
@ -26,7 +26,7 @@
<ColumnWidth0>190</ColumnWidth0><ColumnWidth1>27</ColumnWidth1><ColumnWidth2>326</ColumnWidth2><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Build</Factory></Window></Windows></PreferedWindows></Find-in-Files>
<PROJECT_GUI_CALL_GRAPH><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><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></PROJECT_GUI_CALL_GRAPH></Static>
<PROJECT_GUI_CALL_GRAPH><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><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></PROJECT_GUI_CALL_GRAPH><Debug-Log><ColumnWidth0>17</ColumnWidth0><ColumnWidth1>367</ColumnWidth1></Debug-Log></Static>
<Windows>
@ -38,24 +38,24 @@
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>stm32f407</ExpandedNode><ExpandedNode>stm32f407/Boot</ExpandedNode><ExpandedNode>stm32f407/Output</ExpandedNode><ExpandedNode>stm32f407/lib</ExpandedNode><ExpandedNode>stm32f407/src</ExpandedNode></NodeDict></Session>
<NodeDict><ExpandedNode>stm32f407</ExpandedNode><ExpandedNode>stm32f407/Boot</ExpandedNode><ExpandedNode>stm32f407/Boot/lib</ExpandedNode><ExpandedNode>stm32f407/Boot/lib/uip</ExpandedNode><ExpandedNode>stm32f407/Output</ExpandedNode><ExpandedNode>stm32f407/Source</ExpandedNode><ExpandedNode>stm32f407/Source/ARMCM4_STM32</ExpandedNode><ExpandedNode>stm32f407/Source/ARMCM4_STM32/IAR</ExpandedNode><ExpandedNode>stm32f407/Source/third_party</ExpandedNode><ExpandedNode>stm32f407/lib</ExpandedNode><ExpandedNode>stm32f407/src</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1><Tabs><Tab><Identity>TabID-19870-1384</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd1></Windows>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1><Tabs><Tab><Identity>TabID-19870-1384</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-11216-22197</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><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>33</YPos2><SelStart2>2963</SelStart2><SelEnd2>2963</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>57</YPos2><SelStart2>4708</SelStart2><SelEnd2>4708</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>42</YPos2><SelStart2>2963</SelStart2><SelEnd2>2963</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>132</YPos2><SelStart2>8735</SelStart2><SelEnd2>8735</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-02beba70><key>iaridepm.enu1</key></Toolbar-02beba70></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>963</Bottom><Right>412</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198413</sizeHorzCY><sizeVertCX>215625</sizeVertCX><sizeVertCY>957341</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>963</Bottom><Right>420</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198413</sizeHorzCY><sizeVertCX>219792</sizeVertCX><sizeVertCY>957341</sizeVertCY></Rect></Wnd1></Sizes></Row0></Right><Bottom><Row0><Sizes/></Row0></Bottom><Float><Sizes/></Float></Positions>
<Top><Row0><Sizes><Toolbar-02acba70><key>iaridepm.enu1</key></Toolbar-02acba70></Sizes></Row0></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>963</Bottom><Right>413</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198413</sizeHorzCY><sizeVertCX>216146</sizeVertCX><sizeVertCY>957341</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>963</Bottom><Right>413</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198413</sizeHorzCY><sizeVertCX>216146</sizeVertCX><sizeVertCY>957341</sizeVertCY></Rect></Wnd1></Sizes></Row0></Right><Bottom><Row0><Sizes/></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Workspace>

View File

@ -299,11 +299,15 @@
<state>$PROJ_DIR$\..\lib\stdperiphlib</state>
<state>$PROJ_DIR$\..\lib\stdperiphlib\CMSIS\Device\ST\STM32F4xx\Include</state>
<state>$PROJ_DIR$\..\lib\stdperiphlib\CMSIS\Include</state>
<state>$PROJ_DIR$\..\lib\ethernetlib\inc</state>
<state>$PROJ_DIR$\..\lib\ethernetlib\src</state>
<state>$PROJ_DIR$\..\lib\fatfs</state>
<state>$PROJ_DIR$\..\lib\uip</state>
<state>$PROJ_DIR$\..\lib\stdperiphlib\STM32F4xx_StdPeriph_Driver\inc</state>
<state>$PROJ_DIR$\..\..\..\..\Source</state>
<state>$PROJ_DIR$\..\..\..\..\Source\ARMCM4_STM32</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\fatfs\src</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip</state>
</option>
<option>
<name>CCStdIncCheck</name>
@ -323,7 +327,7 @@
</option>
<option>
<name>CCOptLevel</name>
<state>0</state>
<state>1</state>
</option>
<option>
<name>CCOptStrategy</name>
@ -332,7 +336,7 @@
</option>
<option>
<name>CCOptLevelSlave</name>
<state>0</state>
<state>1</state>
</option>
<option>
<name>CompilerMisraRules98</name>
@ -1848,6 +1852,15 @@
<name>Boot</name>
<group>
<name>lib</name>
<group>
<name>ethernetlib</name>
<file>
<name>$PROJ_DIR$\..\lib\ethernetlib\src\stm32_eth.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\ethernetlib\inc\stm32_eth.h</name>
</file>
</group>
<group>
<name>fatfs</name>
<file>
@ -2055,6 +2068,24 @@
<name>$PROJ_DIR$\..\lib\stdperiphlib\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.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>
<file>
<name>$PROJ_DIR$\..\blt_conf.h</name>
@ -2139,6 +2170,66 @@
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\fatfs\src\option\unicode.c</name>
</file>
</group>
<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\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-fw.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip-fw.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip-neighbor.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip-split.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>
@ -2176,6 +2267,12 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\file.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\net.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\net.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\plausibility.h</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,456 @@
/*
* 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 "stm32f4xx.h" /* STM32 registers */
#include "stm32f4xx_conf.h" /* STM32 peripheral drivers */
#include "stm32_eth.h" /* STM32 ethernet library */
#include <string.h> /* for memcpy */
/*---------------------------------------------------------------------------*/
#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)
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void);
static void netdev_RxDscrInit(void);
/*---------------------------------------------------------------------------*/
typedef union _TranDesc0_t
{
uint32_t Data;
struct {
uint32_t DB : 1;
uint32_t UF : 1;
uint32_t ED : 1;
uint32_t CC : 4;
uint32_t VF : 1;
uint32_t EC : 1;
uint32_t LC : 1;
uint32_t NC : 1;
uint32_t LSC : 1;
uint32_t IPE : 1;
uint32_t FF : 1;
uint32_t JT : 1;
uint32_t ES : 1;
uint32_t IHE : 1;
uint32_t : 3;
uint32_t TCH : 1;
uint32_t TER : 1;
uint32_t CIC : 2;
uint32_t : 2;
uint32_t DP : 1;
uint32_t DC : 1;
uint32_t FS : 1;
uint32_t LSEG : 1;
uint32_t IC : 1;
uint32_t OWN : 1;
};
} TranDesc0_t, * pTranDesc0_t;
typedef union _TranDesc1_t
{
uint32_t Data;
struct {
uint32_t TBS1 :13;
uint32_t : 3;
uint32_t TBS2 :12;
uint32_t : 3;
};
} TranDesc1_t, * pTranDesc1_t;
typedef union _RecDesc0_t
{
uint32_t Data;
struct {
uint32_t RMAM_PCE : 1;
uint32_t CE : 1;
uint32_t DE : 1;
uint32_t RE : 1;
uint32_t RWT : 1;
uint32_t FT : 1;
uint32_t LC : 1;
uint32_t IPHCE : 1;
uint32_t LS : 1;
uint32_t FS : 1;
uint32_t VLAN : 1;
uint32_t OE : 1;
uint32_t LE : 1;
uint32_t SAF : 1;
uint32_t DERR : 1;
uint32_t ES : 1;
uint32_t FL :14;
uint32_t AFM : 1;
uint32_t OWN : 1;
};
} RecDesc0_t, * pRecDesc0_t;
typedef union _recDesc1_t
{
uint32_t Data;
struct {
uint32_t RBS1 :13;
uint32_t : 1;
uint32_t RCH : 1;
uint32_t RER : 1;
uint32_t RBS2 :14;
uint32_t DIC : 1;
};
} RecDesc1_t, * pRecDesc1_t;
typedef union _EnetDmaDesc_t
{
uint32_t Data[4];
// Rx DMA descriptor
struct
{
RecDesc0_t RxDesc0;
RecDesc1_t RxDesc1;
uint32_t * pBuffer;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Rx;
// Tx DMA descriptor
struct
{
TranDesc0_t TxDesc0;
TranDesc1_t TxDesc1;
uint32_t * pBuffer1;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Tx;
} EnetDmaDesc_t, * pEnetDmaDesc_t;
/*---------------------------------------------------------------------------*/
#pragma data_alignment=4
uint8_t RxBuff[UIP_CONF_BUFFER_SIZE];
#pragma data_alignment=4
uint8_t TxBuff[UIP_CONF_BUFFER_SIZE];
#pragma data_alignment=128
EnetDmaDesc_t EnetDmaRx;
#pragma data_alignment=128
EnetDmaDesc_t EnetDmaTx;
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
ETH_InitTypeDef ETH_InitStructure;
/* Enable ETHERNET clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx |
RCC_AHB1Periph_ETH_MAC_Rx | RCC_AHB1Periph_ETH_MAC_PTP, ENABLE);
/* Enable GPIOs clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOG, ENABLE);
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/*Select RMII Interface*/
SYSCFG_ETH_MediaInterfaceConfig(SYSCFG_ETH_MediaInterface_RMII);
/* ETHERNET pins configuration */
/* PA
ETH_RMII_REF_CLK: PA1
ETH_RMII_MDIO: PA2
ETH_RMII_MDINT: PA3
ETH_RMII_CRS_DV: PA7
*/
/* Configure PA1, PA2, PA3 and PA7*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Connect PA1, PA2, PA3 and PA7 to ethernet module*/
GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_ETH);
/* PB
ETH_RMII_TX_EN: PG11
*/
/* Configure PG11*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG11 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource11, GPIO_AF_ETH);
/* PC
ETH_RMII_MDC: PC1
ETH_RMII_RXD0: PC4
ETH_RMII_RXD1: PC5
*/
/* Configure PC1, PC4 and PC5*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Connect PC1, PC4 and PC5 to ethernet module*/
GPIO_PinAFConfig(GPIOC, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource5, GPIO_AF_ETH);
/* PG
ETH_RMII_TXD0: PG13
ETH_RMII_TXD1: PG14
*/
/* Configure PG13 and PG14*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG13 and PG14 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource13, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOG, GPIO_PinSource14, GPIO_AF_ETH);
/* Reset ETHERNET on AHB Bus */
ETH_DeInit();
/* Software reset */
ETH_SoftwareReset();
/* Wait for software reset */
while(ETH_GetSoftwareResetStatus()==SET);
/* ETHERNET Configuration ------------------------------------------------------*/
/* Call ETH_StructInit if you don't like to configure all ETH_InitStructure parameter */
ETH_StructInit(&ETH_InitStructure);
/* Fill ETH_InitStructure parametrs */
/*------------------------ MAC -----------------------------------*/
ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Disable ;
ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable;
ETH_InitStructure.ETH_RetryTransmission = ETH_RetryTransmission_Disable;
ETH_InitStructure.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;
ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Enable;
ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;
ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;
ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
ETH_InitStructure.ETH_Mode = ETH_Mode_FullDuplex;
ETH_InitStructure.ETH_Speed = ETH_Speed_100M;
unsigned int PhyAddr;
union {
uint32_t HI_LO;
struct
{
uint16_t LO;
uint16_t HI;
};
} PHYID;
for(PhyAddr = 0; 32 > PhyAddr; PhyAddr++)
{
// datasheet for the ks8721bl ethernet controller (http://www.micrel.com/_PDF/Ethernet/datasheets/ks8721bl-sl.pdf)
// page 20 --> PHY Identifier 1 and 2
PHYID.HI = ETH_ReadPHYRegister(PhyAddr,2); // 0x0022
PHYID.LO = ETH_ReadPHYRegister(PhyAddr,3); // 0x1619
if ((0x00221619 == PHYID.HI_LO) || (0x0007C0F1 == PHYID.HI_LO))
break;
}
if (32 < PhyAddr)
{
ASSERT_RT(BLT_FALSE);
}
/* Configure Ethernet */
if(0 == ETH_Init(&ETH_InitStructure, PhyAddr))
{
ASSERT_RT(BLT_FALSE);
}
netdev_TxDscrInit();
netdev_RxDscrInit();
ETH_Start();
}
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
/* 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);
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{
uint32_t size;
/*check for validity*/
if(0 == EnetDmaRx.Rx.RxDesc0.OWN)
{
/*Get the size of the packet*/
size = EnetDmaRx.Rx.RxDesc0.FL; // CRC
memcpy(uip_buf, RxBuff, size); //string.h library*/
}
else
{
return 0;
}
/* Give the buffer back to ENET */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Start the receive operation */
ETH->DMARPDR = 1;
/* Return no error */
return size;
}
/*---------------------------------------------------------------------------*/
void netdev_send(void)
{
while(EnetDmaTx.Tx.TxDesc0.OWN);
/* Copy the application buffer to the driver buffer
Using this MEMCOPY_L2L_BY4 makes the copy routine faster
than memcpy */
memcpy(TxBuff, uip_buf, uip_len);
/* Assign ENET address to Temp Tx Array */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Setting the Frame Length*/
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.LSEG = 1;
EnetDmaTx.Tx.TxDesc0.FS = 1;
EnetDmaTx.Tx.TxDesc0.DC = 0;
EnetDmaTx.Tx.TxDesc0.DP = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
EnetDmaTx.Tx.TxDesc1.TBS1 = (uip_len&0xFFF);
/* Start the ENET by setting the VALID bit in dmaPackStatus of current descr*/
EnetDmaTx.Tx.TxDesc0.OWN = 1;
/* Start the transmit operation */
ETH->DMATPDR = 1;
}
/*---------------------------------------------------------------------------*/
static void netdev_RxDscrInit(void)
{
/* Initialization */
/* Assign temp Rx array to the ENET buffer */
EnetDmaRx.Rx.pBuffer = (uint32_t *)RxBuff;
/* Initialize RX ENET Status and control */
EnetDmaRx.Rx.RxDesc0.Data = 0;
/* Initialize the next descriptor- In our case its single descriptor */
EnetDmaRx.Rx.pEnetDmaNextDesc = &EnetDmaRx;
EnetDmaRx.Rx.RxDesc1.Data = 0;
EnetDmaRx.Rx.RxDesc1.RER = 0; // end of ring
EnetDmaRx.Rx.RxDesc1.RCH = 1; // end of ring
/* Set the max packet size */
EnetDmaRx.Rx.RxDesc1.RBS1 = UIP_CONF_BUFFER_SIZE;
/* Setting the VALID bit */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Setting the RX NEXT Descriptor Register inside the ENET */
ETH->DMARDLAR = (uint32_t)&EnetDmaRx;
}
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void)
{
/* ENET Start Address */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Next Descriptor Address */
EnetDmaTx.Tx.pEnetDmaNextDesc = &EnetDmaTx;
/* Initialize ENET status and control */
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
/* Tx next set to Tx descriptor base */
ETH->DMATDLAR = (uint32_t)&EnetDmaTx;
}

View File

@ -0,0 +1,46 @@
/*
* 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);
unsigned int netdev_read(void);
void netdev_send(void);
#endif /* __NETDEV_H__ */

View File

@ -0,0 +1,151 @@
/**
* \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
/**
* uIP buffer size.
*
* \hideinitializer
*/
#define UIP_CONF_BUFFER_SIZE 1600
/**
* CPU byte order.
*
* \hideinitializer
*/
#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN
/**
* Logging on or off
*
* \hideinitializer
*/
#define UIP_CONF_LOGGING 0
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 0
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 1
/**
* 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"
#endif /* __UIP_CONF_H__ */
/** @} */
/** @} */

View File

@ -87,6 +87,7 @@ static void Init(void)
__disable_irq();
/* initialize the system and its clocks */
SystemInit();
#if (BOOT_COM_UART_ENABLE > 0)
/* enable UART peripheral clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART6, ENABLE);

View File

@ -87,7 +87,7 @@ void BootComCheckActivationRequest(void)
** \return none.
**
****************************************************************************************/
static void BootActivate(void)
void BootActivate(void)
{
/* perform software reset to activate the bootoader again */
NVIC_SystemReset();

View File

@ -38,6 +38,7 @@
****************************************************************************************/
void BootComInit(void);
void BootComCheckActivationRequest(void);
void BootActivate(void);
#endif /* BOOT_H */

View File

@ -43,6 +43,7 @@
#include "irq.h" /* IRQ driver */
#include "led.h" /* LED driver */
#include "timer.h" /* Timer driver */
#include "net.h" /* TCP/IP server application */
#endif /* HEADER_H */

View File

@ -25,7 +25,7 @@
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>stm32f407</ExpandedNode><ExpandedNode>stm32f407/Output</ExpandedNode><ExpandedNode>stm32f407/Prog</ExpandedNode></NodeDict></Session>
<NodeDict><ExpandedNode>stm32f407</ExpandedNode><ExpandedNode>stm32f407/Output</ExpandedNode><ExpandedNode>stm32f407/Prog</ExpandedNode><ExpandedNode>stm32f407/Prog/lib</ExpandedNode><ExpandedNode>stm32f407/Prog/lib/ethernetlib</ExpandedNode><ExpandedNode>stm32f407/Prog/lib/uip</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
@ -35,14 +35,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>45</YPos2><SelStart2>2856</SelStart2><SelEnd2>2856</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\boot.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>359</YPos2><SelStart2>17372</SelStart2><SelEnd2>17372</SelEnd2></Tab><ActiveTab>1</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>45</YPos2><SelStart2>2856</SelStart2><SelEnd2>2856</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\boot.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>284</YPos2><SelStart2>3114</SelStart2><SelEnd2>3114</SelEnd2></Tab><ActiveTab>1</ActiveTab><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>323</YPos2><SelStart2>12400</SelStart2><SelEnd2>12400</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\lib\uip\clock-arch.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>7</YPos2><SelStart2>1915</SelStart2><SelEnd2>1915</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\timer.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>0</SelStart2><SelEnd2>0</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>77</YPos2><SelStart2>5636</SelStart2><SelEnd2>5636</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\boot.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>2</YPos2><SelStart2>2072</SelStart2><SelEnd2>2072</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-02c4ba70><key>iaridepm.enu1</key></Toolbar-02c4ba70></Sizes></Row0></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>765</Bottom><Right>379</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198413</sizeHorzCY><sizeVertCX>198438</sizeVertCX><sizeVertCY>760913</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><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>198413</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198413</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
<Top><Row0><Sizes><Toolbar-0116ba70><key>iaridepm.enu1</key></Toolbar-0116ba70></Sizes></Row0></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>765</Bottom><Right>379</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198413</sizeHorzCY><sizeVertCX>198438</sizeVertCX><sizeVertCY>760913</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><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>198413</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198413</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Workspace>

View File

@ -296,10 +296,14 @@
<option>
<name>CCIncludePath2</name>
<state>$PROJ_DIR$\..</state>
<state>$PROJ_DIR$\..\lib\uip</state>
<state>$PROJ_DIR$\..\lib\ethernetlib\inc</state>
<state>$PROJ_DIR$\..\lib\ethernetlib\src</state>
<state>$PROJ_DIR$\..\lib\stdperiphlib</state>
<state>$PROJ_DIR$\..\lib\stdperiphlib\CMSIS\Device\ST\STM32F4xx\Include</state>
<state>$PROJ_DIR$\..\lib\stdperiphlib\CMSIS\Include</state>
<state>$PROJ_DIR$\..\lib\stdperiphlib\STM32F4xx_StdPeriph_Driver\inc</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip</state>
</option>
<option>
<name>CCStdIncCheck</name>
@ -1844,6 +1848,15 @@
<name>Prog</name>
<group>
<name>lib</name>
<group>
<name>ethernetlib</name>
<file>
<name>$PROJ_DIR$\..\lib\ethernetlib\src\stm32_eth.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\lib\ethernetlib\inc\stm32_eth.h</name>
</file>
</group>
<group>
<name>stdperiphlib</name>
<file>
@ -2042,6 +2055,84 @@
<name>$PROJ_DIR$\..\lib\stdperiphlib\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.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>
<group>
<name>third_party</name>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\clock.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-fw.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip-fw.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip-neighbor.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\uip-split.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>
<file>
<name>$PROJ_DIR$\..\boot.c</name>
@ -2070,6 +2161,12 @@
<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$\..\timer.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 "header.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,447 @@
/*
* 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 "header.h"
#include "stm32_eth.h" /* STM32 ethernet library */
#include <string.h> /* for memcpy */
/*---------------------------------------------------------------------------*/
#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)
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void);
static void netdev_RxDscrInit(void);
/*---------------------------------------------------------------------------*/
typedef union _TranDesc0_t
{
uint32_t Data;
struct {
uint32_t DB : 1;
uint32_t UF : 1;
uint32_t ED : 1;
uint32_t CC : 4;
uint32_t VF : 1;
uint32_t EC : 1;
uint32_t LC : 1;
uint32_t NC : 1;
uint32_t LSC : 1;
uint32_t IPE : 1;
uint32_t FF : 1;
uint32_t JT : 1;
uint32_t ES : 1;
uint32_t IHE : 1;
uint32_t : 3;
uint32_t TCH : 1;
uint32_t TER : 1;
uint32_t CIC : 2;
uint32_t : 2;
uint32_t DP : 1;
uint32_t DC : 1;
uint32_t FS : 1;
uint32_t LSEG : 1;
uint32_t IC : 1;
uint32_t OWN : 1;
};
} TranDesc0_t, * pTranDesc0_t;
typedef union _TranDesc1_t
{
uint32_t Data;
struct {
uint32_t TBS1 :13;
uint32_t : 3;
uint32_t TBS2 :12;
uint32_t : 3;
};
} TranDesc1_t, * pTranDesc1_t;
typedef union _RecDesc0_t
{
uint32_t Data;
struct {
uint32_t RMAM_PCE : 1;
uint32_t CE : 1;
uint32_t DE : 1;
uint32_t RE : 1;
uint32_t RWT : 1;
uint32_t FT : 1;
uint32_t LC : 1;
uint32_t IPHCE : 1;
uint32_t LS : 1;
uint32_t FS : 1;
uint32_t VLAN : 1;
uint32_t OE : 1;
uint32_t LE : 1;
uint32_t SAF : 1;
uint32_t DERR : 1;
uint32_t ES : 1;
uint32_t FL :14;
uint32_t AFM : 1;
uint32_t OWN : 1;
};
} RecDesc0_t, * pRecDesc0_t;
typedef union _recDesc1_t
{
uint32_t Data;
struct {
uint32_t RBS1 :13;
uint32_t : 1;
uint32_t RCH : 1;
uint32_t RER : 1;
uint32_t RBS2 :14;
uint32_t DIC : 1;
};
} RecDesc1_t, * pRecDesc1_t;
typedef union _EnetDmaDesc_t
{
uint32_t Data[4];
// Rx DMA descriptor
struct
{
RecDesc0_t RxDesc0;
RecDesc1_t RxDesc1;
uint32_t * pBuffer;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Rx;
// Tx DMA descriptor
struct
{
TranDesc0_t TxDesc0;
TranDesc1_t TxDesc1;
uint32_t * pBuffer1;
union
{
uint32_t * pBuffer2;
union _EnetDmaDesc_t * pEnetDmaNextDesc;
};
} Tx;
} EnetDmaDesc_t, * pEnetDmaDesc_t;
/*---------------------------------------------------------------------------*/
#pragma data_alignment=4
uint8_t RxBuff[UIP_CONF_BUFFER_SIZE];
#pragma data_alignment=4
uint8_t TxBuff[UIP_CONF_BUFFER_SIZE];
#pragma data_alignment=128
EnetDmaDesc_t EnetDmaRx;
#pragma data_alignment=128
EnetDmaDesc_t EnetDmaTx;
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
ETH_InitTypeDef ETH_InitStructure;
/* Enable ETHERNET clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx |
RCC_AHB1Periph_ETH_MAC_Rx | RCC_AHB1Periph_ETH_MAC_PTP, ENABLE);
/* Enable GPIOs clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOG, ENABLE);
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/*Select RMII Interface*/
SYSCFG_ETH_MediaInterfaceConfig(SYSCFG_ETH_MediaInterface_RMII);
/* ETHERNET pins configuration */
/* PA
ETH_RMII_REF_CLK: PA1
ETH_RMII_MDIO: PA2
ETH_RMII_MDINT: PA3
ETH_RMII_CRS_DV: PA7
*/
/* Configure PA1, PA2, PA3 and PA7*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Connect PA1, PA2, PA3 and PA7 to ethernet module*/
GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_ETH);
/* PB
ETH_RMII_TX_EN: PG11
*/
/* Configure PG11*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG11 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource11, GPIO_AF_ETH);
/* PC
ETH_RMII_MDC: PC1
ETH_RMII_RXD0: PC4
ETH_RMII_RXD1: PC5
*/
/* Configure PC1, PC4 and PC5*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
/* Connect PC1, PC4 and PC5 to ethernet module*/
GPIO_PinAFConfig(GPIOC, GPIO_PinSource1, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOC, GPIO_PinSource5, GPIO_AF_ETH);
/* PG
ETH_RMII_TXD0: PG13
ETH_RMII_TXD1: PG14
*/
/* Configure PG13 and PG14*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOG, &GPIO_InitStructure);
/* Connect PG13 and PG14 to ethernet module*/
GPIO_PinAFConfig(GPIOG, GPIO_PinSource13, GPIO_AF_ETH);
GPIO_PinAFConfig(GPIOG, GPIO_PinSource14, GPIO_AF_ETH);
/* Reset ETHERNET on AHB Bus */
ETH_DeInit();
/* Software reset */
ETH_SoftwareReset();
/* Wait for software reset */
while(ETH_GetSoftwareResetStatus()==SET);
/* ETHERNET Configuration ------------------------------------------------------*/
/* Call ETH_StructInit if you don't like to configure all ETH_InitStructure parameter */
ETH_StructInit(&ETH_InitStructure);
/* Fill ETH_InitStructure parametrs */
/*------------------------ MAC -----------------------------------*/
ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Disable ;
ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable;
ETH_InitStructure.ETH_RetryTransmission = ETH_RetryTransmission_Disable;
ETH_InitStructure.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable;
ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Enable;
ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable;
ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable;
ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect;
ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect;
ETH_InitStructure.ETH_Mode = ETH_Mode_FullDuplex;
ETH_InitStructure.ETH_Speed = ETH_Speed_100M;
unsigned int PhyAddr;
union {
uint32_t HI_LO;
struct
{
uint16_t LO;
uint16_t HI;
};
} PHYID;
for(PhyAddr = 0; 32 > PhyAddr; PhyAddr++)
{
// datasheet for the ks8721bl ethernet controller (http://www.micrel.com/_PDF/Ethernet/datasheets/ks8721bl-sl.pdf)
// page 20 --> PHY Identifier 1 and 2
PHYID.HI = ETH_ReadPHYRegister(PhyAddr,2); // 0x0022
PHYID.LO = ETH_ReadPHYRegister(PhyAddr,3); // 0x1619
if ((0x00221619 == PHYID.HI_LO) || (0x0007C0F1 == PHYID.HI_LO))
break;
}
/* Configure Ethernet */
ETH_Init(&ETH_InitStructure, PhyAddr);
netdev_TxDscrInit();
netdev_RxDscrInit();
ETH_Start();
}
/*---------------------------------------------------------------------------*/
void netdev_init_mac(void)
{
struct uip_eth_addr macAddress;
/* 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);
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{
uint32_t size;
/*check for validity*/
if(0 == EnetDmaRx.Rx.RxDesc0.OWN)
{
/*Get the size of the packet*/
size = EnetDmaRx.Rx.RxDesc0.FL; // CRC
memcpy(uip_buf, RxBuff, size); //string.h library*/
}
else
{
return 0;
}
/* Give the buffer back to ENET */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Start the receive operation */
ETH->DMARPDR = 1;
/* Return no error */
return size;
}
/*---------------------------------------------------------------------------*/
void netdev_send(void)
{
while(EnetDmaTx.Tx.TxDesc0.OWN);
/* Copy the application buffer to the driver buffer
Using this MEMCOPY_L2L_BY4 makes the copy routine faster
than memcpy */
memcpy(TxBuff, uip_buf, uip_len);
/* Assign ENET address to Temp Tx Array */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Setting the Frame Length*/
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.LSEG = 1;
EnetDmaTx.Tx.TxDesc0.FS = 1;
EnetDmaTx.Tx.TxDesc0.DC = 0;
EnetDmaTx.Tx.TxDesc0.DP = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
EnetDmaTx.Tx.TxDesc1.TBS1 = (uip_len&0xFFF);
/* Start the ENET by setting the VALID bit in dmaPackStatus of current descr*/
EnetDmaTx.Tx.TxDesc0.OWN = 1;
/* Start the transmit operation */
ETH->DMATPDR = 1;
}
/*---------------------------------------------------------------------------*/
static void netdev_RxDscrInit(void)
{
/* Initialization */
/* Assign temp Rx array to the ENET buffer */
EnetDmaRx.Rx.pBuffer = (uint32_t *)RxBuff;
/* Initialize RX ENET Status and control */
EnetDmaRx.Rx.RxDesc0.Data = 0;
/* Initialize the next descriptor- In our case its single descriptor */
EnetDmaRx.Rx.pEnetDmaNextDesc = &EnetDmaRx;
EnetDmaRx.Rx.RxDesc1.Data = 0;
EnetDmaRx.Rx.RxDesc1.RER = 0; // end of ring
EnetDmaRx.Rx.RxDesc1.RCH = 1; // end of ring
/* Set the max packet size */
EnetDmaRx.Rx.RxDesc1.RBS1 = UIP_CONF_BUFFER_SIZE;
/* Setting the VALID bit */
EnetDmaRx.Rx.RxDesc0.OWN = 1;
/* Setting the RX NEXT Descriptor Register inside the ENET */
ETH->DMARDLAR = (uint32_t)&EnetDmaRx;
}
/*---------------------------------------------------------------------------*/
static void netdev_TxDscrInit(void)
{
/* ENET Start Address */
EnetDmaTx.Tx.pBuffer1 = (uint32_t *)TxBuff;
/* Next Descriptor Address */
EnetDmaTx.Tx.pEnetDmaNextDesc = &EnetDmaTx;
/* Initialize ENET status and control */
EnetDmaTx.Tx.TxDesc0.TCH = 1;
EnetDmaTx.Tx.TxDesc0.Data = 0;
EnetDmaTx.Tx.TxDesc1.Data = 0;
/* Tx next set to Tx descriptor base */
ETH->DMATDLAR = (uint32_t)&EnetDmaTx;
}

View File

@ -0,0 +1,46 @@
/*
* 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);
unsigned int netdev_read(void);
void netdev_send(void);
#endif /* __NETDEV_H__ */

View File

@ -0,0 +1,151 @@
/**
* \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
/**
* uIP buffer size.
*
* \hideinitializer
*/
#define UIP_CONF_BUFFER_SIZE 1600
/**
* CPU byte order.
*
* \hideinitializer
*/
#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN
/**
* Logging on or off
*
* \hideinitializer
*/
#define UIP_CONF_LOGGING 0
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 0
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 1
/**
* 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"
#endif /* __UIP_CONF_H__ */
/** @} */
/** @} */

View File

@ -53,6 +53,8 @@ void main(void)
{
/* initialize the microcontroller */
Init();
/* initialize the network application */
NetInit();
/* initialize the bootloader interface */
BootComInit();
@ -61,6 +63,8 @@ void main(void)
{
/* toggle LED with a fixed frequency */
LedToggle();
/* run the network task */
NetTask();
/* check for bootloader activation request */
BootComCheckActivationRequest();
}

View File

@ -1,7 +1,7 @@
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x08008000;
define symbol __ICFEDIT_intvec_start__ = 0x0800C000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x08008000;
define symbol __ICFEDIT_region_ROM_start__ = 0x0800C000;
define symbol __ICFEDIT_region_ROM_end__ = 0x081FFFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x2002FFFF;

View File

@ -0,0 +1,211 @@
/************************************************************************************//**
* \file Demo\ARMCM3_LM3S_EK_LM3S6965_IAR\Prog\net.c
* \brief Network application for the uIP TCP/IP stack.
* \ingroup Prog_ARMCM3_LM3S_EK_LM3S6965_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 should have received a copy of the GNU General Public License along with OpenBLT.
* If not, see <http://www.gnu.org/licenses/>.
*
* A special exception to the GPL is included to allow you to distribute a combined work
* that includes OpenBLT without being obliged to provide the source code for any
* proprietary components. The exception text is included at the bottom of the license
* file <license.html>.
*
* \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;
/************************************************************************************//**
** \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();
/* 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);
/* 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();
} /*** 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))
{
/* 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;
}
}
}
/* 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,66 @@
/************************************************************************************//**
* \file Demo\ARMCM3_LM3S_EK_LM3S6965_IAR\Prog\net.h
* \brief Network application for the uIP TCP/IP stack.
* \ingroup Prog_ARMCM3_LM3S_EK_LM3S6965_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 should have received a copy of the GNU General Public License along with OpenBLT.
* If not, see <http://www.gnu.org/licenses/>.
*
* A special exception to the GPL is included to allow you to distribute a combined work
* that includes OpenBLT without being obliged to provide the source code for any
* proprietary components. The exception text is included at the bottom of the license
* file <license.html>.
*
* \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

@ -40,13 +40,9 @@
/****************************************************************************************
* Macro definitions
****************************************************************************************/
/** \brief Pointer to the user program's reset vector. Note that this needs to be
* changed in case the reserved memory for the bootloader is more than 0x6000.
*/
/** \brief Pointer to the user program's reset vector. */
#define CPU_USER_PROGRAM_STARTADDR_PTR ((blt_addr)(FlashGetUserProgBaseAddress() + 0x00000004))
/** \brief Pointer to the user program's vector table. Note that this needs to be
* changed in case the reserved memory for the bootloader is more than 0x6000.
*/
/** \brief Pointer to the user program's vector table. */
#define CPU_USER_PROGRAM_VECTABLE_OFFSET ((blt_int32u)FlashGetUserProgBaseAddress())

View File

@ -1,11 +1,11 @@
MEMORY
{
UNPLACED_SECTIONS (wx) : ORIGIN = 0x100000000, LENGTH = 0
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x00008000
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x0000C000
DATA_SRAM (wx) : ORIGIN = 0x10000000, LENGTH = 0x00010000
SYSTEM (wx) : ORIGIN = 0x1fff0000, LENGTH = 0x00007a10
OPTION (wx) : ORIGIN = 0x1fffc000, LENGTH = 0x00000008
RAM (wx) : ORIGIN = 0x20000000, LENGTH = 0x00004000
RAM (wx) : ORIGIN = 0x20000000, LENGTH = 0x00006000
SRAM1 (wx) : ORIGIN = 0x20000000, LENGTH = 0x0001c000
SRAM2 (wx) : ORIGIN = 0x2001c000, LENGTH = 0x00004000
APB1 (wx) : ORIGIN = 0x40000000, LENGTH = 0x00008000
@ -29,7 +29,7 @@ MEMORY
SECTIONS
{
__FLASH_segment_start__ = 0x08000000;
__FLASH_segment_end__ = 0x08008000;
__FLASH_segment_end__ = 0x0800C000;
__DATA_SRAM_segment_start__ = 0x10000000;
__DATA_SRAM_segment_end__ = 0x10010000;
__SYSTEM_segment_start__ = 0x1fff0000;
@ -37,7 +37,7 @@ SECTIONS
__OPTION_segment_start__ = 0x1fffc000;
__OPTION_segment_end__ = 0x1fffc008;
__RAM_segment_start__ = 0x20000000;
__RAM_segment_end__ = 0x20004000;
__RAM_segment_end__ = 0x20006000;
__SRAM1_segment_start__ = 0x20000000;
__SRAM1_segment_end__ = 0x2001c000;
__SRAM2_segment_start__ = 0x2001c000;

View File

@ -1,7 +1,7 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 16K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 48K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 24K
}
SECTIONS

Some files were not shown because too many files have changed in this diff Show More