Refs #584. Reintegrated branch for DHCP support development back into the trunk.

git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@572 5dc33758-31d5-4daf-9ae8-b24bf3d40d73
This commit is contained in:
Frank Voorburg 2018-08-02 14:32:30 +00:00
parent 14e2f87abd
commit d407f9b365
212 changed files with 32823 additions and 25469 deletions

View File

@ -50,7 +50,7 @@
/** \brief Motorola or Intel style byte ordering. */
#define BOOT_CPU_BYTE_ORDER_MOTOROLA (0)
/** \brief Enable/disable hook function call right before user program start. */
#define BOOT_CPU_USER_PROGRAM_START_HOOK (0)
#define BOOT_CPU_USER_PROGRAM_START_HOOK (1)
/****************************************************************************************
@ -80,72 +80,56 @@
* 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
* with the macros BOOT_COM_NET_IPADDRx. The default netmask is configured with the
* macro BOOT_COM_NET_NETMASKx. The default gateway is configured with the macros
* BOOT_COM_NET_GATEWAYx. The bootloader acts and a TCP/IP server. The port the server
* listen on for connections is configured with BOOT_COM_NET_PORT.
* In case the network switch/router supports a DHCP server, you can set configuration
* macro BOOT_COM_NET_DHCP_ENABLE to 1 to enable the DHCP client. In this case the
* DHCP client handles the automatic IP address assignment. In this case the macros for
* configuring the IP address, network mask and gateway address are no longer needed.
*/
/** \brief Enable/disable the NET transport layer. */
#define BOOT_COM_NET_ENABLE (1)
#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)
#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)
#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)
#define BOOT_COM_NET_PORT (1000)
/** \brief Enable/disable DHCP client for automatically obtaining an IP address. */
#define BOOT_COM_NET_DHCP_ENABLE (1)
/** \brief Configure the 1st byte of the IP address */
#define BOOT_COM_NET_IPADDR0 (169)
#define BOOT_COM_NET_IPADDR0 (192)
/** \brief Configure the 2nd byte of the IP address */
#define BOOT_COM_NET_IPADDR1 (254)
#define BOOT_COM_NET_IPADDR1 (168)
/** \brief Configure the 3rd byte of the IP address */
#define BOOT_COM_NET_IPADDR2 (19)
#define BOOT_COM_NET_IPADDR2 (178)
/** \brief Configure the 4th byte of the IP address */
#define BOOT_COM_NET_IPADDR3 (63)
#define BOOT_COM_NET_IPADDR3 (50)
/** \brief Configure the 1st byte of the network mask */
#define BOOT_COM_NET_NETMASK0 (255)
#define BOOT_COM_NET_NETMASK0 (255)
/** \brief Configure the 2nd byte of the network mask */
#define BOOT_COM_NET_NETMASK1 (255)
#define BOOT_COM_NET_NETMASK1 (255)
/** \brief Configure the 3rd byte of the network mask */
#define BOOT_COM_NET_NETMASK2 (0)
#define BOOT_COM_NET_NETMASK2 (255)
/** \brief Configure the 4th byte of the network mask */
#define BOOT_COM_NET_NETMASK3 (0)
#define BOOT_COM_NET_NETMASK3 (0)
/** \brief Configure the 1st byte of the gateway address */
#define BOOT_COM_NET_GATEWAY0 (169)
#define BOOT_COM_NET_GATEWAY0 (192)
/** \brief Configure the 2nd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY1 (254)
#define BOOT_COM_NET_GATEWAY1 (168)
/** \brief Configure the 3rd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY2 (19)
#define BOOT_COM_NET_GATEWAY2 (178)
/** \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_GATEWAY3 (1)
/** \brief Enable/disable the deferred initialization mechanism. When enabled, the
* communication interface is only initialized when: (a) no valid user program
* is detected, or (b) when CpuUserProgramStartHook() returns BLT_FALSE. Your
* bootloader application can explicitly initialize the communication interface
* by calling ComDeferredInit().
*/
#define BOOT_COM_NET_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.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (10000)
#endif
#define BOOT_COM_NET_DEFERRED_INIT_ENABLE (1)
/****************************************************************************************

View File

@ -30,6 +30,8 @@
* Include files
****************************************************************************************/
#include "boot.h" /* bootloader generic header */
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#if (BOOT_FILE_LOGGING_ENABLE > 0)
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
@ -81,6 +83,11 @@ blt_bool BackDoorEntryHook(void)
****************************************************************************************/
blt_bool CpuUserProgramStartHook(void)
{
/* do not start the user program is the pushbutton is pressed */
if (GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1) == 0)
{
return BLT_FALSE;
}
/* okay to start the user program */
return BLT_TRUE;
} /*** end of CpuUserProgramStartHook ***/
@ -193,79 +200,6 @@ blt_bool NvmWriteChecksumHook(void)
#endif /* BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0 */
/****************************************************************************************
* N E T W O R K I N T E R F A C E H O O K F U N C T I O N S
****************************************************************************************/
#if (BOOT_COM_NET_IPADDR_HOOK_ENABLE > 0)
/************************************************************************************//**
** \brief Callback that gets called when the IP address is about to be configured.
** \param ipAddrArray 4-byte array where the IP address should be stored.
** \return none.
**
****************************************************************************************/
void NetIpAddressHook(blt_int8u *ipAddrArray)
{
/* This hook function allows a dynamic configuration of the IP address. This could for
* example be used if the bootloader is activated from a running user program and
* should have the same IP address as the user program. This IP address could be stored
* at a fixed location in RAM which can be read here. For now the example implemen-
* tation simply configures the bootloader's default IP address.
*/
ipAddrArray[0] = BOOT_COM_NET_IPADDR0;
ipAddrArray[1] = BOOT_COM_NET_IPADDR1;
ipAddrArray[2] = BOOT_COM_NET_IPADDR2;
ipAddrArray[3] = BOOT_COM_NET_IPADDR3;
} /*** end of NetIpAddressHook ***/
#endif /* BOOT_COM_NET_IPADDR_HOOK_ENABLE > 0 */
#if (BOOT_COM_NET_NETMASK_HOOK_ENABLE > 0)
/************************************************************************************//**
** \brief Callback that gets called when the network mask is about to be configured.
** \param netMaskArray 4-byte array where the network mask should be stored.
** \return none.
**
****************************************************************************************/
void NetNetworkMaskHook(blt_int8u *netMaskArray)
{
/* This hook function allows a dynamic configuration of the network mask. This could
* for example be used if the bootloader is activated from a running user program and
* should have the same network mask as the user program. This network mask could be
* stored at a fixed location in RAM which can be read here. For now the example
* implementation simply configures the bootloader's default network mask.
*/
netMaskArray[0] = BOOT_COM_NET_NETMASK0;
netMaskArray[1] = BOOT_COM_NET_NETMASK1;
netMaskArray[2] = BOOT_COM_NET_NETMASK2;
netMaskArray[3] = BOOT_COM_NET_NETMASK3;
} /*** end of NetNetworkMaskHook ***/
#endif /* BOOT_COM_NET_NETMASK_HOOK_ENABLE > 0 */
#if (BOOT_COM_NET_GATEWAY_HOOK_ENABLE > 0)
/************************************************************************************//**
** \brief Callback that gets called when the gateway address is about to be
** configured.
** \param gatewayAddrArray 4-byte array where the gateway address should be stored.
** \return none.
**
****************************************************************************************/
void NetGatewayAddressHook(blt_int8u *gatewayAddrArray)
{
/* This hook function allows a dynamic configuration of the network mask. This could
* for example be used if the bootloader is activated from a running user program and
* should have the same network mask as the user program. This network mask could be
* stored at a fixed location in RAM which can be read here. For now the example
* implementation simply configures the bootloader's default network mask.
*/
gatewayAddrArray[0] = BOOT_COM_NET_GATEWAY0;
gatewayAddrArray[1] = BOOT_COM_NET_GATEWAY1;
gatewayAddrArray[2] = BOOT_COM_NET_GATEWAY2;
gatewayAddrArray[3] = BOOT_COM_NET_GATEWAY3;
} /*** end of NetGatewayAddressHook ***/
#endif /* BOOT_COM_NET_GATEWAY_HOOK_ENABLE > 0 */
/****************************************************************************************
* W A T C H D O G D R I V E R H O O K F U N C T I O N S
****************************************************************************************/

View File

@ -22,7 +22,7 @@
build_output_directory="$(ProjectDir)/../bin"
build_remove_unused_symbols="Yes"
c_preprocessor_definitions="gcc"
c_user_include_directories="$(ProjectDir)/..;$(ProjectDir)/../lib;$(ProjectDir)/../lib/inc;$(ProjectDir)/../lib/fatfs;$(ProjectDir)/../lib/uip;$(ProjectDir)/../lib/driverlib;$(ProjectDir)/../../../../Source;$(ProjectDir)/../../../../Source/third_party/fatfs/src;$(ProjectDir)/../../../../Source/third_party/uip/uip;$(ProjectDir)/../../../../Source/ARMCM3_LM3S;$(ProjectDir)/../../../../Source/ARMCM3_LM3S/Crossworks"
c_user_include_directories="$(ProjectDir)/..;$(ProjectDir)/../lib;$(ProjectDir)/../lib/inc;$(ProjectDir)/../lib/fatfs;$(ProjectDir)/../lib/uip;$(ProjectDir)/../lib/driverlib;$(ProjectDir)/../../../../Source;$(ProjectDir)/../../../../Source/third_party/fatfs/src;$(ProjectDir)/../../../../Source/third_party/uip/uip;$(ProjectDir)/../../../../Source/third_party/uip/apps/dhcpc;$(ProjectDir)/../../../../Source/ARMCM3_LM3S;$(ProjectDir)/../../../../Source/ARMCM3_LM3S/Crossworks"
gcc_entry_point="reset_handler"
gcc_optimization_level="Optimize For Size"
link_include_standard_libraries="Yes"
@ -100,6 +100,8 @@
<file file_name="../blt_conf.h" />
<file file_name="../cstart.s" />
<file file_name="../vectors.c" />
<file file_name="../shared_params.c" />
<file file_name="../shared_params.h" />
</folder>
</folder>
<folder Name="Source">
@ -157,6 +159,8 @@
<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" />
<file file_name="../../../../Source/third_party/uip/apps/dhcpc/dhcpc.c" />
<file file_name="../../../../Source/third_party/uip/apps/dhcpc/dhcpc.h" />
</folder>
</folder>
<file file_name="../../../../Source/net.c" />

View File

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

View File

@ -59,6 +59,10 @@
#define NETDEV_DEFAULT_MACADDR5 (0x45)
/*---------------------------------------------------------------------------*/
static struct uip_eth_addr macAddress;
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
@ -142,6 +146,18 @@ void netdev_init_mac(void)
}
/*---------------------------------------------------------------------------*/
void netdev_get_mac(unsigned char * mac_addr)
{
mac_addr[0] = macAddress.addr[0];
mac_addr[1] = macAddress.addr[1];
mac_addr[2] = macAddress.addr[2];
mac_addr[3] = macAddress.addr[3];
mac_addr[4] = macAddress.addr[4];
mac_addr[5] = macAddress.addr[5];
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{

View File

@ -40,6 +40,7 @@
void netdev_init(void);
void netdev_init_mac(void);
void netdev_get_mac(unsigned char * mac_addr);
unsigned int netdev_read(void);
void netdev_send(void);

View File

@ -98,6 +98,27 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_MAX_LISTENPORTS 1
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 1
/**
* UDP Maximum Connections
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CONNS 1
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 0
/**
* uIP buffer size.
*
@ -119,20 +140,6 @@ typedef unsigned short uip_stats_t;
*/
#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
*
@ -140,10 +147,12 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_STATISTICS 0
/* Here we include the header file for the application(s) we use in
our project. */
#include "boot.h"
#include "net.h"
#include "dhcpc.h"
#endif /* __UIP_CONF_H__ */

View File

@ -40,6 +40,7 @@
#if (BOOT_FILE_LOGGING_ENABLE > 0)
#include "driverlib/uartlib.h"
#endif
#include "shared_params.h" /* Shared parameters header */
/****************************************************************************************
* Function prototypes
@ -55,11 +56,44 @@ static void Init(void);
****************************************************************************************/
int main(void)
{
blt_int8u deferredInitRequestFlag = 0;
/* initialize the microcontroller */
Init();
/* initialize the shared parameters module */
SharedParamsInit();
/* initialize the bootloader */
BootInit();
#if (BOOT_COM_DEFERRED_INIT_ENABLE == 1)
/* the bootloader is configured to NOT initialize the TCP/IP network stack by default
* to bypass unnecessary delay times before starting the user program. the TCP/IP net-
* work tack is now only initialized when: (a) no valid user program is detected, or
* (b) a forced backdoor entry occurred (CpuUserProgramStartHook() returned BLT_FALSE).
*
* these demo bootloader and user programs have one extra feature implemented for
* demonstration purposes. the demo user program can detect firmware update requests
* from the TCP/IP network in which case it activates the bootloader. But...the
* TCP/IP network stack will not be initialized in this situation. for this reason
* the shared parameter module was integrated in both the bootloader and user program.
* more information about the shared parameter module can be found here:
* https://www.feaser.com/en/blog/?p=216
*
* the shared parameter at the first index (0) contains a flag. this flag is set to
* 1, right before the user program activates this bootloader, to explicitly request
* the bootloader to initialize the TCP/IP network stack. this makes it possible for
* a firmware update to proceed. the code here reads out this flag and performs the
* TCP/IP network stack initialization when requested.
*/
SharedParamsReadByIndex(0, &deferredInitRequestFlag);
if (deferredInitRequestFlag == 1)
{
/* explicitly initialize all communication interface for which the deferred
* initialization feature was enabled.
*/
ComDeferredInit();
}
#endif
/* start the infinite program loop */
while (1)
{
@ -81,6 +115,14 @@ static void Init(void)
{
/* set the clocking to run at 50MHz from the PLL */
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
/* initialize the status button as a digital input. it is used to override the
* starting of the user program.
*/
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_UART_CHANNEL_INDEX == 0)
/* enable and configure UART0 related peripherals and pins */

View File

@ -1,14 +1,15 @@
MEMORY
{
UNPLACED_SECTIONS (wx) : ORIGIN = 0x100000000, LENGTH = 0
SRAM (wx) : ORIGIN = 0x20000000, LENGTH = 0x00010000
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000
SHARED (wx) : ORIGIN = 0x20000000, LENGTH = 64
SRAM (wx) : ORIGIN = 0x20000040, LENGTH = 0x00010000 - 64
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000
}
SECTIONS
{
__SRAM_segment_start__ = 0x20000000;
__SRAM_segment_start__ = 0x20000040;
__SRAM_segment_end__ = 0x20010000;
__FLASH_segment_start__ = 0x00000000;
__FLASH_segment_end__ = 0x00008000;
@ -22,6 +23,17 @@ SECTIONS
__STACKSIZE_UND__ = 0;
__HEAPSIZE__ = 128;
.shared (NOLOAD):
{
. = ALIGN(4);
__shared_start__ = .;
*(.shared)
*(.shared.*)
KEEP(*(.shared))
. = ALIGN(4);
__shared_end__ = .;
} > SHARED
__vectors_ram_load_start__ = ALIGN(__SRAM_segment_start__ , 256);
.vectors_ram ALIGN(__SRAM_segment_start__ , 256) (NOLOAD) : AT(ALIGN(__SRAM_segment_start__ , 256))
{

View File

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

View File

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

View File

@ -36,6 +36,7 @@
#include "led.h" /* LED driver */
#include "time.h" /* Timer driver */
#include "net.h" /* TCP/IP server application */
#include "shared_params.h" /* Shared parameters header. */
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_nvic.h"

View File

@ -1,143 +1,196 @@
<!DOCTYPE CrossStudio_Project_File>
<solution Name="lm3s6965_crossworks" target="8" version="2">
<project Name="demoprog_ek_lm3s6965">
<configuration Name="Common" Placement="Flash" Target="LM3S6965" arm_architecture="v7M" arm_core_type="Cortex-M3" arm_gcc_target="arm-unknown-eabi" arm_linker_heap_size="128" arm_linker_process_stack_size="0" arm_linker_stack_size="128" arm_long_calls="Yes" arm_simulator_memory_simulation_filename="$(TargetsDir)/LM3S/LM3SSimulatorMemory.dll" arm_simulator_memory_simulation_parameter="0x40000;0x10000" arm_target_debug_interface_type="ADIv5" arm_target_loader_applicable_loaders="Flash" arm_target_loader_default_loader="Flash" arm_use_gcc_libraries="Yes" build_intermediate_directory="$(Configuration)/../../obj" build_output_directory="$(ProjectDir)/../bin" c_preprocessor_definitions="gcc" c_user_include_directories="$(ProjectDir)/..;$(ProjectDir)/../lib;$(ProjectDir)/../lib/inc;$(ProjectDir)/../lib/uip;$(ProjectDir)/../lib/driverlib;$(ProjectDir)/../../../../Source/third_party/uip/uip" gcc_entry_point="reset_handler" gcc_optimization_level="None" linker_additional_files="" linker_memory_map_file="$(TargetsDir)/LM3S/LM3S6965_MemoryMap.xml" linker_output_format="srec" linker_printf_width_precision_supported="No" linker_scanf_fmt_level="int" linker_section_placement_file="$(StudioDir)/targets/Cortex_M/flash_placement.xml" project_directory="" project_type="Executable" property_groups_file_path="$(TargetsDir)/LM3S/propertyGroups.xml" target_get_partname_script="GetPartName()" target_reset_script="Reset()"/>
<configuration Name="Flash" arm_target_flash_loader_file_path="$(TargetsDir)/LM3S/Release/Loader.elf" arm_target_flash_loader_type="LIBMEM RPC Loader" target_reset_script="FLASHReset()"/>
<configuration
Name="Common"
Placement="Flash"
Target="LM3S6965"
arm_architecture="v7M"
arm_core_type="Cortex-M3"
arm_gcc_target="arm-unknown-eabi"
arm_linker_heap_size="128"
arm_linker_process_stack_size="0"
arm_linker_stack_size="128"
arm_long_calls="Yes"
arm_simulator_memory_simulation_filename="$(TargetsDir)/LM3S/LM3SSimulatorMemory.dll"
arm_simulator_memory_simulation_parameter="0x40000;0x10000"
arm_target_debug_interface_type="ADIv5"
arm_target_loader_applicable_loaders="Flash"
arm_target_loader_default_loader="Flash"
arm_use_gcc_libraries="Yes"
build_intermediate_directory="$(Configuration)/../../obj"
build_output_directory="$(ProjectDir)/../bin"
c_preprocessor_definitions="gcc"
c_user_include_directories="$(ProjectDir)/..;$(ProjectDir)/../lib;$(ProjectDir)/../lib/inc;$(ProjectDir)/../lib/uip;$(ProjectDir)/../lib/driverlib;$(ProjectDir)/../../../../Source/third_party/uip/uip;$(ProjectDir)/../../../../Source/third_party/uip/apps/dhcpc"
gcc_entry_point="reset_handler"
gcc_optimization_level="None"
linker_additional_files=""
linker_memory_map_file="$(TargetsDir)/LM3S/LM3S6965_MemoryMap.xml"
linker_output_format="srec"
linker_printf_width_precision_supported="No"
linker_scanf_fmt_level="int"
linker_section_placement_file="$(StudioDir)/targets/Cortex_M/flash_placement.xml"
project_directory=""
project_type="Executable"
property_groups_file_path="$(TargetsDir)/LM3S/propertyGroups.xml"
target_get_partname_script="GetPartName()"
target_reset_script="Reset()" />
<configuration
Name="Flash"
arm_target_flash_loader_file_path="$(TargetsDir)/LM3S/Release/Loader.elf"
arm_target_flash_loader_type="LIBMEM RPC Loader"
target_reset_script="FLASHReset()" />
<folder Name="Source Files">
<configuration Name="Common" filter="c;cpp;cxx;cc;h;s;asm;inc"/>
<configuration Name="Common" filter="c;cpp;cxx;cc;h;s;asm;inc" />
<folder Name="Demo">
<folder Name="Prog" file_name="">
<file file_name="../boot.c"/>
<file file_name="../boot.h"/>
<file file_name="../cstart.s"/>
<file file_name="../header.h"/>
<file file_name="../led.c"/>
<file file_name="../led.h"/>
<file file_name="../main.c"/>
<file file_name="../vectors.c"/>
<file file_name="../time.c"/>
<file file_name="../time.h"/>
<file file_name="../net.c"/>
<file file_name="../net.h"/>
<folder Name="Prog">
<file file_name="../boot.c" />
<file file_name="../boot.h" />
<file file_name="../cstart.s" />
<file file_name="../header.h" />
<file file_name="../led.c" />
<file file_name="../led.h" />
<file file_name="../main.c" />
<file file_name="../vectors.c" />
<file file_name="../time.c" />
<file file_name="../time.h" />
<file file_name="../net.c" />
<file file_name="../net.h" />
<file file_name="../shared_params.c" />
<file file_name="../shared_params.h" />
</folder>
<folder Name="third_party" 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 Name="third_party">
<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" />
<file file_name="../../../../Source/third_party/uip/apps/dhcpc/dhcpc.c" />
<file file_name="../../../../Source/third_party/uip/apps/dhcpc/dhcpc.h" />
</folder>
</folder>
</folder>
<folder Name="System Files">
<file file_name="$(TargetsDir)/LM3S/LM3S_Target.js">
<configuration Name="Common" file_type="Reset Script"/>
<configuration Name="Common" file_type="Reset Script" />
</file>
<file file_name="../memory.x">
<configuration Name="Common" file_type="Linker Script"/>
<configuration Name="Common" file_type="Linker Script" />
</file>
</folder>
<folder Name="Library Files">
<folder Name="Inc">
<file file_name="../lib/inc/asmdefs.h"/>
<file file_name="../lib/inc/hw_adc.h"/>
<file file_name="../lib/inc/hw_comp.h"/>
<file file_name="../lib/inc/hw_epi.h"/>
<file file_name="../lib/inc/hw_ethernet.h"/>
<file file_name="../lib/inc/hw_flash.h"/>
<file file_name="../lib/inc/hw_gpio.h"/>
<file file_name="../lib/inc/hw_hibernate.h"/>
<file file_name="../lib/inc/hw_i2c.h"/>
<file file_name="../lib/inc/hw_i2s.h"/>
<file file_name="../lib/inc/hw_ints.h"/>
<file file_name="../lib/inc/hw_memmap.h"/>
<file file_name="../lib/inc/hw_nvic.h"/>
<file file_name="../lib/inc/hw_pwm.h"/>
<file file_name="../lib/inc/hw_qei.h"/>
<file file_name="../lib/inc/hw_ssi.h"/>
<file file_name="../lib/inc/hw_sysctl.h"/>
<file file_name="../lib/inc/hw_timer.h"/>
<file file_name="../lib/inc/hw_types.h"/>
<file file_name="../lib/inc/hw_uart.h"/>
<file file_name="../lib/inc/hw_udma.h"/>
<file file_name="../lib/inc/hw_usb.h"/>
<file file_name="../lib/inc/hw_watchdog.h"/>
<file file_name="../lib/inc/lm3s6965.h"/>
<file file_name="../lib/inc/asmdefs.h" />
<file file_name="../lib/inc/hw_adc.h" />
<file file_name="../lib/inc/hw_comp.h" />
<file file_name="../lib/inc/hw_epi.h" />
<file file_name="../lib/inc/hw_ethernet.h" />
<file file_name="../lib/inc/hw_flash.h" />
<file file_name="../lib/inc/hw_gpio.h" />
<file file_name="../lib/inc/hw_hibernate.h" />
<file file_name="../lib/inc/hw_i2c.h" />
<file file_name="../lib/inc/hw_i2s.h" />
<file file_name="../lib/inc/hw_ints.h" />
<file file_name="../lib/inc/hw_memmap.h" />
<file file_name="../lib/inc/hw_nvic.h" />
<file file_name="../lib/inc/hw_pwm.h" />
<file file_name="../lib/inc/hw_qei.h" />
<file file_name="../lib/inc/hw_ssi.h" />
<file file_name="../lib/inc/hw_sysctl.h" />
<file file_name="../lib/inc/hw_timer.h" />
<file file_name="../lib/inc/hw_types.h" />
<file file_name="../lib/inc/hw_uart.h" />
<file file_name="../lib/inc/hw_udma.h" />
<file file_name="../lib/inc/hw_usb.h" />
<file file_name="../lib/inc/hw_watchdog.h" />
<file file_name="../lib/inc/lm3s6965.h" />
</folder>
<folder Name="Driverlib">
<file file_name="../lib/driverlib/adc.c"/>
<file file_name="../lib/driverlib/adc.h"/>
<file file_name="../lib/driverlib/comp.c"/>
<file file_name="../lib/driverlib/comp.h"/>
<file file_name="../lib/driverlib/cpu.c"/>
<file file_name="../lib/driverlib/cpu.h"/>
<file file_name="../lib/driverlib/debug.h"/>
<file file_name="../lib/driverlib/epi.c"/>
<file file_name="../lib/driverlib/epi.h"/>
<file file_name="../lib/driverlib/ethernet.c"/>
<file file_name="../lib/driverlib/ethernet.h"/>
<file file_name="../lib/driverlib/flash.c"/>
<file file_name="../lib/driverlib/flash.h"/>
<file file_name="../lib/driverlib/gpio.c"/>
<file file_name="../lib/driverlib/gpio.h"/>
<file file_name="../lib/driverlib/hibernate.c"/>
<file file_name="../lib/driverlib/hibernate.h"/>
<file file_name="../lib/driverlib/i2c.c"/>
<file file_name="../lib/driverlib/i2c.h"/>
<file file_name="../lib/driverlib/i2s.c"/>
<file file_name="../lib/driverlib/i2s.h"/>
<file file_name="../lib/driverlib/interrupt.c"/>
<file file_name="../lib/driverlib/interrupt.h"/>
<file file_name="../lib/driverlib/mpu.c"/>
<file file_name="../lib/driverlib/mpu.h"/>
<file file_name="../lib/driverlib/pin_map.h"/>
<file file_name="../lib/driverlib/pwm.c"/>
<file file_name="../lib/driverlib/pwm.h"/>
<file file_name="../lib/driverlib/qei.c"/>
<file file_name="../lib/driverlib/qei.h"/>
<file file_name="../lib/driverlib/rom.h"/>
<file file_name="../lib/driverlib/rom_map.h"/>
<file file_name="../lib/driverlib/ssi.c"/>
<file file_name="../lib/driverlib/ssi.h"/>
<file file_name="../lib/driverlib/sysctl.c"/>
<file file_name="../lib/driverlib/sysctl.h"/>
<file file_name="../lib/driverlib/systick.c"/>
<file file_name="../lib/driverlib/systick.h"/>
<file file_name="../lib/driverlib/timer.c"/>
<file file_name="../lib/driverlib/timer.h"/>
<file file_name="../lib/driverlib/uart.c"/>
<file file_name="../lib/driverlib/uart.h"/>
<file file_name="../lib/driverlib/udma.c"/>
<file file_name="../lib/driverlib/udma.h"/>
<file file_name="../lib/driverlib/usb.c"/>
<file file_name="../lib/driverlib/usb.h"/>
<file file_name="../lib/driverlib/watchdog.c"/>
<file file_name="../lib/driverlib/watchdog.h"/>
<file file_name="../lib/driverlib/adc.c" />
<file file_name="../lib/driverlib/adc.h" />
<file file_name="../lib/driverlib/comp.c" />
<file file_name="../lib/driverlib/comp.h" />
<file file_name="../lib/driverlib/cpu.c" />
<file file_name="../lib/driverlib/cpu.h" />
<file file_name="../lib/driverlib/debug.h" />
<file file_name="../lib/driverlib/epi.c" />
<file file_name="../lib/driverlib/epi.h" />
<file file_name="../lib/driverlib/ethernet.c" />
<file file_name="../lib/driverlib/ethernet.h" />
<file file_name="../lib/driverlib/flash.c" />
<file file_name="../lib/driverlib/flash.h" />
<file file_name="../lib/driverlib/gpio.c" />
<file file_name="../lib/driverlib/gpio.h" />
<file file_name="../lib/driverlib/hibernate.c" />
<file file_name="../lib/driverlib/hibernate.h" />
<file file_name="../lib/driverlib/i2c.c" />
<file file_name="../lib/driverlib/i2c.h" />
<file file_name="../lib/driverlib/i2s.c" />
<file file_name="../lib/driverlib/i2s.h" />
<file file_name="../lib/driverlib/interrupt.c" />
<file file_name="../lib/driverlib/interrupt.h" />
<file file_name="../lib/driverlib/mpu.c" />
<file file_name="../lib/driverlib/mpu.h" />
<file file_name="../lib/driverlib/pin_map.h" />
<file file_name="../lib/driverlib/pwm.c" />
<file file_name="../lib/driverlib/pwm.h" />
<file file_name="../lib/driverlib/qei.c" />
<file file_name="../lib/driverlib/qei.h" />
<file file_name="../lib/driverlib/rom.h" />
<file file_name="../lib/driverlib/rom_map.h" />
<file file_name="../lib/driverlib/ssi.c" />
<file file_name="../lib/driverlib/ssi.h" />
<file file_name="../lib/driverlib/sysctl.c" />
<file file_name="../lib/driverlib/sysctl.h" />
<file file_name="../lib/driverlib/systick.c" />
<file file_name="../lib/driverlib/systick.h" />
<file file_name="../lib/driverlib/timer.c" />
<file file_name="../lib/driverlib/timer.h" />
<file file_name="../lib/driverlib/uart.c" />
<file file_name="../lib/driverlib/uart.h" />
<file file_name="../lib/driverlib/udma.c" />
<file file_name="../lib/driverlib/udma.h" />
<file file_name="../lib/driverlib/usb.c" />
<file file_name="../lib/driverlib/usb.h" />
<file file_name="../lib/driverlib/watchdog.c" />
<file file_name="../lib/driverlib/watchdog.h" />
</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 Name="uip">
<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>
</project>
<configuration Name="THUMB Debug" inherited_configurations="THUMB;Debug"/>
<configuration Name="THUMB" Platform="ARM" arm_instruction_set="THUMB" arm_library_instruction_set="THUMB" c_preprocessor_definitions="__THUMB" hidden="Yes"/>
<configuration Name="Debug" build_debug_information="Yes" c_preprocessor_definitions="DEBUG" gcc_optimization_level="None" hidden="Yes" link_include_startup_code="No"/>
<configuration Name="THUMB Debug" inherited_configurations="THUMB;Debug" />
<configuration
Name="THUMB"
Platform="ARM"
arm_instruction_set="THUMB"
arm_library_instruction_set="THUMB"
c_preprocessor_definitions="__THUMB"
hidden="Yes" />
<configuration
Name="Debug"
build_debug_information="Yes"
c_preprocessor_definitions="DEBUG"
gcc_optimization_level="None"
hidden="Yes"
link_include_startup_code="No" />
</solution>

View File

@ -21,11 +21,10 @@
<Project>
<ProjectSessionItem path="lm3s6965_crossworks" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;demoprog_ek_lm3s6965" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;demoprog_ek_lm3s6965;Library Files" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;demoprog_ek_lm3s6965;Library Files;uip" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;demoprog_ek_lm3s6965;Source Files" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;demoprog_ek_lm3s6965;Source Files;Demo" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;demoprog_ek_lm3s6965;Source Files;Demo;Prog" name="unnamed" />
<ProjectSessionItem path="lm3s6965_crossworks;demoprog_ek_lm3s6965;Source Files;Demo;third_party" name="unnamed" />
</Project>
<Register1>
<RegisterWindow openNodes="" binaryNodes="" unsignedNodes="" decimalNodes="" octalNodes="" asciiNodes="" visibleNodes="" name="" />
@ -56,11 +55,7 @@
<Watches active="0" update="Never" />
</Watch4>
<Files>
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="../main.c" y="0" path="../main.c" left="0" selected="0" name="unnamed" top="0" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="../led.c" y="28" path="../led.c" left="0" selected="0" name="unnamed" top="3" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Default" x="0" debugPath="../boot.c" y="176" path="../boot.c" left="0" selected="0" name="unnamed" top="150" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Default" x="0" debugPath="../net.c" y="164" path="../net.c" left="0" selected="0" name="unnamed" top="158" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Default" x="0" debugPath="../lib/uip/netdev.c" y="113" path="../lib/uip/netdev.c" left="0" selected="1" name="unnamed" top="85" />
<SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="../main.c" y="17" path="../main.c" left="0" selected="1" name="unnamed" top="13" />
</Files>
<ARMCrossStudioWindow activeProject="demoprog_ek_lm3s6965" autoConnectTarget="Texas Instruments ICDI" debugSearchFileMap="" fileDialogInitialDirectory="C:/Work/software/OpenBLT/Target/Source/third_party/uip/uip" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Debug" />
<ARMCrossStudioWindow activeProject="demoprog_ek_lm3s6965" autoConnectTarget="Texas Instruments ICDI" debugSearchFileMap="" fileDialogInitialDirectory="C:/Work/software/OpenBLT_DHCP_Support/Target/Source/third_party/uip/apps/dhcpc" fileDialogDefaultFilter="" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Debug" />
</session>

View File

@ -59,6 +59,10 @@
#define NETDEV_DEFAULT_MACADDR5 (0x45)
/*---------------------------------------------------------------------------*/
static struct uip_eth_addr macAddress;
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
@ -142,6 +146,18 @@ void netdev_init_mac(void)
}
/*---------------------------------------------------------------------------*/
void netdev_get_mac(unsigned char * mac_addr)
{
mac_addr[0] = macAddress.addr[0];
mac_addr[1] = macAddress.addr[1];
mac_addr[2] = macAddress.addr[2];
mac_addr[3] = macAddress.addr[3];
mac_addr[4] = macAddress.addr[4];
mac_addr[5] = macAddress.addr[5];
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{

View File

@ -40,6 +40,7 @@
void netdev_init(void);
void netdev_init_mac(void);
void netdev_get_mac(unsigned char * mac_addr);
unsigned int netdev_read(void);
void netdev_send(void);

View File

@ -98,6 +98,27 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_MAX_LISTENPORTS 1
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 1
/**
* UDP Maximum Connections
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CONNS 1
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 0
/**
* uIP buffer size.
*
@ -119,20 +140,6 @@ typedef unsigned short uip_stats_t;
*/
#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
*
@ -140,10 +147,12 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_STATISTICS 0
/* Here we include the header file for the application(s) we use in
our project. */
#include "boot.h"
#include "header.h"
#include "net.h"
#include "dhcpc.h"
#endif /* __UIP_CONF_H__ */

View File

@ -48,10 +48,17 @@ int main(void)
{
/* initialize the microcontroller */
Init();
/* initialize the shared parameters module */
SharedParamsInit();
/* initialize the network application */
NetInit();
/* initialize the bootloader interface */
BootComInit();
/* the shared parameter at index 0 is used as a boolean flag to indicate if the
* bootloader should initialize the TCP/IP network stack. by default this flag
* should be reset.
*/
SharedParamsWriteByIndex(0, 0);
/* start the infinite program loop */
while (1)

View File

@ -4,7 +4,8 @@ MEMORY
CM3_System_Control_Space (wx) : ORIGIN = 0xe000e000, LENGTH = 0x00001000
Peripherals (wx) : ORIGIN = 0x40020000, LENGTH = 0x00100000
FiRM_Peripherals (wx) : ORIGIN = 0x40000000, LENGTH = 0x00010000
SRAM (wx) : ORIGIN = 0x20000000, LENGTH = 0x00010000
SHARED (wx) : ORIGIN = 0x20000000, LENGTH = 64
SRAM (wx) : ORIGIN = 0x20000040, LENGTH = 0x00010000 - 64
FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 0x00040000 - 0x8000
}
@ -17,7 +18,7 @@ SECTIONS
__Peripherals_segment_end__ = 0x40120000;
__FiRM_Peripherals_segment_start__ = 0x40000000;
__FiRM_Peripherals_segment_end__ = 0x40010000;
__SRAM_segment_start__ = 0x20000000;
__SRAM_segment_start__ = 0x20000040;
__SRAM_segment_end__ = 0x20010000;
__FLASH_segment_start__ = 0x00008000;
__FLASH_segment_end__ = 0x00040000;
@ -31,6 +32,17 @@ SECTIONS
__STACKSIZE_UND__ = 0;
__HEAPSIZE__ = 128;
.shared (NOLOAD):
{
. = ALIGN(4);
__shared_start__ = .;
*(.shared)
*(.shared.*)
KEEP(*(.shared))
. = ALIGN(4);
__shared_end__ = .;
} > SHARED
__vectors_ram_load_start__ = ALIGN(__SRAM_segment_start__ , 256);
.vectors_ram ALIGN(__SRAM_segment_start__ , 256) (NOLOAD) : AT(ALIGN(__SRAM_segment_start__ , 256))
{

View File

@ -53,6 +53,10 @@
static unsigned long periodicTimerTimeOut;
/** \brief Holds the time out value of the uIP ARP timer. */
static unsigned long ARPTimerTimeOut;
#if (BOOT_COM_NET_DHCP_ENABLE > 0)
/** \brief Holds the MAC address which is used by the DHCP client. */
static struct uip_eth_addr macAddress;
#endif
/************************************************************************************//**
@ -71,6 +75,7 @@ void NetInit(void)
ARPTimerTimeOut = TimerGet() + NET_UIP_ARP_TIMER_MS;
/* initialize the uIP TCP/IP stack. */
uip_init();
#if (BOOT_COM_NET_DHCP_ENABLE == 0)
/* set the IP address */
uip_ipaddr(ipaddr, BOOT_COM_NET_IPADDR0, BOOT_COM_NET_IPADDR1, BOOT_COM_NET_IPADDR2,
BOOT_COM_NET_IPADDR3);
@ -83,10 +88,28 @@ void NetInit(void)
uip_ipaddr(ipaddr, BOOT_COM_NET_GATEWAY0, BOOT_COM_NET_GATEWAY1, BOOT_COM_NET_GATEWAY2,
BOOT_COM_NET_GATEWAY3);
uip_setdraddr(ipaddr);
#else
/* set the IP address */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_sethostaddr(ipaddr);
/* set the network mask */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_setnetmask(ipaddr);
/* set the gateway address */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_setdraddr(ipaddr);
#endif
/* start listening on the configured port for XCP transfers on TCP/IP */
uip_listen(HTONS(BOOT_COM_NET_PORT));
/* initialize the MAC and set the MAC address */
netdev_init_mac();
#if (BOOT_COM_NET_DHCP_ENABLE > 0)
/* initialize the DHCP client application and send the initial request. */
netdev_get_mac(&macAddress.addr[0]);
dhcpc_init(&macAddress.addr[0], 6);
dhcpc_request();
#endif
} /*** end of NetInit ***/
@ -117,6 +140,13 @@ void NetApp(void)
/* check if this was an XCP CONNECT command */
if ((newDataPtr[0] == 0xff) && (newDataPtr[1] == 0x00))
{
/* the shared parameter at index 0 is used as a boolean flag to indicate if the
* bootloader should initialize the TCP/IP network stack. we just received a
* firmware update request from the TCP/IP network and we are about to active
* the bootloader for a firmware update via TCP/IP. At this point we should
* set the flag to make sure the bootloader initializes its TCP/IP network stack.
*/
SharedParamsWriteByIndex(0, 1);
/* connection request received so start the bootloader */
BootActivate();
}
@ -136,13 +166,13 @@ void NetTask(void)
/* check for an RX packet and read it. */
packetLen = netdev_read();
if(packetLen > 0)
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))
if (NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_IP))
{
uip_arp_ipin();
uip_input();
@ -150,7 +180,7 @@ void NetTask(void)
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if(uip_len > 0)
if (uip_len > 0)
{
uip_arp_out();
netdev_send();
@ -158,7 +188,7 @@ void NetTask(void)
}
}
/* process incoming ARP packets here. */
else if(NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_ARP))
else if (NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_ARP))
{
uip_arp_arpin();
@ -166,14 +196,14 @@ void NetTask(void)
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if(uip_len > 0)
if (uip_len > 0)
{
netdev_send();
uip_len = 0;
}
}
}
/* process TCP/IP Periodic Timer here. */
if (TimerGet() >= periodicTimerTimeOut)
{
@ -181,6 +211,22 @@ void NetTask(void)
for (connection = 0; connection < UIP_CONNS; connection++)
{
uip_periodic(connection);
/* If the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if (uip_len > 0)
{
uip_arp_out();
netdev_send();
uip_len = 0;
}
}
#if UIP_UDP
for (connection = 0; connection < UIP_UDP_CONNS; connection++)
{
uip_udp_periodic(connection);
/* If the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
@ -192,13 +238,14 @@ void NetTask(void)
uip_len = 0;
}
}
#endif
}
/* process ARP Timer here. */
if (TimerGet() >= ARPTimerTimeOut)
{
ARPTimerTimeOut += NET_UIP_ARP_TIMER_MS;
uip_arp_timer();
ARPTimerTimeOut += NET_UIP_ARP_TIMER_MS;
uip_arp_timer();
}
} /*** end of NetServerTask ***/

View File

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

View File

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

View File

@ -7,45 +7,50 @@ start address 0x00000000
Program Header:
LOAD off 0x00010000 vaddr 0x00000000 paddr 0x00000000 align 2**16
filesz 0x00006fbc memsz 0x00006fbc flags r-x
LOAD off 0x00020000 vaddr 0x20000000 paddr 0x00006fbc align 2**16
filesz 0x000001dc memsz 0x00002098 flags rw-
filesz 0x000079cc memsz 0x000079cc flags r-x
LOAD off 0x00020040 vaddr 0x20000040 paddr 0x000079cc align 2**16
filesz 0x000001dc memsz 0x00002120 flags rw-
LOAD off 0x00030000 vaddr 0x20000000 paddr 0x20000000 align 2**16
filesz 0x00000000 memsz 0x00000040 flags rw-
private flags = 5000200: [Version5 EABI] [soft-float ABI]
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00006fbc 00000000 00000000 00010000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 000001dc 20000000 00006fbc 00020000 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00001ebc 200001dc 00007198 000201dc 2**2
0 .shared 00000040 20000000 20000000 00030000 2**2
ALLOC
3 .ARM.attributes 00000029 00000000 00000000 000201dc 2**0
1 .text 000079cc 00000000 00000000 00010000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .data 000001dc 20000040 000079cc 00020040 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00001f44 2000021c 00007ba8 0002021c 2**2
ALLOC
4 .ARM.attributes 00000029 00000000 00000000 0002021c 2**0
CONTENTS, READONLY
4 .comment 0000006e 00000000 00000000 00020205 2**0
5 .comment 0000006e 00000000 00000000 00020245 2**0
CONTENTS, READONLY
5 .debug_info 0000fb37 00000000 00000000 00020273 2**0
6 .debug_info 00011169 00000000 00000000 000202b3 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_abbrev 00002575 00000000 00000000 0002fdaa 2**0
7 .debug_abbrev 00002b8d 00000000 00000000 0003141c 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_loc 0000bb26 00000000 00000000 0003231f 2**0
8 .debug_loc 0000c330 00000000 00000000 00033fa9 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_aranges 00000f88 00000000 00000000 0003de45 2**0
9 .debug_aranges 00001100 00000000 00000000 000402d9 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_ranges 00000da8 00000000 00000000 0003edcd 2**0
10 .debug_ranges 00000ee0 00000000 00000000 000413d9 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_macro 00008fe5 00000000 00000000 0003fb75 2**0
11 .debug_macro 0000a351 00000000 00000000 000422b9 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_line 00007367 00000000 00000000 00048b5a 2**0
12 .debug_line 00008415 00000000 00000000 0004c60a 2**0
CONTENTS, READONLY, DEBUGGING
12 .debug_str 000284ac 00000000 00000000 0004fec1 2**0
13 .debug_str 0002b14d 00000000 00000000 00054a1f 2**0
CONTENTS, READONLY, DEBUGGING
13 .debug_frame 00002c78 00000000 00000000 00078370 2**2
14 .debug_frame 00003004 00000000 00000000 0007fb6c 2**2
CONTENTS, READONLY, DEBUGGING
SYMBOL TABLE:
20000000 l d .shared 00000000 .shared
00000000 l d .text 00000000 .text
20000000 l d .data 00000000 .data
200001dc l d .bss 00000000 .bss
20000040 l d .data 00000000 .data
2000021c l d .bss 00000000 .bss
00000000 l d .ARM.attributes 00000000 .ARM.attributes
00000000 l d .comment 00000000 .comment
00000000 l d .debug_info 00000000 .debug_info
@ -59,189 +64,218 @@ SYMBOL TABLE:
00000000 l d .debug_frame 00000000 .debug_frame
00000000 l df *ABS* 00000000 vectors.c
00000000 l df *ABS* 00000000 crtstuff.c
00006fb8 l O .text 00000000 __EH_FRAME_BEGIN__
000079c8 l O .text 00000000 __EH_FRAME_BEGIN__
000000f0 l F .text 00000000 __do_global_dtors_aux
200001dc l .bss 00000000 completed.8603
200001d8 l O .data 00000000 __do_global_dtors_aux_fini_array_entry
2000021c l .bss 00000000 completed.8603
20000218 l O .data 00000000 __do_global_dtors_aux_fini_array_entry
00000114 l F .text 00000000 frame_dummy
200001e0 l .bss 00000000 object.8608
200001d4 l O .data 00000000 __frame_dummy_init_array_entry
20000220 l .bss 00000000 object.8608
20000214 l O .data 00000000 __frame_dummy_init_array_entry
00000000 l df *ABS* 00000000 uartlib.c
0000014c l F .text 00000068 UARTBaseValid
00000000 l df *ABS* 00000000 gpio.c
000003a4 l F .text 00000124 GPIOBaseValid
00000000 l df *ABS* 00000000 ethernet.c
0000076c l F .text 0000008a EthernetPacketGetInternal
000007f8 l F .text 0000007c EthernetPacketPutInternal
0000078c l F .text 0000008a EthernetPacketGetInternal
00000818 l F .text 0000007c EthernetPacketPutInternal
00000000 l df *ABS* 00000000 flashlib.c
00000000 l df *ABS* 00000000 sysctl.c
00000cb0 l F .text 000003f8 SysCtlPeripheralValid
000066b8 l O .text 0000006c g_pulXtals
0000673c l O .text 0000000c g_pulRCGCRegs
00006748 l O .text 0000000c g_pulSRCRRegs
00000cd0 l F .text 000003f8 SysCtlPeripheralValid
000070c0 l O .text 0000006c g_pulXtals
00007144 l O .text 0000000c g_pulRCGCRegs
00007150 l O .text 0000000c g_pulSRCRRegs
00000000 l df *ABS* 00000000 ssi.c
00001540 l F .text 00000038 SSIBaseValid
00001560 l F .text 00000038 SSIBaseValid
00000000 l df *ABS* 00000000 clock-arch.c
00000000 l df *ABS* 00000000 netdev.c
00000000 l df *ABS* 00000000 mmc.c
00001880 l F .text 00000010 power_off
00001890 l F .text 00000058 send_initial_clock_train
000018e8 l F .text 0000008c power_on
00001974 l F .text 00000024 xchg_spi
00001998 l F .text 00000028 wait_ready
000019c0 l F .text 00000018 deselect
000019d8 l F .text 0000002c select
00001a04 l F .text 00000082 send_cmd
00001a88 l F .text 0000000e rcvr_spi_m
00001a98 l F .text 0000004e rcvr_datablock
00001ae8 l F .text 0000005a xmit_datablock
00001b44 l F .text 00000044 set_max_speed
200001f8 l O .bss 00000004 CardType
20000000 l O .data 00000001 Stat
000018b8 l F .text 00000010 power_off
000018c8 l F .text 00000058 send_initial_clock_train
00001920 l F .text 0000008c power_on
000019ac l F .text 00000024 xchg_spi
000019d0 l F .text 00000028 wait_ready
000019f8 l F .text 00000018 deselect
00001a10 l F .text 0000002c select
00001a3c l F .text 00000082 send_cmd
00001ac0 l F .text 0000000e rcvr_spi_m
00001ad0 l F .text 0000004e rcvr_datablock
00001b20 l F .text 0000005a xmit_datablock
00001b7c l F .text 00000044 set_max_speed
20000238 l O .bss 00000004 CardType
20000040 l O .data 00000001 Stat
00000000 l df *ABS* 00000000 cstart.c
000020c6 l F .text 00000000 zero_loop
000020fe l F .text 00000000 zero_loop
00000000 l df *ABS* 00000000 hooks.c
00006768 l O .text 0000001b firmwareFilename
200001fc l O .bss 0000022c logfile
00007170 l O .text 0000001b firmwareFilename
2000023c l O .bss 0000022c logfile
00000000 l df *ABS* 00000000 main.c
00002204 l F .text 00000024 Init
00002250 l F .text 00000048 Init
00000000 l df *ABS* 00000000 shared_params.c
000022dc l F .text 00000038 SharedParamsCalculateChecksum
00002314 l F .text 0000001c SharedParamsVerifyChecksum
00002330 l F .text 00000024 SharedParamsValidateBuffer
00002354 l F .text 00000010 SharedParamsWriteChecksum
20000000 l O .shared 00000040 sharedParamsBuffer
00000000 l df *ABS* 00000000 assert.c
00000000 l df *ABS* 00000000 file.c
00002250 l F .text 0000003c FileLibLongToIntString
0000228c l F .text 0000002a FileLibByteNibbleToChar
000022b8 l F .text 00000020 FileLibByteToHexString
000022d8 l F .text 00000058 FileLibHexStringToByte
20000428 l O .bss 00000040 loggingStr
20000468 l O .bss 00000001 firmwareUpdateState
2000046c l O .bss 00000008 eraseInfo
20000474 l O .bss 00000458 fatFsObjects
200008cc l O .bss 00000184 lineParseObject
000023cc l F .text 0000003c FileLibLongToIntString
00002408 l F .text 0000002a FileLibByteNibbleToChar
00002434 l F .text 00000020 FileLibByteToHexString
00002454 l F .text 00000058 FileLibHexStringToByte
20000468 l O .bss 00000040 loggingStr
200004a8 l O .bss 00000001 firmwareUpdateState
200004ac l O .bss 00000008 eraseInfo
200004b4 l O .bss 00000458 fatFsObjects
2000090c l O .bss 00000184 lineParseObject
00000000 l df *ABS* 00000000 cop.c
00000000 l df *ABS* 00000000 boot.c
00000000 l df *ABS* 00000000 backdoor.c
20000a50 l O .bss 00000001 backdoorOpen
20000a54 l O .bss 00000004 backdoorOpenTime
20000a90 l O .bss 00000004 backdoorExtensionTime
20000a94 l O .bss 00000001 backdoorOpen
20000a98 l O .bss 00000004 backdoorOpenTime
00000000 l df *ABS* 00000000 com.c
20000001 l O .data 00000001 comActiveInterface
20000a58 l O .bss 00000040 xcpCtoReqPacket.4517
20000041 l O .data 00000001 comActiveInterface
20000a9c l O .bss 00000040 xcpCtoReqPacket.4531
00000000 l df *ABS* 00000000 net.c
00002b04 l F .text 000000d4 NetServerTask
20000a98 l O .bss 00000004 ARPTimerTimeOut
20000a9c l O .bss 00000004 periodicTimerTimeOut
00002cc4 l F .text 0000010c NetServerTask
20000adc l O .bss 00000001 netInitializedFlag
20000ae0 l O .bss 00000004 ARPTimerTimeOut
20000ae4 l O .bss 00000006 macAddress
20000042 l O .data 00000001 netInitializationDeferred
20000aec l O .bss 00000004 periodicTimerTimeOut
00000000 l df *ABS* 00000000 xcp.c
00002cfc l F .text 0000000c XcpProtectResources
00002d08 l F .text 00000014 XcpSetCtoError
00002d1c l F .text 0000001c XcpCmdDisconnect
00002d38 l F .text 00000020 XcpCmdGetStatus
00002d58 l F .text 0000000a XcpCmdSynch
00002d64 l F .text 0000002c XcpCmdGetId
00002d90 l F .text 00000018 XcpCmdSetMta
00002da8 l F .text 0000000a XcpCmdProgramPrepare
00002db4 l F .text 00000028 XcpCmdProgramStart
00002ddc l F .text 00000050 XcpCmdConnect
00002e2c l F .text 00000040 XcpCmdUpload
00002e6c l F .text 00000040 XcpCmdShortUpload
00002eac l F .text 00000024 XcpComputeChecksum
00002ed0 l F .text 00000028 XcpCmdBuildCheckSum
00002ef8 l F .text 00000040 XcpCmdProgramMax
00002f38 l F .text 0000005c XcpCmdProgram
00002f94 l F .text 00000028 XcpCmdProgramClear
00002fbc l F .text 00000018 XcpCmdProgramReset
00002fd4 l F .text 0000000a XcpTransmitPacket
00006964 l O .text 00000008 xcpStationId
20000aa0 l O .bss 0000004c xcpInfo
00002f64 l F .text 0000000c XcpProtectResources
00002f70 l F .text 00000014 XcpSetCtoError
00002f84 l F .text 0000001c XcpCmdDisconnect
00002fa0 l F .text 00000020 XcpCmdGetStatus
00002fc0 l F .text 0000000a XcpCmdSynch
00002fcc l F .text 0000002c XcpCmdGetId
00002ff8 l F .text 00000018 XcpCmdSetMta
00003010 l F .text 0000000a XcpCmdProgramPrepare
0000301c l F .text 00000028 XcpCmdProgramStart
00003044 l F .text 00000050 XcpCmdConnect
00003094 l F .text 00000040 XcpCmdUpload
000030d4 l F .text 00000040 XcpCmdShortUpload
00003114 l F .text 00000024 XcpComputeChecksum
00003138 l F .text 00000028 XcpCmdBuildCheckSum
00003160 l F .text 00000040 XcpCmdProgramMax
000031a0 l F .text 0000005c XcpCmdProgram
000031fc l F .text 00000028 XcpCmdProgramClear
00003224 l F .text 00000018 XcpCmdProgramReset
0000323c l F .text 0000000a XcpTransmitPacket
0000736c l O .text 00000008 xcpStationId
20000af0 l O .bss 0000004c xcpInfo
00000000 l df *ABS* 00000000 timer.c
20000aec l O .bss 00000004 millisecond_counter
20000b3c l O .bss 00000004 millisecond_counter
00000000 l df *ABS* 00000000 flash.c
00003158 l F .text 00000048 FlashGetSector
000031a0 l F .text 00000038 FlashGetSectorBaseAddr
000031d8 l F .text 00000038 FlashGetSectorSize
00003210 l F .text 00000026 FlashInitBlock
00003238 l F .text 0000005c FlashWriteBlock
00003294 l F .text 0000003c FlashSwitchBlock
000032d0 l F .text 0000007a FlashAddToBlock
0000334c l F .text 0000005e FlashEraseSectors
0000696c l O .text 000000c0 flashLayout
20000af0 l O .bss 00000204 bootBlockInfo
20000cf4 l O .bss 00000204 blockInfo
000033c0 l F .text 00000048 FlashGetSector
00003408 l F .text 00000038 FlashGetSectorBaseAddr
00003440 l F .text 00000038 FlashGetSectorSize
00003478 l F .text 00000026 FlashInitBlock
000034a0 l F .text 0000005c FlashWriteBlock
000034fc l F .text 0000003c FlashSwitchBlock
00003538 l F .text 0000007a FlashAddToBlock
000035b4 l F .text 0000005e FlashEraseSectors
00007374 l O .text 000000c0 flashLayout
20000b40 l O .bss 00000204 bootBlockInfo
20000d44 l O .bss 00000204 blockInfo
00000000 l df *ABS* 00000000 cpu.c
00000000 l df *ABS* 00000000 nvm.c
00000000 l df *ABS* 00000000 uart.c
000035e0 l F .text 0000003c UartTransmitByte
0000361c l F .text 00000020 UartReceiveByte
20000ef8 l O .bss 00000004 xcpCtoRxStartTime.4736
20000efc l O .bss 00000041 xcpCtoReqPacket.4733
20000f3d l O .bss 00000001 xcpCtoRxLength.4734
20000f3e l O .bss 00000001 xcpCtoRxInProgress.4735
0000385c l F .text 0000003c UartTransmitByte
00003898 l F .text 00000020 UartReceiveByte
20000f48 l O .bss 00000004 xcpCtoRxStartTime.4748
20000f4c l O .bss 00000041 xcpCtoReqPacket.4745
20000f8d l O .bss 00000001 xcpCtoRxLength.4746
20000f8e l O .bss 00000001 xcpCtoRxInProgress.4747
00000000 l df *ABS* 00000000 cpu_comp.c
00000000 l df *ABS* 00000000 ff.c
00003760 l F .text 0000000a ld_word
0000376c l F .text 00000016 ld_dword
00003784 l F .text 00000008 st_word
0000378c l F .text 00000014 st_dword
000037a0 l F .text 00000012 mem_cpy
000037b4 l F .text 0000000a mem_set
000037c0 l F .text 0000001e mem_cmp
000037e0 l F .text 00000010 chk_chr
000037f0 l F .text 00000018 clust2sect
00003808 l F .text 00000024 ld_clust
0000382c l F .text 00000024 st_clust
00003850 l F .text 0000008c pick_lfn
000038dc l F .text 00000070 put_lfn
0000394c l F .text 000000a0 gen_numname
000039ec l F .text 0000001c sum_sfn
00003a08 l F .text 00000052 get_ldnumber
00003a5c l F .text 00000034 validate
00003a90 l F .text 00000054 sync_window
00003ae4 l F .text 00000034 move_window
00003b18 l F .text 00000060 check_fs
00003b78 l F .text 000002d4 find_volume
00003e4c l F .text 000000d0 get_fat
00003f1c l F .text 000000b2 dir_sdi
00003fd0 l F .text 0000010c put_fat
000040dc l F .text 000000ce create_chain
000041ac l F .text 0000007c remove_chain
00004228 l F .text 00000126 dir_next
00004350 l F .text 0000004c dir_alloc
0000439c l F .text 000000c4 dir_read
00004460 l F .text 00000050 dir_remove
000044b0 l F .text 00000228 create_name
000046d8 l F .text 000000e2 get_fileinfo
000047bc l F .text 000000ac cmp_lfn
00004868 l F .text 000000e8 dir_find
00004950 l F .text 0000008c follow_path
000049dc l F .text 0000013c dir_register
00004b18 l F .text 0000008c sync_fs
00005084 l F .text 0000004a putc_bfd
20000f40 l O .bss 00000200 LfnBuf
20001140 l O .bss 00000002 Fsid
00006a64 l O .text 00000080 ExCvt
00006ae4 l O .text 0000000d LfnOfs
20001144 l O .bss 00000004 FatFs
000039dc l F .text 0000000a ld_word
000039e8 l F .text 00000016 ld_dword
00003a00 l F .text 00000008 st_word
00003a08 l F .text 00000014 st_dword
00003a1c l F .text 00000012 mem_cpy
00003a30 l F .text 0000000a mem_set
00003a3c l F .text 0000001e mem_cmp
00003a5c l F .text 00000010 chk_chr
00003a6c l F .text 00000018 clust2sect
00003a84 l F .text 00000024 ld_clust
00003aa8 l F .text 00000024 st_clust
00003acc l F .text 0000008c pick_lfn
00003b58 l F .text 00000070 put_lfn
00003bc8 l F .text 000000a0 gen_numname
00003c68 l F .text 0000001c sum_sfn
00003c84 l F .text 00000052 get_ldnumber
00003cd8 l F .text 00000034 validate
00003d0c l F .text 00000054 sync_window
00003d60 l F .text 00000034 move_window
00003d94 l F .text 00000060 check_fs
00003df4 l F .text 000002d4 find_volume
000040c8 l F .text 000000d0 get_fat
00004198 l F .text 000000b2 dir_sdi
0000424c l F .text 0000010c put_fat
00004358 l F .text 000000ce create_chain
00004428 l F .text 0000007c remove_chain
000044a4 l F .text 00000126 dir_next
000045cc l F .text 0000004c dir_alloc
00004618 l F .text 000000c4 dir_read
000046dc l F .text 00000050 dir_remove
0000472c l F .text 00000228 create_name
00004954 l F .text 000000e2 get_fileinfo
00004a38 l F .text 000000ac cmp_lfn
00004ae4 l F .text 000000e8 dir_find
00004bcc l F .text 0000008c follow_path
00004c58 l F .text 0000013c dir_register
00004d94 l F .text 0000008c sync_fs
00005300 l F .text 0000004a putc_bfd
20000f90 l O .bss 00000200 LfnBuf
20001190 l O .bss 00000002 Fsid
0000746c l O .text 00000080 ExCvt
000074ec l O .text 0000000d LfnOfs
20001194 l O .bss 00000004 FatFs
00000000 l df *ABS* 00000000 unicode.c
00006af4 l O .text 000000bc cvt2.4380
00006bb0 l O .text 00000100 Tbl
00006cb0 l O .text 000001f2 cvt1.4379
000074fc l O .text 000000bc cvt2.4380
000075b8 l O .text 00000100 Tbl
000076b8 l O .text 000001f2 cvt1.4379
00000000 l df *ABS* 00000000 uip.c
00005574 l F .text 0000003a chksum
0000560c l F .text 00000030 uip_add_rcv_nxt
000056f8 l F .text 0000003c upper_layer_chksum
20001148 l O .bss 00000002 tmp16
2000114a l O .bss 00000002 ipid
2000114c l O .bss 00000004 iss
20001150 l O .bss 00000002 lastport
20001152 l O .bss 00000001 c
000057f0 l F .text 0000003a chksum
00005888 l F .text 00000030 uip_add_rcv_nxt
00005998 l F .text 0000003c upper_layer_chksum
20001198 l O .bss 00000002 tmp16
2000119a l O .bss 00000002 ipid
2000119c l O .bss 00000004 iss
200011a0 l O .bss 00000002 lastport
200011a2 l O .bss 00000001 c
00000000 l df *ABS* 00000000 uip_arp.c
00006204 l F .text 00000104 uip_arp_update
2000115a l O .bss 00000001 i
2000115b l O .bss 00000001 tmpage
2000115c l O .bss 00000060 arp_table
00006ea4 l O .text 00000006 broadcast_ethaddr
200011bc l O .bss 00000001 c
200011bd l O .bss 00000001 arptime
200011c0 l O .bss 00000004 ipaddr
0000669c l F .text 00000108 uip_arp_update
200011aa l O .bss 00000001 i
200011ab l O .bss 00000001 tmpage
200011ac l O .bss 00000060 arp_table
000078ac l O .text 00000006 broadcast_ethaddr
2000120c l O .bss 00000001 c
2000120d l O .bss 00000001 arptime
20001210 l O .bss 00000004 ipaddr
00000000 l df *ABS* 00000000 uip_timer.c
00000000 l df *ABS* 00000000 dhcpc.c
00006a6c l F .text 0000000e add_msg_type
00006a7c l F .text 0000001c add_server_id
00006a98 l F .text 00000016 add_req_options
00006ab0 l F .text 00000008 add_end
00006ab8 l F .text 0000002c dhcpc_configured
00006ae4 l F .text 0000001c add_req_ipaddr
00006b00 l F .text 00000078 parse_options
00006b78 l F .text 00000080 create_msg
00006bf8 l F .text 00000030 send_discover
00006c28 l F .text 00000034 send_request
00006c5c l F .text 00000058 parse_msg
00006d00 l F .text 00000288 handle_dhcp
000078b4 l O .text 00000004 xid
20001214 l O .bss 00000034 s
000078b8 l O .text 00000004 magic_cookie
00000000 l df *ABS* 00000000 locale.c
000065a8 l F .text 00000018 __get_current_locale
00006f90 l F .text 00000018 __get_current_locale
00000000 l df *ABS* 00000000 mbtowc_r.c
00000000 l df *ABS* 00000000 memcmp.c
00000000 l df *ABS* 00000000 memcpy-stub.c
00000000 l df *ABS* 00000000 memset.c
00000000 l df *ABS* 00000000 wctomb_r.c
@ -249,194 +283,216 @@ SYMBOL TABLE:
00000000 l df *ABS* 00000000 c:/progra~2/gnutoo~1/50a5a~1.420/bin/../lib/gcc/arm-none-eabi/5.4.1/armv7-m/crtn.o
00000000 l df *ABS* 00000000 ctype_.c
00000000 l df *ABS* 00000000 crtstuff.c
00006fb8 l O .text 00000000 __FRAME_END__
000079c8 l O .text 00000000 __FRAME_END__
00000000 l df *ABS* 00000000 impure.c
20000004 l O .data 00000060 impure_data
20000044 l O .data 00000060 impure_data
00000000 l df *ABS* 00000000
00000000 l *UND* 00000000 __bss_start__
00000000 l *UND* 00000000 __libc_fini_array
00000000 l *UND* 00000000 __bss_end__
00000000 l *UND* 00000000 __call_exitprocs
00000000 l *UND* 00000000 software_init_hook
200001d8 l .data 00000000 __init_array_end
20000218 l .data 00000000 __init_array_end
00000000 l *UND* 00000000 hardware_init_hook
00000000 l *UND* 00000000 atexit
200001d4 l .data 00000000 __preinit_array_end
20000214 l .data 00000000 __preinit_array_end
00000000 l *UND* 00000000 __stack
200001d4 l .data 00000000 __init_array_start
20000214 l .data 00000000 __init_array_start
00000000 l *UND* 00000000 _exit
200001d4 l .data 00000000 __preinit_array_start
00002a2c g F .text 00000020 ComInit
000033c4 g F .text 00000068 FlashWrite
00005400 g F .text 00000054 f_gets
00002248 g F .text 00000008 AssertFailure
00000704 g F .text 00000034 GPIOPinTypeSSI
000020a4 g F .text 00000040 reset_handler
000016dc g F .text 00000028 SSIDataGet
0000312c g F .text 0000001c TimerUpdate
0000300c g F .text 00000010 XcpPacketTransmitted
00002a4c g F .text 00000050 ComTask
00001654 g F .text 00000024 SSIEnable
000011bc g F .text 00000008 SysCtlDelay
200011c4 g O .bss 00000002 uip_len
20001154 g O .bss 00000006 uip_ethaddr
000055b0 g F .text 0000005c uip_add32
00002990 g F .text 00000020 BootInit
000023f0 g F .text 0000003a FileSrecVerifyChecksum
000065c0 g F .text 00000014 __locale_ctype_ptr
00002a0c g F .text 00000020 BackDoorInit
00001578 g F .text 000000dc SSIConfigSetExpClk
0000298c g F .text 00000002 CopService
00006fbc g .text 00000000 _etext
000010a8 g F .text 000000a4 SysCtlPeripheralReset
00003758 g F .text 00000004 CpuIrqDisable
000054e0 g F .text 00000094 ff_wtoupper
00000678 g F .text 00000024 GPIOPinWrite
00001830 g F .text 00000034 netdev_read
00005740 g F .text 00000a9c uip_process
00003540 g F .text 00000006 FlashGetUserProgBaseAddress
000065f8 g F .text 00000016 memcpy
00002578 g F .text 00000410 FileTask
20000214 l .data 00000000 __preinit_array_start
00002bdc g F .text 00000018 ComInit
0000362c g F .text 00000068 FlashWrite
0000567c g F .text 00000054 f_gets
00001858 g F .text 00000010 netdev_get_mac
000023c4 g F .text 00000008 AssertFailure
00000724 g F .text 00000034 GPIOPinTypeSSI
000020dc g F .text 00000040 reset_handler
000016fc g F .text 00000028 SSIDataGet
00003394 g F .text 0000001c TimerUpdate
00003274 g F .text 00000010 XcpPacketTransmitted
00002bf4 g F .text 00000050 ComTask
00001674 g F .text 00000024 SSIEnable
000011dc g F .text 00000008 SysCtlDelay
20001248 g O .bss 00000002 uip_len
200011a4 g O .bss 00000006 uip_ethaddr
00002b90 g F .text 0000000c BackDoorSetExtension
0000582c g F .text 0000005c uip_add32
00002b0c g F .text 00000020 BootInit
0000256c g F .text 0000003a FileSrecVerifyChecksum
00006fa8 g F .text 00000014 __locale_ctype_ptr
00002bc4 g F .text 00000018 BackDoorInit
00001598 g F .text 000000dc SSIConfigSetExpClk
00002b08 g F .text 00000002 CopService
000079cc g .text 00000000 _etext
000010c8 g F .text 000000a4 SysCtlPeripheralReset
000039d4 g F .text 00000004 CpuIrqDisable
0000575c g F .text 00000094 ff_wtoupper
00000698 g F .text 00000024 GPIOPinWrite
00001868 g F .text 00000034 netdev_read
000059e0 g F .text 00000bec uip_process
000037a8 g F .text 00000006 FlashGetUserProgBaseAddress
00006ffe g F .text 00000016 memcpy
000026f4 g F .text 00000410 FileTask
00000304 g F .text 00000028 UARTSpaceAvail
000030fc g F .text 0000000c TimerReset
00001b88 g F .text 00000160 disk_initialize
200011c8 g O .bss 00000004 uip_sappdata
00001704 g F .text 00000018 netdev_init
200011cc g O .bss 00000004 uip_acc32
000056d8 g F .text 00000020 uip_ipchksum
00003364 g F .text 0000000c TimerReset
00001bc0 g F .text 00000160 disk_initialize
2000124c g O .bss 00000004 uip_sappdata
0000172c g F .text 00000018 netdev_init
20001250 g O .bss 00000004 uip_acc32
00005978 g F .text 00000020 uip_ipchksum
00000358 g F .text 0000002c UARTCharPutNonBlocking
000029b0 g F .text 00000018 BootTask
0000346c g F .text 0000004c FlashWriteChecksum
00002aa0 g F .text 0000002c ComTransmitPacket
00000874 g F .text 00000030 EthernetInitExpClk
00001ce8 g F .text 00000014 disk_status
0000242c g F .text 0000014c FileSrecParseLine
00005698 g F .text 00000034 uip_listen
00001864 g F .text 0000001c netdev_send
00001e30 g F .text 00000274 disk_ioctl
00002370 g F .text 00000030 FileHandleFirmwareUpdateRequest
000009f0 g F .text 00000050 EthernetPacketPut
0000114c g F .text 00000070 SysCtlPeripheralEnable
200011d0 g O .bss 00000001 uip_flags
00002160 g F .text 00000044 FileFirmwareUpdateCompletedHook
00002ffc g F .text 00000010 XcpIsConnected
00005344 g F .text 000000bc f_unlink
00006638 g F .text 00000000 _init
000035a4 g F .text 00000008 NvmInit
000033ac g F .text 00000018 FlashInit
000035c4 g F .text 00000008 NvmGetUserProgBaseAddress
20001898 g .bss 00000000 _ebss
00005454 g F .text 00000050 f_puts
00002b2c g F .text 00000018 BootTask
000036d4 g F .text 0000004c FlashWriteChecksum
000065cc g F .text 000000a8 uip_udp_new
00002cac g F .text 00000018 ComDeferredInit
00002c48 g F .text 0000002c ComTransmitPacket
00000894 g F .text 00000030 EthernetInitExpClk
00001d20 g F .text 00000014 disk_status
000025a8 g F .text 0000014c FileSrecParseLine
00005938 g F .text 00000034 uip_listen
0000189c g F .text 0000001c netdev_send
00001e68 g F .text 00000274 disk_ioctl
000024ec g F .text 00000030 FileHandleFirmwareUpdateRequest
00000a10 g F .text 00000050 EthernetPacketPut
0000116c g F .text 00000070 SysCtlPeripheralEnable
20001254 g O .bss 00000001 uip_flags
000021ac g F .text 00000044 FileFirmwareUpdateCompletedHook
00003264 g F .text 00000010 XcpIsConnected
000055c0 g F .text 000000bc f_unlink
00007040 g F .text 00000000 _init
00003820 g F .text 00000008 NvmInit
00003614 g F .text 00000018 FlashInit
00003840 g F .text 00000008 NvmGetUserProgBaseAddress
20001960 g .bss 00000000 _ebss
000056d0 g F .text 00000050 f_puts
00006cb4 g F .text 0000003c dhcpc_init
00000800 g *ABS* 00000000 __STACKSIZE__
00002238 g F .text 00000010 UnusedISR
0000099c g F .text 00000054 EthernetPacketGetNonBlocking
00002a9c g F .text 00000002 ComFree
0000069c g F .text 00000034 GPIOPinTypeEthernetLED
000022cc g F .text 00000010 UnusedISR
000009bc g F .text 00000054 EthernetPacketGetNonBlocking
00000678 g F .text 00000020 GPIOPinRead
00002c44 g F .text 00000002 ComFree
000006bc g F .text 00000034 GPIOPinTypeEthernetLED
20001258 g O .bss 00000004 uip_udp_conn
00000000 w *UND* 00000000 __sf_fake_stderr
00006a54 g F .text 00000018 timer_expired
00000000 w *UND* 00000000 __deregister_frame_info
0000363c g F .text 00000024 UartInit
000035b4 g F .text 00000008 NvmErase
0000171c g F .text 00000114 netdev_init_mac
000038b8 g F .text 00000024 UartInit
00003830 g F .text 00000008 NvmErase
00002128 g F .text 00000014 CpuUserProgramStartHook
00001744 g F .text 00000114 netdev_init_mac
0000032c g F .text 0000002c UARTCharGetNonBlocking
0000169c g F .text 00000040 SSIDataPut
200001dc g .bss 00000000 _bss
0000516c g F .text 00000024 f_close
0000301c g F .text 000000e0 XcpPacketReceived
00005734 g F .text 0000000a uip_tcpchksum
00003548 g F .text 00000008 CpuInit
00004d74 g F .text 0000016c f_read
00003500 g F .text 00000040 FlashDone
200011d4 g O .bss 00000004 uip_appdata
200011d8 g O .bss 00000004 uip_conn
200011dc g O .bss 00000068 uip_conns
00000b70 g F .text 000000d8 FlashProgram
00002fe0 g F .text 0000001c XcpInit
00002330 g F .text 0000002c FileInit
00000a78 g F .text 00000028 EthernetIntStatus
00006448 g F .text 00000160 uip_arp_out
000016bc g F .text 00000040 SSIDataPut
2000021c g .bss 00000000 _bss
000053e8 g F .text 00000024 f_close
00003284 g F .text 000000e0 XcpPacketReceived
000059d4 g F .text 0000000a uip_tcpchksum
000037b0 g F .text 00000008 CpuInit
00004ff0 g F .text 0000016c f_read
00003768 g F .text 00000040 FlashDone
2000125c g O .bss 00000004 uip_appdata
20001260 g O .bss 00000004 uip_conn
00006fe0 g F .text 0000001e memcmp
20000040 g .shared 00000000 __shared_end__
20001264 g O .bss 00000068 uip_conns
00000b90 g F .text 000000d8 FlashProgram
00003248 g F .text 0000001c XcpInit
000024ac g F .text 0000002c FileInit
00000a98 g F .text 00000028 EthernetIntStatus
000068e4 g F .text 00000160 uip_arp_out
00000000 w *UND* 00000000 __sf_fake_stdin
0000342c g F .text 00000040 FlashErase
0000660e g F .text 00000010 memset
000021a4 g F .text 00000018 FileFirmwareUpdateErrorHook
00002228 g F .text 00000010 main
000050d0 g F .text 0000009c f_sync
0000133c g F .text 00000204 SysCtlClockGet
000023a0 g F .text 00000050 FileSrecGetLineType
00003694 g F .text 00000040 FlashErase
00007014 g F .text 00000010 memset
000021f0 g F .text 00000018 FileFirmwareUpdateErrorHook
00002298 g F .text 00000032 main
0000534c g F .text 0000009c f_sync
0000135c g F .text 00000204 SysCtlClockGet
0000251c g F .text 00000050 FileSrecGetLineType
000001e4 g F .text 00000038 UARTDisable
0000661e g F .text 0000001a __ascii_wctomb
000035cc g F .text 00000014 NvmDone
0000095c g F .text 00000040 EthernetEnable
00004ba4 g F .text 00000058 f_mount
00003660 g F .text 00000050 UartTransmitPacket
000035bc g F .text 00000008 NvmVerifyChecksum
00003584 g F .text 00000020 CpuMemCopy
00006644 g F .text 00000000 _fini
00005190 g F .text 00000168 f_lseek
00006368 g F .text 000000e0 uip_arp_arpin
00002ae4 g F .text 00000018 ComGetActiveInterfaceMaxTxLen
000036b0 g F .text 000000a8 UartReceivePacket
00002130 g F .text 00000008 FileGetFirmwareFilenameHook
0000375c g F .text 00000004 CpuIrqEnable
000008fc g F .text 00000060 EthernetMACAddrSet
20000064 g O .data 00000004 _impure_ptr
00006308 g F .text 00000060 uip_arp_timer
20001244 g O .bss 00000002 uip_listenports
20001248 g O .bss 00000004 uip_draddr
000065d4 g F .text 00000024 __ascii_mbtowc
20000000 g .data 00000000 _data
00000ad4 g F .text 00000044 EthernetPHYRead
000052f8 g F .text 0000004c f_stat
00002988 g F .text 00000002 CopInit
00001678 g F .text 00000024 SSIDisable
000035ac g F .text 00000008 NvmWrite
00003550 g F .text 00000034 CpuStartUserProgram
20002098 g .bss 00000000 _estack
000008a4 g F .text 00000058 EthernetConfigSet
000034b8 g F .text 00000048 FlashVerifyChecksum
00002c44 g F .text 0000003c NetTransmitPacket
200001dc g .data 00000000 _edata
0000235c g F .text 00000014 FileIsIdle
000056cc g F .text 0000000a htons
00004ee0 g F .text 000001a4 f_write
00007024 g F .text 0000001a __ascii_wctomb
00003848 g F .text 00000014 NvmDone
0000097c g F .text 00000040 EthernetEnable
00004e20 g F .text 00000058 f_mount
000038dc g F .text 00000050 UartTransmitPacket
00003838 g F .text 00000008 NvmVerifyChecksum
00003800 g F .text 00000020 CpuMemCopy
00002364 g F .text 00000030 SharedParamsInit
0000704c g F .text 00000000 _fini
0000540c g F .text 00000168 f_lseek
00006804 g F .text 000000e0 uip_arp_arpin
00002c8c g F .text 00000018 ComGetActiveInterfaceMaxTxLen
0000392c g F .text 000000a8 UartReceivePacket
0000217c g F .text 00000008 FileGetFirmwareFilenameHook
000039d8 g F .text 00000004 CpuIrqEnable
0000091c g F .text 00000060 EthernetMACAddrSet
200000a4 g O .data 00000004 _impure_ptr
000067a4 g F .text 00000060 uip_arp_timer
200012cc g O .bss 00000002 uip_listenports
200012d0 g O .bss 00000004 uip_draddr
00006fbc g F .text 00000024 __ascii_mbtowc
20000040 g .data 00000000 _data
00000af4 g F .text 00000044 EthernetPHYRead
00005574 g F .text 0000004c f_stat
00002b04 g F .text 00000002 CopInit
00002b9c g F .text 0000000c BackDoorGetExtension
00006a44 g F .text 0000000e timer_set
00001698 g F .text 00000024 SSIDisable
00003828 g F .text 00000008 NvmWrite
000037b8 g F .text 00000048 CpuStartUserProgram
20002160 g .bss 00000000 _estack
000008c4 g F .text 00000058 EthernetConfigSet
00003720 g F .text 00000048 FlashVerifyChecksum
00002e8c g F .text 00000048 NetTransmitPacket
2000021c g .data 00000000 _edata
000024d8 g F .text 00000014 FileIsIdle
0000596c g F .text 0000000a htons
00006f88 g F .text 00000008 dhcpc_appcall
0000515c g F .text 000001a4 f_write
00000000 g O .text 000000f0 _vectab
00000c48 g F .text 00000068 FlashUserGet
00000738 g F .text 00000034 GPIOPinTypeUART
00004bfc g F .text 00000178 f_open
00001d84 g F .text 000000ac disk_write
000006d0 g F .text 00000034 GPIOPinTypeGPIOOutput
000021bc g F .text 00000048 FileFirmwareUpdateLogHook
00002afc g F .text 00000008 ComIsConnected
00000c68 g F .text 00000068 FlashUserGet
00000758 g F .text 00000034 GPIOPinTypeUART
20000000 g .shared 00000000 __shared_start__
00004e78 g F .text 00000178 f_open
00001dbc g F .text 000000ac disk_write
000006f0 g F .text 00000034 GPIOPinTypeGPIOOutput
00002208 g F .text 00000048 FileFirmwareUpdateLogHook
00002ca4 g F .text 00000008 ComIsConnected
00000000 w *UND* 00000000 __sf_fake_stdout
00000a40 g F .text 00000038 EthernetIntDisable
00006eb4 g O .text 00000101 _ctype_
00000aa0 g F .text 00000034 EthernetIntClear
000020f0 g F .text 00000040 FileIsFirmwareUpdateRequestedHook
00000a60 g F .text 00000038 EthernetIntDisable
000078c6 g O .text 00000101 _ctype_
00000ac0 g F .text 00000034 EthernetIntClear
0000213c g F .text 00000040 FileIsFirmwareUpdateRequestedHook
00000384 g F .text 00000020 UARTBusy
0000563c g F .text 0000005c uip_init
00002acc g F .text 00000018 ComGetActiveInterfaceMaxRxLen
00002c80 g F .text 0000000a NetReceivePacket
000058b8 g F .text 00000080 uip_init
00001724 g F .text 00000008 clock_time
00002ba8 g F .text 0000001c BackDoorRestartTimer
00002c74 g F .text 00000018 ComGetActiveInterfaceMaxRxLen
00002ed4 g F .text 00000018 NetReceivePacket
000004c8 g F .text 00000064 GPIODirModeSet
00001cfc g F .text 00000088 disk_read
000029c8 g F .text 00000044 BackDoorCheck
20001898 g .bss 00000000 _stack
2000124c g O .bss 00000004 uip_netmask
20001250 g O .bss 00000004 uip_hostaddr
000054a4 g F .text 0000003c ff_convert
00003148 g F .text 00000010 TimerGet
00002c8c g F .text 00000070 NetApp
00001d34 g F .text 00000088 disk_read
00002b44 g F .text 0000004c BackDoorCheck
20001960 g .bss 00000000 _stack
00002394 g F .text 00000030 SharedParamsReadByIndex
200012d4 g O .bss 00000004 uip_netmask
00002e70 g F .text 0000001c NetDeferredInit
200012d8 g O .bss 00000004 uip_hostaddr
00005720 g F .text 0000003c ff_convert
000033b0 g F .text 00000010 TimerGet
00002eec g F .text 00000078 NetApp
00000000 w *UND* 00000000 _Jv_RegisterClasses
0000021c g F .text 000000e8 UARTConfigSetExpClk
00002bd8 g F .text 0000006c NetInit
000011c4 g F .text 00000178 SysCtlClockSet
00002dd0 g F .text 000000a0 NetInit
000011e4 g F .text 00000178 SysCtlClockSet
0000052c g F .text 0000014c GPIOPadConfigSet
00003108 g F .text 00000024 TimerInit
00003370 g F .text 00000024 TimerInit
00000000 w *UND* 00000000 __register_frame_info
20001254 g O .bss 00000642 uip_buf
20000068 g O .data 0000016c __global_locale
00000b18 g F .text 00000058 FlashClear
000061dc g F .text 00000028 uip_send
20001896 g O .bss 00000002 uip_slen
00002138 g F .text 00000028 FileFirmwareUpdateStartedHook
200012dc g O .bss 00000642 uip_buf
200000a8 g O .data 0000016c __global_locale
00000b38 g F .text 00000058 FlashClear
00006674 g F .text 00000028 uip_send
00006cf0 g F .text 00000010 dhcpc_request
2000191e g O .bss 00000002 uip_slen
00002184 g F .text 00000028 FileFirmwareUpdateStartedHook
20001920 g O .bss 00000040 uip_udp_conns
000001b4 g F .text 00000030 UARTEnable

View File

@ -50,7 +50,7 @@
/** \brief Motorola or Intel style byte ordering. */
#define BOOT_CPU_BYTE_ORDER_MOTOROLA (0)
/** \brief Enable/disable hook function call right before user program start. */
#define BOOT_CPU_USER_PROGRAM_START_HOOK (0)
#define BOOT_CPU_USER_PROGRAM_START_HOOK (1)
/****************************************************************************************
@ -80,72 +80,56 @@
* 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
* with the macros BOOT_COM_NET_IPADDRx. The default netmask is configured with the
* macro BOOT_COM_NET_NETMASKx. The default gateway is configured with the macros
* BOOT_COM_NET_GATEWAYx. The bootloader acts and a TCP/IP server. The port the server
* listen on for connections is configured with BOOT_COM_NET_PORT.
* In case the network switch/router supports a DHCP server, you can set configuration
* macro BOOT_COM_NET_DHCP_ENABLE to 1 to enable the DHCP client. In this case the
* DHCP client handles the automatic IP address assignment. In this case the macros for
* configuring the IP address, network mask and gateway address are no longer needed.
*/
/** \brief Enable/disable the NET transport layer. */
#define BOOT_COM_NET_ENABLE (1)
#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)
#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)
#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)
#define BOOT_COM_NET_PORT (1000)
/** \brief Enable/disable DHCP client for automatically obtaining an IP address. */
#define BOOT_COM_NET_DHCP_ENABLE (1)
/** \brief Configure the 1st byte of the IP address */
#define BOOT_COM_NET_IPADDR0 (169)
#define BOOT_COM_NET_IPADDR0 (192)
/** \brief Configure the 2nd byte of the IP address */
#define BOOT_COM_NET_IPADDR1 (254)
#define BOOT_COM_NET_IPADDR1 (168)
/** \brief Configure the 3rd byte of the IP address */
#define BOOT_COM_NET_IPADDR2 (19)
#define BOOT_COM_NET_IPADDR2 (178)
/** \brief Configure the 4th byte of the IP address */
#define BOOT_COM_NET_IPADDR3 (63)
#define BOOT_COM_NET_IPADDR3 (50)
/** \brief Configure the 1st byte of the network mask */
#define BOOT_COM_NET_NETMASK0 (255)
#define BOOT_COM_NET_NETMASK0 (255)
/** \brief Configure the 2nd byte of the network mask */
#define BOOT_COM_NET_NETMASK1 (255)
#define BOOT_COM_NET_NETMASK1 (255)
/** \brief Configure the 3rd byte of the network mask */
#define BOOT_COM_NET_NETMASK2 (0)
#define BOOT_COM_NET_NETMASK2 (255)
/** \brief Configure the 4th byte of the network mask */
#define BOOT_COM_NET_NETMASK3 (0)
#define BOOT_COM_NET_NETMASK3 (0)
/** \brief Configure the 1st byte of the gateway address */
#define BOOT_COM_NET_GATEWAY0 (169)
#define BOOT_COM_NET_GATEWAY0 (192)
/** \brief Configure the 2nd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY1 (254)
#define BOOT_COM_NET_GATEWAY1 (168)
/** \brief Configure the 3rd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY2 (19)
#define BOOT_COM_NET_GATEWAY2 (178)
/** \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_GATEWAY3 (1)
/** \brief Enable/disable the deferred initialization mechanism. When enabled, the
* communication interface is only initialized when: (a) no valid user program
* is detected, or (b) when CpuUserProgramStartHook() returns BLT_FALSE. Your
* bootloader application can explicitly initialize the communication interface
* by calling ComDeferredInit().
*/
#define BOOT_COM_NET_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.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (10000)
#endif
#define BOOT_COM_NET_DEFERRED_INIT_ENABLE (1)
/****************************************************************************************

View File

@ -30,6 +30,8 @@
* Include files
****************************************************************************************/
#include "boot.h" /* bootloader generic header */
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#if (BOOT_FILE_LOGGING_ENABLE > 0)
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
@ -81,6 +83,11 @@ blt_bool BackDoorEntryHook(void)
****************************************************************************************/
blt_bool CpuUserProgramStartHook(void)
{
/* do not start the user program is the pushbutton is pressed */
if (GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1) == 0)
{
return BLT_FALSE;
}
/* okay to start the user program */
return BLT_TRUE;
} /*** end of CpuUserProgramStartHook ***/
@ -193,79 +200,6 @@ blt_bool NvmWriteChecksumHook(void)
#endif /* BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0 */
/****************************************************************************************
* N E T W O R K I N T E R F A C E H O O K F U N C T I O N S
****************************************************************************************/
#if (BOOT_COM_NET_IPADDR_HOOK_ENABLE > 0)
/************************************************************************************//**
** \brief Callback that gets called when the IP address is about to be configured.
** \param ipAddrArray 4-byte array where the IP address should be stored.
** \return none.
**
****************************************************************************************/
void NetIpAddressHook(blt_int8u *ipAddrArray)
{
/* This hook function allows a dynamic configuration of the IP address. This could for
* example be used if the bootloader is activated from a running user program and
* should have the same IP address as the user program. This IP address could be stored
* at a fixed location in RAM which can be read here. For now the example implemen-
* tation simply configures the bootloader's default IP address.
*/
ipAddrArray[0] = BOOT_COM_NET_IPADDR0;
ipAddrArray[1] = BOOT_COM_NET_IPADDR1;
ipAddrArray[2] = BOOT_COM_NET_IPADDR2;
ipAddrArray[3] = BOOT_COM_NET_IPADDR3;
} /*** end of NetIpAddressHook ***/
#endif /* BOOT_COM_NET_IPADDR_HOOK_ENABLE > 0 */
#if (BOOT_COM_NET_NETMASK_HOOK_ENABLE > 0)
/************************************************************************************//**
** \brief Callback that gets called when the network mask is about to be configured.
** \param netMaskArray 4-byte array where the network mask should be stored.
** \return none.
**
****************************************************************************************/
void NetNetworkMaskHook(blt_int8u *netMaskArray)
{
/* This hook function allows a dynamic configuration of the network mask. This could
* for example be used if the bootloader is activated from a running user program and
* should have the same network mask as the user program. This network mask could be
* stored at a fixed location in RAM which can be read here. For now the example
* implementation simply configures the bootloader's default network mask.
*/
netMaskArray[0] = BOOT_COM_NET_NETMASK0;
netMaskArray[1] = BOOT_COM_NET_NETMASK1;
netMaskArray[2] = BOOT_COM_NET_NETMASK2;
netMaskArray[3] = BOOT_COM_NET_NETMASK3;
} /*** end of NetNetworkMaskHook ***/
#endif /* BOOT_COM_NET_NETMASK_HOOK_ENABLE > 0 */
#if (BOOT_COM_NET_GATEWAY_HOOK_ENABLE > 0)
/************************************************************************************//**
** \brief Callback that gets called when the gateway address is about to be
** configured.
** \param gatewayAddrArray 4-byte array where the gateway address should be stored.
** \return none.
**
****************************************************************************************/
void NetGatewayAddressHook(blt_int8u *gatewayAddrArray)
{
/* This hook function allows a dynamic configuration of the network mask. This could
* for example be used if the bootloader is activated from a running user program and
* should have the same network mask as the user program. This network mask could be
* stored at a fixed location in RAM which can be read here. For now the example
* implementation simply configures the bootloader's default network mask.
*/
gatewayAddrArray[0] = BOOT_COM_NET_GATEWAY0;
gatewayAddrArray[1] = BOOT_COM_NET_GATEWAY1;
gatewayAddrArray[2] = BOOT_COM_NET_GATEWAY2;
gatewayAddrArray[3] = BOOT_COM_NET_GATEWAY3;
} /*** end of NetGatewayAddressHook ***/
#endif /* BOOT_COM_NET_GATEWAY_HOOK_ENABLE > 0 */
/****************************************************************************************
* W A T C H D O G D R I V E R H O O K F U N C T I O N S
****************************************************************************************/

View File

@ -59,6 +59,10 @@
#define NETDEV_DEFAULT_MACADDR5 (0x45)
/*---------------------------------------------------------------------------*/
static struct uip_eth_addr macAddress;
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
@ -142,6 +146,18 @@ void netdev_init_mac(void)
}
/*---------------------------------------------------------------------------*/
void netdev_get_mac(unsigned char * mac_addr)
{
mac_addr[0] = macAddress.addr[0];
mac_addr[1] = macAddress.addr[1];
mac_addr[2] = macAddress.addr[2];
mac_addr[3] = macAddress.addr[3];
mac_addr[4] = macAddress.addr[4];
mac_addr[5] = macAddress.addr[5];
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{

View File

@ -40,6 +40,7 @@
void netdev_init(void);
void netdev_init_mac(void);
void netdev_get_mac(unsigned char * mac_addr);
unsigned int netdev_read(void);
void netdev_send(void);

View File

@ -98,6 +98,27 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_MAX_LISTENPORTS 1
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 1
/**
* UDP Maximum Connections
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CONNS 1
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 0
/**
* uIP buffer size.
*
@ -119,20 +140,6 @@ typedef unsigned short uip_stats_t;
*/
#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
*
@ -140,10 +147,12 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_STATISTICS 0
/* Here we include the header file for the application(s) we use in
our project. */
#include "boot.h"
#include "net.h"
#include "dhcpc.h"
#endif /* __UIP_CONF_H__ */

View File

@ -40,6 +40,7 @@
#if (BOOT_FILE_LOGGING_ENABLE > 0)
#include "driverlib/uartlib.h"
#endif
#include "shared_params.h" /* Shared parameters header */
/****************************************************************************************
* Function prototypes
@ -55,11 +56,44 @@ static void Init(void);
****************************************************************************************/
int main(void)
{
blt_int8u deferredInitRequestFlag = 0;
/* initialize the microcontroller */
Init();
/* initialize the shared parameters module */
SharedParamsInit();
/* initialize the bootloader */
BootInit();
#if (BOOT_COM_DEFERRED_INIT_ENABLE == 1)
/* the bootloader is configured to NOT initialize the TCP/IP network stack by default
* to bypass unnecessary delay times before starting the user program. the TCP/IP net-
* work tack is now only initialized when: (a) no valid user program is detected, or
* (b) a forced backdoor entry occurred (CpuUserProgramStartHook() returned BLT_FALSE).
*
* these demo bootloader and user programs have one extra feature implemented for
* demonstration purposes. the demo user program can detect firmware update requests
* from the TCP/IP network in which case it activates the bootloader. But...the
* TCP/IP network stack will not be initialized in this situation. for this reason
* the shared parameter module was integrated in both the bootloader and user program.
* more information about the shared parameter module can be found here:
* https://www.feaser.com/en/blog/?p=216
*
* the shared parameter at the first index (0) contains a flag. this flag is set to
* 1, right before the user program activates this bootloader, to explicitly request
* the bootloader to initialize the TCP/IP network stack. this makes it possible for
* a firmware update to proceed. the code here reads out this flag and performs the
* TCP/IP network stack initialization when requested.
*/
SharedParamsReadByIndex(0, &deferredInitRequestFlag);
if (deferredInitRequestFlag == 1)
{
/* explicitly initialize all communication interface for which the deferred
* initialization feature was enabled.
*/
ComDeferredInit();
}
#endif
/* start the infinite program loop */
while (1)
{
@ -81,6 +115,14 @@ static void Init(void)
{
/* set the clocking to run at 50MHz from the PLL */
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
/* initialize the status button as a digital input. it is used to override the
* starting of the user program.
*/
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_UART_CHANNEL_INDEX == 0)
/* enable and configure UART0 related peripherals and pins */

View File

@ -82,6 +82,8 @@ PROJ_FILES += ../../../Source/third_party/uip/uip/uip_timer.h
PROJ_FILES += ../../../Source/third_party/uip/uip/uiplib.c
PROJ_FILES += ../../../Source/third_party/uip/uip/uiplib.h
PROJ_FILES += ../../../Source/third_party/uip/uip/uipopt.h
PROJ_FILES += ../../../Source/third_party/uip/apps/dhcpc/dhcpc.c
PROJ_FILES += ../../../Source/third_party/uip/apps/dhcpc/dhcpc.h
#|--------------------------------------------------------------------------------------|

View File

@ -1,13 +1,25 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 32K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 32K
SHARED (rwx) : ORIGIN = 0x20000000, LENGTH = 64
SRAM (rwx) : ORIGIN = 0x20000040, LENGTH = 64K - 64
}
SECTIONS
{
__STACKSIZE__ = 2048;
.shared (NOLOAD):
{
. = ALIGN(4);
__shared_start__ = .;
*(.shared)
*(.shared.*)
KEEP(*(.shared))
. = ALIGN(4);
__shared_end__ = .;
} > SHARED
.text :
{
KEEP(*(.isr_vector))

View File

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

View File

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

View File

@ -7,45 +7,50 @@ start address 0x00008000
Program Header:
LOAD off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**16
filesz 0x0000a72c memsz 0x0000a72c flags r-x
LOAD off 0x00010000 vaddr 0x20000000 paddr 0x0000a72c align 2**16
filesz 0x00000008 memsz 0x00000b8c flags rw-
filesz 0x0000b058 memsz 0x0000b058 flags r-x
LOAD off 0x00010040 vaddr 0x20000040 paddr 0x0000b058 align 2**16
filesz 0x00000008 memsz 0x00000c0c flags rw-
LOAD off 0x00020000 vaddr 0x20000000 paddr 0x20000000 align 2**16
filesz 0x00000000 memsz 0x00000040 flags rw-
private flags = 5000200: [Version5 EABI] [soft-float ABI]
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000272c 00008000 00008000 00008000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000008 20000000 0000a72c 00010000 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000b84 20000008 0000a734 00010008 2**2
0 .shared 00000040 20000000 20000000 00020000 2**2
ALLOC
3 .ARM.attributes 00000029 00000000 00000000 00010008 2**0
1 .text 00003058 00008000 00008000 00008000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .data 00000008 20000040 0000b058 00010040 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00000c04 20000048 0000b060 00010048 2**2
ALLOC
4 .ARM.attributes 00000029 00000000 00000000 00010048 2**0
CONTENTS, READONLY
4 .comment 0000006e 00000000 00000000 00010031 2**0
5 .comment 0000006e 00000000 00000000 00010071 2**0
CONTENTS, READONLY
5 .debug_info 000065fb 00000000 00000000 0001009f 2**0
6 .debug_info 00007b79 00000000 00000000 000100df 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_abbrev 00001381 00000000 00000000 0001669a 2**0
7 .debug_abbrev 0000194f 00000000 00000000 00017c58 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_loc 00003dac 00000000 00000000 00017a1b 2**0
8 .debug_loc 0000450b 00000000 00000000 000195a7 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_aranges 00000838 00000000 00000000 0001b7c7 2**0
9 .debug_aranges 00000978 00000000 00000000 0001dab2 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_ranges 00000738 00000000 00000000 0001bfff 2**0
10 .debug_ranges 00000838 00000000 00000000 0001e42a 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_macro 000055c7 00000000 00000000 0001c737 2**0
11 .debug_macro 000070a8 00000000 00000000 0001ec62 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_line 00003380 00000000 00000000 00021cfe 2**0
12 .debug_line 000051e3 00000000 00000000 00025d0a 2**0
CONTENTS, READONLY, DEBUGGING
12 .debug_str 00023b30 00000000 00000000 0002507e 2**0
13 .debug_str 000266b4 00000000 00000000 0002aeed 2**0
CONTENTS, READONLY, DEBUGGING
13 .debug_frame 00001540 00000000 00000000 00048bb0 2**2
14 .debug_frame 00001870 00000000 00000000 000515a4 2**2
CONTENTS, READONLY, DEBUGGING
SYMBOL TABLE:
20000000 l d .shared 00000000 .shared
00008000 l d .text 00000000 .text
20000000 l d .data 00000000 .data
20000008 l d .bss 00000000 .bss
20000040 l d .data 00000000 .data
20000048 l d .bss 00000000 .bss
00000000 l d .ARM.attributes 00000000 .ARM.attributes
00000000 l d .comment 00000000 .comment
00000000 l d .debug_info 00000000 .debug_info
@ -59,13 +64,13 @@ SYMBOL TABLE:
00000000 l d .debug_frame 00000000 .debug_frame
00000000 l df *ABS* 00000000 vectors.c
00000000 l df *ABS* 00000000 crtstuff.c
0000a728 l O .text 00000000 __EH_FRAME_BEGIN__
0000b054 l O .text 00000000 __EH_FRAME_BEGIN__
000080f4 l F .text 00000000 __do_global_dtors_aux
20000008 l .bss 00000000 completed.8603
20000004 l O .data 00000000 __do_global_dtors_aux_fini_array_entry
20000048 l .bss 00000000 completed.8603
20000044 l O .data 00000000 __do_global_dtors_aux_fini_array_entry
00008118 l F .text 00000000 frame_dummy
2000000c l .bss 00000000 object.8608
20000000 l O .data 00000000 __frame_dummy_init_array_entry
2000004c l .bss 00000000 object.8608
20000040 l O .data 00000000 __frame_dummy_init_array_entry
00000000 l df *ABS* 00000000 systick.c
00000000 l df *ABS* 00000000 flash.c
00000000 l df *ABS* 00000000 gpio.c
@ -77,53 +82,81 @@ SYMBOL TABLE:
000088f4 l F .text 0000002c UARTBaseValid
00000000 l df *ABS* 00000000 sysctl.c
00008a9c l F .text 000001f8 SysCtlPeripheralValid
0000a694 l O .text 0000005c g_pulXtals
0000a708 l O .text 0000000c g_pulRCGCRegs
0000a714 l O .text 0000000c g_pulSRCRRegs
0000afb8 l O .text 0000005c g_pulXtals
0000b02c l O .text 0000000c g_pulRCGCRegs
0000b038 l O .text 0000000c g_pulSRCRRegs
00000000 l df *ABS* 00000000 clock-arch.c
00000000 l df *ABS* 00000000 netdev.c
00000000 l df *ABS* 00000000 led.c
20000024 l O .bss 00000004 timer_counter_last.4548
20000028 l O .bss 00000001 led_toggle_state.4547
20000064 l O .bss 00000004 timer_counter_last.4602
20000068 l O .bss 00000001 led_toggle_state.4601
00000000 l df *ABS* 00000000 cstart.c
000092ba l F .text 00000000 zero_loop
000092d2 l F .text 00000000 zero_loop
00000000 l df *ABS* 00000000 main.c
000092e4 l F .text 00000018 Init
2000002c l O .bss 00000004 assert_failure_line.4555
000092fc l F .text 00000018 Init
2000006c l O .bss 00000004 assert_failure_line.4609
00000000 l df *ABS* 00000000 boot.c
00009328 l F .text 00000038 BootComUartInit
00009360 l F .text 00000020 UartReceiveByte
00009390 l F .text 00000098 BootComUartCheckActivationRequest
20000030 l O .bss 00000004 xcpCtoRxStartTime.4565
20000034 l O .bss 00000041 xcpCtoReqPacket.4562
20000075 l O .bss 00000001 xcpCtoRxLength.4563
20000076 l O .bss 00000001 xcpCtoRxInProgress.4564
0000934c l F .text 00000038 BootComUartInit
00009384 l F .text 00000020 UartReceiveByte
000093b4 l F .text 00000098 BootComUartCheckActivationRequest
20000070 l O .bss 00000004 xcpCtoRxStartTime.4619
20000074 l O .bss 00000041 xcpCtoReqPacket.4616
200000b5 l O .bss 00000001 xcpCtoRxLength.4617
200000b6 l O .bss 00000001 xcpCtoRxInProgress.4618
00000000 l df *ABS* 00000000 shared_params.c
00009454 l F .text 00000038 SharedParamsCalculateChecksum
0000948c l F .text 0000001c SharedParamsVerifyChecksum
000094a8 l F .text 00000024 SharedParamsValidateBuffer
000094cc l F .text 00000010 SharedParamsWriteChecksum
20000000 l O .shared 00000040 sharedParamsBuffer
00000000 l df *ABS* 00000000 net.c
20000078 l O .bss 00000004 ARPTimerTimeOut
2000007c l O .bss 00000004 periodicTimerTimeOut
200000b8 l O .bss 00000004 ARPTimerTimeOut
200000bc l O .bss 00000006 macAddress
200000c4 l O .bss 00000004 periodicTimerTimeOut
00000000 l df *ABS* 00000000 time.c
20000080 l O .bss 00000004 millisecond_counter
200000c8 l O .bss 00000004 millisecond_counter
00000000 l df *ABS* 00000000 uip.c
000095f4 l F .text 0000003a chksum
0000968c l F .text 00000030 uip_add_rcv_nxt
00009778 l F .text 0000003c upper_layer_chksum
20000084 l O .bss 00000002 tmp16
20000086 l O .bss 00000002 ipid
20000088 l O .bss 00000004 iss
2000008c l O .bss 00000002 lastport
2000008e l O .bss 00000001 c
00009740 l F .text 0000003a chksum
000097d8 l F .text 00000030 uip_add_rcv_nxt
000098e8 l F .text 0000003c upper_layer_chksum
200000cc l O .bss 00000002 tmp16
200000ce l O .bss 00000002 ipid
200000d0 l O .bss 00000004 iss
200000d4 l O .bss 00000002 lastport
200000d6 l O .bss 00000001 c
00000000 l df *ABS* 00000000 uip_arp.c
0000a25c l F .text 00000104 uip_arp_update
20000096 l O .bss 00000001 i
20000097 l O .bss 00000001 tmpage
20000098 l O .bss 00000060 arp_table
0000a720 l O .text 00000006 broadcast_ethaddr
200000f8 l O .bss 00000001 c
200000f9 l O .bss 00000001 arptime
200000fc l O .bss 00000004 ipaddr
0000a5ec l F .text 00000108 uip_arp_update
200000de l O .bss 00000001 i
200000df l O .bss 00000001 tmpage
200000e0 l O .bss 00000060 arp_table
0000b044 l O .text 00000006 broadcast_ethaddr
20000140 l O .bss 00000001 c
20000141 l O .bss 00000001 arptime
20000144 l O .bss 00000004 ipaddr
00000000 l df *ABS* 00000000 uip_timer.c
00000000 l df *ABS* 00000000 dhcpc.c
0000a9bc l F .text 0000000e add_msg_type
0000a9cc l F .text 0000001c add_server_id
0000a9e8 l F .text 00000016 add_req_options
0000aa00 l F .text 00000008 add_end
0000aa08 l F .text 0000002c dhcpc_configured
0000aa34 l F .text 0000001c add_req_ipaddr
0000aa50 l F .text 00000078 parse_options
0000aac8 l F .text 00000080 create_msg
0000ab48 l F .text 00000030 send_discover
0000ab78 l F .text 00000034 send_request
0000abac l F .text 00000058 parse_msg
0000ac50 l F .text 00000288 handle_dhcp
0000b04c l O .text 00000004 xid
20000148 l O .bss 00000034 s
0000b050 l O .text 00000004 magic_cookie
00000000 l df *ABS* 00000000 memcmp.c
00000000 l df *ABS* 00000000 memcpy-stub.c
00000000 l df *ABS* 00000000 memset.c
00000000 l df *ABS* 00000000 c:/progra~2/gnutoo~1/50a5a~1.420/bin/../lib/gcc/arm-none-eabi/5.4.1/armv7-m/crti.o
00000000 l df *ABS* 00000000 c:/progra~2/gnutoo~1/50a5a~1.420/bin/../lib/gcc/arm-none-eabi/5.4.1/armv7-m/crtn.o
00000000 l df *ABS* 00000000 crtstuff.c
0000a728 l O .text 00000000 __FRAME_END__
0000b054 l O .text 00000000 __FRAME_END__
00000000 l df *ABS* 00000000
00000000 l *UND* 00000000 __bss_start__
00000000 l *UND* 00000000 __libc_fini_array
@ -132,102 +165,120 @@ SYMBOL TABLE:
00000000 l *UND* 00000000 __call_exitprocs
00000000 l *UND* 00000000 software_init_hook
00000000 l *UND* 00000000 __sf_fake_stdin
20000004 l .data 00000000 __init_array_end
20000044 l .data 00000000 __init_array_end
00000000 l *UND* 00000000 hardware_init_hook
00000000 l *UND* 00000000 atexit
20000000 l .data 00000000 __preinit_array_end
20000040 l .data 00000000 __preinit_array_end
00000000 l *UND* 00000000 __stack
00000000 l *UND* 00000000 __sf_fake_stdout
20000000 l .data 00000000 __init_array_start
20000040 l .data 00000000 __init_array_start
00000000 l *UND* 00000000 _exit
20000000 l .data 00000000 __preinit_array_start
00009318 g F .text 0000000c __error__
00009298 g F .text 00000040 reset_handler
20000040 l .data 00000000 __preinit_array_start
0000933c g F .text 0000000c __error__
000091d8 g F .text 00000010 netdev_get_mac
000092b0 g F .text 00000040 reset_handler
00008d34 g F .text 00000008 SysCtlDelay
20000100 g O .bss 00000002 uip_len
20000090 g O .bss 00000006 uip_ethaddr
00009630 g F .text 0000005c uip_add32
0000a72c g .text 00000000 _etext
2000017c g O .bss 00000002 uip_len
200000d8 g O .bss 00000006 uip_ethaddr
0000977c g F .text 0000005c uip_add32
0000b058 g .text 00000000 _etext
00008c94 g F .text 00000058 SysCtlPeripheralReset
00008488 g F .text 00000024 GPIOPinWrite
000091d0 g F .text 00000038 netdev_read
000097c0 g F .text 00000a9c uip_process
000095e4 g F .text 00000010 TimerISRHandler
20000104 g O .bss 00000004 uip_sappdata
000090a4 g F .text 00000018 netdev_init
20000108 g O .bss 00000004 uip_acc32
00009758 g F .text 00000020 uip_ipchksum
000091e8 g F .text 00000038 netdev_read
00009930 g F .text 00000bec uip_process
00009730 g F .text 00000010 TimerISRHandler
0000aefe g F .text 00000016 memcpy
20000180 g O .bss 00000004 uip_sappdata
000090ac g F .text 00000018 netdev_init
20000184 g O .bss 00000004 uip_acc32
000098c8 g F .text 00000020 uip_ipchksum
0000a51c g F .text 000000a8 uip_udp_new
00008650 g F .text 00000030 EthernetInitExpClk
00009718 g F .text 00000034 uip_listen
00009208 g F .text 0000001c netdev_send
00009888 g F .text 00000034 uip_listen
00009220 g F .text 0000001c netdev_send
000087cc g F .text 00000050 EthernetPacketPut
00008cec g F .text 00000038 SysCtlPeripheralEnable
2000010c g O .bss 00000001 uip_flags
0000a600 g F .text 00000000 _init
00009388 g F .text 00000008 BootActivate
20000188 g O .bss 00000001 uip_flags
0000af24 g F .text 00000000 _init
000093ac g F .text 00000008 BootActivate
00008d24 g F .text 00000010 SysCtlReset
2000078c g .bss 00000000 _ebss
2000084c g .bss 00000000 _ebss
0000ac04 g F .text 0000003c dhcpc_init
00000400 g *ABS* 00000000 __STACKSIZE__
00009324 g F .text 00000002 UnusedISR
00009348 g F .text 00000002 UnusedISR
00008778 g F .text 00000054 EthernetPacketGetNonBlocking
00009224 g F .text 00000028 LedInit
0000923c g F .text 00000028 LedInit
00008514 g F .text 00000034 GPIOPinTypeEthernetLED
000094cc g F .text 000000d8 NetTask
000095e4 g F .text 0000010c NetTask
2000018c g O .bss 00000004 uip_udp_conn
0000a9a4 g F .text 00000018 timer_expired
00000000 w *UND* 00000000 __deregister_frame_info
000090bc g F .text 00000114 netdev_init_mac
000090c4 g F .text 00000114 netdev_init_mac
00008a70 g F .text 0000002c UARTCharGetNonBlocking
20000008 g .bss 00000000 _bss
000097b4 g F .text 0000000a uip_tcpchksum
20000110 g O .bss 00000004 uip_appdata
20000048 g .bss 00000000 _bss
00009924 g F .text 0000000a uip_tcpchksum
20000190 g O .bss 00000004 uip_appdata
00008170 g F .text 00000020 SysTickPeriodSet
20000114 g O .bss 00000004 uip_conn
20000118 g O .bss 0000001e uip_conns
20000194 g O .bss 00000004 uip_conn
0000aee0 g F .text 0000001e memcmp
20000040 g .shared 00000000 __shared_end__
20000198 g O .bss 0000001e uip_conns
0000950c g F .text 0000002c SharedParamsWriteByIndex
00008854 g F .text 00000028 EthernetIntStatus
0000a4a0 g F .text 00000160 uip_arp_out
000092fc g F .text 0000001c main
0000a834 g F .text 00000160 uip_arp_out
0000af14 g F .text 00000010 memset
00009314 g F .text 00000028 main
00008ea0 g F .text 00000204 SysCtlClockGet
00008950 g F .text 00000038 UARTDisable
00008738 g F .text 00000040 EthernetEnable
000095a4 g F .text 0000000c TimerSet
00009380 g F .text 00000008 BootComInit
0000a60c g F .text 00000000 _fini
0000a3c0 g F .text 000000e0 uip_arp_arpin
000096f0 g F .text 0000000c TimerSet
000094dc g F .text 00000030 SharedParamsInit
000093a4 g F .text 00000008 BootComInit
0000af30 g F .text 00000000 _fini
0000a754 g F .text 000000e0 uip_arp_arpin
000086d8 g F .text 00000060 EthernetMACAddrSet
0000a360 g F .text 00000060 uip_arp_timer
20000138 g O .bss 00000002 uip_listenports
2000013c g O .bss 00000004 uip_draddr
20000000 g .data 00000000 _data
0000a6f4 g F .text 00000060 uip_arp_timer
200001b8 g O .bss 00000002 uip_listenports
200001bc g O .bss 00000004 uip_draddr
20000040 g .data 00000000 _data
000088b0 g F .text 00000044 EthernetPHYRead
0000924c g F .text 0000004c LedToggle
20000b8c g .bss 00000000 _estack
00009264 g F .text 0000004c LedToggle
0000a994 g F .text 0000000e timer_set
20000c4c g .bss 00000000 _estack
00008680 g F .text 00000058 EthernetConfigSet
20000008 g .data 00000000 _edata
0000974c g F .text 0000000a htons
20000048 g .data 00000000 _edata
000098bc g F .text 0000000a htons
0000aed8 g F .text 00000008 dhcpc_appcall
00008000 g O .text 000000f4 _vectab
00008190 g F .text 00000068 FlashUserGet
000084e0 g F .text 00000034 GPIOPinTypeUART
20000000 g .shared 00000000 __shared_start__
000084ac g F .text 00000034 GPIOPinTypeGPIOOutput
0000881c g F .text 00000038 EthernetIntDisable
00009428 g F .text 00000008 BootComCheckActivationRequest
0000944c g F .text 00000008 BootComCheckActivationRequest
0000887c g F .text 00000034 EthernetIntClear
000096bc g F .text 0000005c uip_init
00009808 g F .text 00000080 uip_init
000090a4 g F .text 00000008 clock_time
000082d4 g F .text 00000060 GPIODirModeSet
2000078c g .bss 00000000 _stack
20000140 g O .bss 00000004 uip_netmask
2000084c g .bss 00000000 _stack
200001c0 g O .bss 00000004 uip_netmask
00008150 g F .text 00000010 SysTickEnable
20000144 g O .bss 00000004 uip_hostaddr
000095d8 g F .text 0000000c TimerGet
0000949c g F .text 00000030 NetApp
200001c4 g O .bss 00000004 uip_hostaddr
00009724 g F .text 0000000c TimerGet
000095ac g F .text 00000038 NetApp
00000000 w *UND* 00000000 _Jv_RegisterClasses
00008160 g F .text 00000010 SysTickIntEnable
00008988 g F .text 000000e8 UARTConfigSetExpClk
00009430 g F .text 0000006c NetInit
00009538 g F .text 00000074 NetInit
00008d3c g F .text 00000164 SysCtlClockSet
00008334 g F .text 00000154 GPIOPadConfigSet
000095b0 g F .text 00000028 TimerInit
000096fc g F .text 00000028 TimerInit
00000000 w *UND* 00000000 __register_frame_info
20000148 g O .bss 00000642 uip_buf
2000078a g O .bss 00000002 uip_slen
200001c8 g O .bss 00000642 uip_buf
0000a5c4 g F .text 00000028 uip_send
0000ac40 g F .text 00000010 dhcpc_request
2000080a g O .bss 00000002 uip_slen
2000080c g O .bss 00000040 uip_udp_conns
00008920 g F .text 00000030 UARTEnable

View File

@ -36,6 +36,7 @@
#include "led.h" /* LED driver */
#include "time.h" /* Timer driver */
#include "net.h" /* TCP/IP server application */
#include "shared_params.h" /* Shared parameters header. */
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_nvic.h"

View File

@ -59,6 +59,10 @@
#define NETDEV_DEFAULT_MACADDR5 (0x45)
/*---------------------------------------------------------------------------*/
static struct uip_eth_addr macAddress;
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
@ -142,6 +146,18 @@ void netdev_init_mac(void)
}
/*---------------------------------------------------------------------------*/
void netdev_get_mac(unsigned char * mac_addr)
{
mac_addr[0] = macAddress.addr[0];
mac_addr[1] = macAddress.addr[1];
mac_addr[2] = macAddress.addr[2];
mac_addr[3] = macAddress.addr[3];
mac_addr[4] = macAddress.addr[4];
mac_addr[5] = macAddress.addr[5];
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{

View File

@ -40,6 +40,7 @@
void netdev_init(void);
void netdev_init_mac(void);
void netdev_get_mac(unsigned char * mac_addr);
unsigned int netdev_read(void);
void netdev_send(void);

View File

@ -98,6 +98,27 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_MAX_LISTENPORTS 1
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 1
/**
* UDP Maximum Connections
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CONNS 1
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 0
/**
* uIP buffer size.
*
@ -119,20 +140,6 @@ typedef unsigned short uip_stats_t;
*/
#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
*
@ -140,10 +147,12 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_STATISTICS 0
/* Here we include the header file for the application(s) we use in
our project. */
#include "boot.h"
#include "header.h"
#include "net.h"
#include "dhcpc.h"
#endif /* __UIP_CONF_H__ */

View File

@ -48,10 +48,17 @@ int main(void)
{
/* initialize the microcontroller */
Init();
/* initialize the shared parameters module */
SharedParamsInit();
/* initialize the network application */
NetInit();
/* initialize the bootloader interface */
BootComInit();
/* the shared parameter at index 0 is used as a boolean flag to indicate if the
* bootloader should initialize the TCP/IP network stack. by default this flag
* should be reset.
*/
SharedParamsWriteByIndex(0, 0);
/* start the infinite program loop */
while (1)

View File

@ -68,6 +68,8 @@ PROJ_FILES += ../../../Source/third_party/uip/uip/uip_timer.h
PROJ_FILES += ../../../Source/third_party/uip/uip/uiplib.c
PROJ_FILES += ../../../Source/third_party/uip/uip/uiplib.h
PROJ_FILES += ../../../Source/third_party/uip/uip/uipopt.h
PROJ_FILES += ../../../Source/third_party/uip/apps/dhcpc/dhcpc.c
PROJ_FILES += ../../../Source/third_party/uip/apps/dhcpc/dhcpc.h
#|--------------------------------------------------------------------------------------|

View File

@ -1,13 +1,25 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 224K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 224K
SHARED (rwx) : ORIGIN = 0x20000000, LENGTH = 64
SRAM (rwx) : ORIGIN = 0x20000040, LENGTH = 64K - 64
}
SECTIONS
{
__STACKSIZE__ = 1024;
.shared (NOLOAD):
{
. = ALIGN(4);
__shared_start__ = .;
*(.shared)
*(.shared.*)
KEEP(*(.shared))
. = ALIGN(4);
__shared_end__ = .;
} > SHARED
.text :
{
KEEP(*(.isr_vector))

View File

@ -53,6 +53,10 @@
static unsigned long periodicTimerTimeOut;
/** \brief Holds the time out value of the uIP ARP timer. */
static unsigned long ARPTimerTimeOut;
#if (BOOT_COM_NET_DHCP_ENABLE > 0)
/** \brief Holds the MAC address which is used by the DHCP client. */
static struct uip_eth_addr macAddress;
#endif
/************************************************************************************//**
@ -71,6 +75,7 @@ void NetInit(void)
ARPTimerTimeOut = TimerGet() + NET_UIP_ARP_TIMER_MS;
/* initialize the uIP TCP/IP stack. */
uip_init();
#if (BOOT_COM_NET_DHCP_ENABLE == 0)
/* set the IP address */
uip_ipaddr(ipaddr, BOOT_COM_NET_IPADDR0, BOOT_COM_NET_IPADDR1, BOOT_COM_NET_IPADDR2,
BOOT_COM_NET_IPADDR3);
@ -83,10 +88,28 @@ void NetInit(void)
uip_ipaddr(ipaddr, BOOT_COM_NET_GATEWAY0, BOOT_COM_NET_GATEWAY1, BOOT_COM_NET_GATEWAY2,
BOOT_COM_NET_GATEWAY3);
uip_setdraddr(ipaddr);
#else
/* set the IP address */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_sethostaddr(ipaddr);
/* set the network mask */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_setnetmask(ipaddr);
/* set the gateway address */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_setdraddr(ipaddr);
#endif
/* start listening on the configured port for XCP transfers on TCP/IP */
uip_listen(HTONS(BOOT_COM_NET_PORT));
/* initialize the MAC and set the MAC address */
netdev_init_mac();
#if (BOOT_COM_NET_DHCP_ENABLE > 0)
/* initialize the DHCP client application and send the initial request. */
netdev_get_mac(&macAddress.addr[0]);
dhcpc_init(&macAddress.addr[0], 6);
dhcpc_request();
#endif
} /*** end of NetInit ***/
@ -117,6 +140,13 @@ void NetApp(void)
/* check if this was an XCP CONNECT command */
if ((newDataPtr[0] == 0xff) && (newDataPtr[1] == 0x00))
{
/* the shared parameter at index 0 is used as a boolean flag to indicate if the
* bootloader should initialize the TCP/IP network stack. we just received a
* firmware update request from the TCP/IP network and we are about to active
* the bootloader for a firmware update via TCP/IP. At this point we should
* set the flag to make sure the bootloader initializes its TCP/IP network stack.
*/
SharedParamsWriteByIndex(0, 1);
/* connection request received so start the bootloader */
BootActivate();
}
@ -136,13 +166,13 @@ void NetTask(void)
/* check for an RX packet and read it. */
packetLen = netdev_read();
if(packetLen > 0)
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))
if (NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_IP))
{
uip_arp_ipin();
uip_input();
@ -150,7 +180,7 @@ void NetTask(void)
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if(uip_len > 0)
if (uip_len > 0)
{
uip_arp_out();
netdev_send();
@ -158,7 +188,7 @@ void NetTask(void)
}
}
/* process incoming ARP packets here. */
else if(NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_ARP))
else if (NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_ARP))
{
uip_arp_arpin();
@ -166,14 +196,14 @@ void NetTask(void)
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if(uip_len > 0)
if (uip_len > 0)
{
netdev_send();
uip_len = 0;
}
}
}
/* process TCP/IP Periodic Timer here. */
if (TimerGet() >= periodicTimerTimeOut)
{
@ -181,6 +211,22 @@ void NetTask(void)
for (connection = 0; connection < UIP_CONNS; connection++)
{
uip_periodic(connection);
/* If the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if (uip_len > 0)
{
uip_arp_out();
netdev_send();
uip_len = 0;
}
}
#if UIP_UDP
for (connection = 0; connection < UIP_UDP_CONNS; connection++)
{
uip_udp_periodic(connection);
/* If the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
@ -192,13 +238,14 @@ void NetTask(void)
uip_len = 0;
}
}
#endif
}
/* process ARP Timer here. */
if (TimerGet() >= ARPTimerTimeOut)
{
ARPTimerTimeOut += NET_UIP_ARP_TIMER_MS;
uip_arp_timer();
ARPTimerTimeOut += NET_UIP_ARP_TIMER_MS;
uip_arp_timer();
}
} /*** end of NetServerTask ***/

View File

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

View File

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

View File

@ -1,10 +1,12 @@
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x00007FFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF;
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x00007FFF;
define symbol __ICFEDIT_region_SHARED_start__ = 0x20000000;
define symbol __ICFEDIT_region_SHARED_end__ = 0x2000003F;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000040;
define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_heap__ = 0x400;
@ -20,6 +22,8 @@ initialize by copy { readwrite };
do not initialize { section .noinit };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place at address mem:__ICFEDIT_region_SHARED_start__ { readwrite section .shared };
place in ROM_region { readonly };
place in RAM_region { readwrite,
block CSTACK, block HEAP };

View File

@ -50,7 +50,7 @@
/** \brief Motorola or Intel style byte ordering. */
#define BOOT_CPU_BYTE_ORDER_MOTOROLA (0)
/** \brief Enable/disable hook function call right before user program start. */
#define BOOT_CPU_USER_PROGRAM_START_HOOK (0)
#define BOOT_CPU_USER_PROGRAM_START_HOOK (1)
/****************************************************************************************
@ -80,72 +80,56 @@
* 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
* with the macros BOOT_COM_NET_IPADDRx. The default netmask is configured with the
* macro BOOT_COM_NET_NETMASKx. The default gateway is configured with the macros
* BOOT_COM_NET_GATEWAYx. The bootloader acts and a TCP/IP server. The port the server
* listen on for connections is configured with BOOT_COM_NET_PORT.
* In case the network switch/router supports a DHCP server, you can set configuration
* macro BOOT_COM_NET_DHCP_ENABLE to 1 to enable the DHCP client. In this case the
* DHCP client handles the automatic IP address assignment. In this case the macros for
* configuring the IP address, network mask and gateway address are no longer needed.
*/
/** \brief Enable/disable the NET transport layer. */
#define BOOT_COM_NET_ENABLE (1)
#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)
#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)
#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)
#define BOOT_COM_NET_PORT (1000)
/** \brief Enable/disable DHCP client for automatically obtaining an IP address. */
#define BOOT_COM_NET_DHCP_ENABLE (1)
/** \brief Configure the 1st byte of the IP address */
#define BOOT_COM_NET_IPADDR0 (169)
#define BOOT_COM_NET_IPADDR0 (192)
/** \brief Configure the 2nd byte of the IP address */
#define BOOT_COM_NET_IPADDR1 (254)
#define BOOT_COM_NET_IPADDR1 (168)
/** \brief Configure the 3rd byte of the IP address */
#define BOOT_COM_NET_IPADDR2 (19)
#define BOOT_COM_NET_IPADDR2 (178)
/** \brief Configure the 4th byte of the IP address */
#define BOOT_COM_NET_IPADDR3 (63)
#define BOOT_COM_NET_IPADDR3 (50)
/** \brief Configure the 1st byte of the network mask */
#define BOOT_COM_NET_NETMASK0 (255)
#define BOOT_COM_NET_NETMASK0 (255)
/** \brief Configure the 2nd byte of the network mask */
#define BOOT_COM_NET_NETMASK1 (255)
#define BOOT_COM_NET_NETMASK1 (255)
/** \brief Configure the 3rd byte of the network mask */
#define BOOT_COM_NET_NETMASK2 (0)
#define BOOT_COM_NET_NETMASK2 (255)
/** \brief Configure the 4th byte of the network mask */
#define BOOT_COM_NET_NETMASK3 (0)
#define BOOT_COM_NET_NETMASK3 (0)
/** \brief Configure the 1st byte of the gateway address */
#define BOOT_COM_NET_GATEWAY0 (169)
#define BOOT_COM_NET_GATEWAY0 (192)
/** \brief Configure the 2nd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY1 (254)
#define BOOT_COM_NET_GATEWAY1 (168)
/** \brief Configure the 3rd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY2 (19)
#define BOOT_COM_NET_GATEWAY2 (178)
/** \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_GATEWAY3 (1)
/** \brief Enable/disable the deferred initialization mechanism. When enabled, the
* communication interface is only initialized when: (a) no valid user program
* is detected, or (b) when CpuUserProgramStartHook() returns BLT_FALSE. Your
* bootloader application can explicitly initialize the communication interface
* by calling ComDeferredInit().
*/
#define BOOT_COM_NET_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.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (10000)
#endif
#define BOOT_COM_NET_DEFERRED_INIT_ENABLE (1)
/****************************************************************************************

View File

@ -30,6 +30,8 @@
* Include files
****************************************************************************************/
#include "boot.h" /* bootloader generic header */
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#if (BOOT_FILE_LOGGING_ENABLE > 0)
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
@ -81,6 +83,11 @@ blt_bool BackDoorEntryHook(void)
****************************************************************************************/
blt_bool CpuUserProgramStartHook(void)
{
/* do not start the user program if the select pushbutton is pressed */
if (GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1) == 0)
{
return BLT_FALSE;
}
/* okay to start the user program */
return BLT_TRUE;
} /*** end of CpuUserProgramStartHook ***/
@ -193,79 +200,6 @@ blt_bool NvmWriteChecksumHook(void)
#endif /* BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0 */
/****************************************************************************************
* N E T W O R K I N T E R F A C E H O O K F U N C T I O N S
****************************************************************************************/
#if (BOOT_COM_NET_IPADDR_HOOK_ENABLE > 0)
/************************************************************************************//**
** \brief Callback that gets called when the IP address is about to be configured.
** \param ipAddrArray 4-byte array where the IP address should be stored.
** \return none.
**
****************************************************************************************/
void NetIpAddressHook(blt_int8u *ipAddrArray)
{
/* This hook function allows a dynamic configuration of the IP address. This could for
* example be used if the bootloader is activated from a running user program and
* should have the same IP address as the user program. This IP address could be stored
* at a fixed location in RAM which can be read here. For now the example implemen-
* tation simply configures the bootloader's default IP address.
*/
ipAddrArray[0] = BOOT_COM_NET_IPADDR0;
ipAddrArray[1] = BOOT_COM_NET_IPADDR1;
ipAddrArray[2] = BOOT_COM_NET_IPADDR2;
ipAddrArray[3] = BOOT_COM_NET_IPADDR3;
} /*** end of NetIpAddressHook ***/
#endif /* BOOT_COM_NET_IPADDR_HOOK_ENABLE > 0 */
#if (BOOT_COM_NET_NETMASK_HOOK_ENABLE > 0)
/************************************************************************************//**
** \brief Callback that gets called when the network mask is about to be configured.
** \param netMaskArray 4-byte array where the network mask should be stored.
** \return none.
**
****************************************************************************************/
void NetNetworkMaskHook(blt_int8u *netMaskArray)
{
/* This hook function allows a dynamic configuration of the network mask. This could
* for example be used if the bootloader is activated from a running user program and
* should have the same network mask as the user program. This network mask could be
* stored at a fixed location in RAM which can be read here. For now the example
* implementation simply configures the bootloader's default network mask.
*/
netMaskArray[0] = BOOT_COM_NET_NETMASK0;
netMaskArray[1] = BOOT_COM_NET_NETMASK1;
netMaskArray[2] = BOOT_COM_NET_NETMASK2;
netMaskArray[3] = BOOT_COM_NET_NETMASK3;
} /*** end of NetNetworkMaskHook ***/
#endif /* BOOT_COM_NET_NETMASK_HOOK_ENABLE > 0 */
#if (BOOT_COM_NET_GATEWAY_HOOK_ENABLE > 0)
/************************************************************************************//**
** \brief Callback that gets called when the gateway address is about to be
** configured.
** \param gatewayAddrArray 4-byte array where the gateway address should be stored.
** \return none.
**
****************************************************************************************/
void NetGatewayAddressHook(blt_int8u *gatewayAddrArray)
{
/* This hook function allows a dynamic configuration of the network mask. This could
* for example be used if the bootloader is activated from a running user program and
* should have the same network mask as the user program. This network mask could be
* stored at a fixed location in RAM which can be read here. For now the example
* implementation simply configures the bootloader's default network mask.
*/
gatewayAddrArray[0] = BOOT_COM_NET_GATEWAY0;
gatewayAddrArray[1] = BOOT_COM_NET_GATEWAY1;
gatewayAddrArray[2] = BOOT_COM_NET_GATEWAY2;
gatewayAddrArray[3] = BOOT_COM_NET_GATEWAY3;
} /*** end of NetGatewayAddressHook ***/
#endif /* BOOT_COM_NET_GATEWAY_HOOK_ENABLE > 0 */
/****************************************************************************************
* W A T C H D O G D R I V E R H O O K F U N C T I O N S
****************************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@ -247,7 +247,7 @@
<option>
<name>CCAllowList</name>
<version>1</version>
<state>00000000</state>
<state>11111110</state>
</option>
<option>
<name>CCDebugInfo</name>
@ -318,7 +318,7 @@
<state>$PROJ_DIR$\..\..\..\..\Source</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\fatfs\src</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\hello-world</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc</state>
<state>$PROJ_DIR$\..\..\..\..\Source\ARMCM3_LM3S</state>
<state>$PROJ_DIR$\..\..\..\..\Source\ARMCM3_LM3S\IAR</state>
<state>$PROJ_DIR$\..</state>
@ -346,7 +346,7 @@
</option>
<option>
<name>CCOptLevel</name>
<state>1</state>
<state>3</state>
</option>
<option>
<name>CCOptStrategy</name>
@ -355,7 +355,7 @@
</option>
<option>
<name>CCOptLevelSlave</name>
<state>1</state>
<state>3</state>
</option>
<option>
<name>CompilerMisraRules98</name>
@ -2074,6 +2074,12 @@
<file>
<name>$PROJ_DIR$\..\main.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\vectors.c</name>
</file>
@ -2135,6 +2141,12 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\clock.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc-addrlabels.h</name>
</file>

View File

@ -34,12 +34,12 @@
<PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><ShowCodeCoverage>0</ShowCodeCoverage><ShowInstrProfiling>0</ShowInstrProfiling></Disassembly>
<WATCH_1><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><expressions><item>data</item><item>s-&gt;dto_data</item><item/></expressions><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>147</item><item>150</item><item>100</item><item>174</item></col-widths></WATCH_1><Register><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Register><STACK_1><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><stack>CSTACK</stack><width>4</width><vars>1</vars><offset>0</offset><col-names><item>Data</item><item>Frame</item><item>Location</item><item>Type</item><item>Value</item><item>Variable</item></col-names><col-widths><item>100</item><item>100</item><item>100</item><item>100</item><item>100</item><item>100</item></col-widths></STACK_1><Memory><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><FindDirection>1</FindDirection><FindAsHex>0</FindAsHex></Memory></Static>
<WATCH_1><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><expressions><item></item></expressions><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>147</item><item>150</item><item>100</item><item>289</item></col-widths></WATCH_1><Register><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Register><STACK_1><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><stack>CSTACK</stack><width>4</width><vars>1</vars><offset>0</offset><col-names><item>Data</item><item>Frame</item><item>Location</item><item>Type</item><item>Value</item><item>Variable</item></col-names><col-widths><item>100</item><item>100</item><item>100</item><item>100</item><item>100</item><item>100</item></col-widths></STACK_1><Memory><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><FindDirection>1</FindDirection><MemGotoHistory><item>0x20001ec8</item></MemGotoHistory><FindAsHex>0</FindAsHex></Memory><CallStack><col-names><item>Frame</item><item>_I0</item></col-names><col-widths><item>3500</item><item>20</item></col-widths><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></CallStack></Static>
<Windows>
<Wnd0>
<Wnd1>
<Tabs>
<Tab>
<Identity>TabID-4214-26312</Identity>
@ -51,20 +51,20 @@
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd0><Wnd1><Tabs><Tab><Identity>TabID-14429-10902</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd1><Wnd4><Tabs><Tab><Identity>TabID-29443-18340</Identity><TabName>Disassembly</TabName><Factory>Disassembly</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd4></Windows>
<SelectedTab>0</SelectedTab></Wnd1><Wnd4><Tabs><Tab><Identity>TabID-14429-10902</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd4><Wnd5><Tabs><Tab><Identity>TabID-21835-3732</Identity><TabName>Watch 1</TabName><Factory>WATCH_1</Factory></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd5></Windows>
<Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\blt_conf.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>75</YPos2><SelStart2>5273</SelStart2><SelEnd2>5273</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>19</YPos2><SelStart2>2788</SelStart2><SelEnd2>2788</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\lib\fatfs\mmc.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>532</YPos2><SelStart2>17458</SelStart2><SelEnd2>17458</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\..\..\Source\third_party\fatfs\src\ff.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>5144</YPos2><SelStart2>174744</SelStart2><SelEnd2>174744</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\..\..\Source\third_party\fatfs\src\diskio.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>977</SelStart2><SelEnd2>977</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\lib\driverlib\ethernet.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>1163</YPos2><SelStart2>43132</SelStart2><SelEnd2>43132</SelEnd2></Tab><ActiveTab>5</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\blt_conf.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>75</YPos2><SelStart2>5274</SelStart2><SelEnd2>5274</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>36</YPos2><SelStart2>2879</SelStart2><SelEnd2>2879</SelEnd2></Tab><ActiveTab>1</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\..\..\Source\com.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>102</YPos2><SelStart2>5310</SelStart2><SelEnd2>5310</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\..\..\Source\net.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>164</YPos2><SelStart2>7862</SelStart2><SelEnd2>7862</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\..\..\Source\ARMCM3_LM3S\cpu.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>63</YPos2><SelStart2>3699</SelStart2><SelEnd2>3699</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-04DB1F58><key>iaridepm.enu1</key></Toolbar-04DB1F58></Sizes></Row0><Row1><Sizes><Toolbar-0E9D39C0><key>debuggergui.enu1</key></Toolbar-0E9D39C0></Sizes></Row1></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>740</Bottom><Right>285</Right><x>-2</x><y>-2</y><xscreen>240</xscreen><yscreen>243</yscreen><sizeHorzCX>125000</sizeHorzCX><sizeHorzCY>241311</sizeHorzCY><sizeVertCX>149479</sizeVertCX><sizeVertCY>736842</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes><Wnd4><Rect><Top>-2</Top><Left>-2</Left><Bottom>740</Bottom><Right>198</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>736842</sizeVertCY></Rect></Wnd4></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1922</Right><x>-2</x><y>-2</y><xscreen>1924</xscreen><yscreen>200</yscreen><sizeHorzCX>1002083</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198610</sizeVertCY></Rect></Wnd1></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
<Top><Row0><Sizes><Toolbar-049D4890><key>iaridepm.enu1</key></Toolbar-049D4890></Sizes></Row0><Row1><Sizes><Toolbar-0DDA0508><key>debuggergui.enu1</key></Toolbar-0DDA0508></Sizes></Row1></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>740</Bottom><Right>285</Right><x>-2</x><y>-2</y><xscreen>240</xscreen><yscreen>243</yscreen><sizeHorzCX>125000</sizeHorzCX><sizeHorzCY>241311</sizeHorzCY><sizeVertCX>149479</sizeVertCX><sizeVertCY>736842</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes><Wnd5><Rect><Top>-2</Top><Left>-2</Left><Bottom>740</Bottom><Right>444</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>104167</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>232292</sizeVertCX><sizeVertCY>736842</sizeVertCY></Rect></Wnd5></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd4><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1922</Right><x>-2</x><y>-2</y><xscreen>1924</xscreen><yscreen>200</yscreen><sizeHorzCX>1002083</sizeHorzCX><sizeHorzCY>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198610</sizeVertCY></Rect></Wnd4></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Project>

View File

@ -9,7 +9,7 @@ TriggerName=main
LimitSize=0
ByteLimit=50
[DebugChecksum]
Checksum=-1582861970
Checksum=2100562844
[Exceptions]
StopOnUncaught=_ 0
StopOnThrow=_ 0
@ -19,11 +19,9 @@ ShowArgs=0
MixedMode=1
[LMIFTDIDriver]
LMI_ResetMode=0x00000000
LMIFTDIserialNo=04110716A
LMIFTDIserialNo=04110450A
LMIFTDIfoundProbes=
LMI_LeaveTargetRunning=0x00000000
[watch_formats]
Fmt0={W}0:test_address 4 0
[CallStackLog]
Enabled=0
[DriverProfiling]
@ -32,6 +30,9 @@ Mode=0
Graph=0
Symbiont=0
Exclusions=
[watch_formats]
Fmt0={W}0:test_address 4 0
Fmt1={W}1:ulBase 4 0
[Log file]
LoggingEnabled=_ 0
LogFile=_ ""
@ -42,7 +43,8 @@ LogFile=_ ""
[Disassemble mode]
mode=0
[Breakpoints]
Count=0
Bp0=_ "STD_CODE" "{$PROJ_DIR$\..\..\..\..\Source\net.c}.300.7" 0 0 0 0 "" 0 ""
Count=1
[Aliases]
Count=0
SuppressDialog=0

View File

@ -25,7 +25,7 @@
<Factory>Workspace</Factory>
<Session>
<NodeDict><ExpandedNode>lm3s6965</ExpandedNode><ExpandedNode>lm3s6965/Boot</ExpandedNode><ExpandedNode>lm3s6965/Output</ExpandedNode><ExpandedNode>lm3s6965/Source</ExpandedNode><ExpandedNode>lm3s6965/Source/ARMCM3_LM3S</ExpandedNode><ExpandedNode>lm3s6965/Source/ARMCM3_LM3S/IAR</ExpandedNode><ExpandedNode>lm3s6965/Source/fatfs</ExpandedNode><ExpandedNode>lm3s6965/Source/third_party</ExpandedNode><ExpandedNode>lm3s6965/Source/third_party/fatfs</ExpandedNode></NodeDict></Session>
<NodeDict><ExpandedNode>lm3s6965</ExpandedNode><ExpandedNode>lm3s6965/Boot</ExpandedNode><ExpandedNode>lm3s6965/Output</ExpandedNode><ExpandedNode>lm3s6965/Source</ExpandedNode><ExpandedNode>lm3s6965/Source/ARMCM3_LM3S</ExpandedNode><ExpandedNode>lm3s6965/Source/ARMCM3_LM3S/IAR</ExpandedNode><ExpandedNode>lm3s6965/Source/fatfs</ExpandedNode><ExpandedNode>lm3s6965/Source/third_party</ExpandedNode><ExpandedNode>lm3s6965/Source/third_party/uip</ExpandedNode></NodeDict></Session>
</Tab>
</Tabs>
@ -35,14 +35,14 @@
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\blt_conf.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>75</YPos2><SelStart2>5273</SelStart2><SelEnd2>5273</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>19</YPos2><SelStart2>2788</SelStart2><SelEnd2>2788</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\lib\fatfs\mmc.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>532</YPos2><SelStart2>17458</SelStart2><SelEnd2>17458</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\..\..\Source\third_party\fatfs\src\ff.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>5144</YPos2><SelStart2>174744</SelStart2><SelEnd2>174744</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\..\..\Source\third_party\fatfs\src\diskio.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>0</YPos2><SelStart2>977</SelStart2><SelEnd2>977</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\lib\driverlib\ethernet.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>1163</YPos2><SelStart2>43132</SelStart2><SelEnd2>43132</SelEnd2></Tab><ActiveTab>5</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\blt_conf.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>75</YPos2><SelStart2>5274</SelStart2><SelEnd2>5274</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>36</YPos2><SelStart2>2624</SelStart2><SelEnd2>2624</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\hooks.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>51</YPos2><SelStart2>3539</SelStart2><SelEnd2>3539</SelEnd2></Tab><ActiveTab>2</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
<Positions>
<Top><Row0><Sizes><Toolbar-04DB1F58><key>iaridepm.enu1</key></Toolbar-04DB1F58></Sizes></Row0><Row1><Sizes/></Row1><Row2><Sizes/></Row2></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>463</Bottom><Right>467</Right><x>-2</x><y>-2</y><xscreen>372</xscreen><yscreen>353</yscreen><sizeHorzCX>193750</sizeHorzCX><sizeHorzCY>350546</sizeHorzCY><sizeVertCX>244271</sizeVertCX><sizeVertCY>461768</sizeVertCY></Rect></Wnd0><Wnd3><Rect><Top>0</Top><Left>0</Left><Bottom>1817980462</Bottom><Right>1545884233</Right><x>-2</x><y>461</y><xscreen>258</xscreen><yscreen>237</yscreen><sizeHorzCX>134375</sizeHorzCX><sizeHorzCY>235353</sizeHorzCY><sizeVertCX>244271</sizeVertCX><sizeVertCY>497517</sizeVertCY></Rect></Wnd3></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes/></Row0></Bottom><Float><Sizes/></Float></Positions>
<Top><Row0><Sizes><Toolbar-049D4890><key>iaridepm.enu1</key></Toolbar-049D4890></Sizes></Row0><Row1><Sizes/></Row1><Row2><Sizes/></Row2></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>463</Bottom><Right>467</Right><x>-2</x><y>-2</y><xscreen>372</xscreen><yscreen>353</yscreen><sizeHorzCX>193750</sizeHorzCX><sizeHorzCY>350546</sizeHorzCY><sizeVertCX>244271</sizeVertCX><sizeVertCY>461768</sizeVertCY></Rect></Wnd0><Wnd3><Rect><Top>0</Top><Left>0</Left><Bottom>0</Bottom><Right>7</Right><x>-2</x><y>461</y><xscreen>258</xscreen><yscreen>237</yscreen><sizeHorzCX>134375</sizeHorzCX><sizeHorzCY>235353</sizeHorzCY><sizeVertCX>244271</sizeVertCX><sizeVertCY>497517</sizeVertCY></Rect></Wnd3></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes/></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Workspace>

View File

@ -59,6 +59,10 @@
#define NETDEV_DEFAULT_MACADDR5 (0x45)
/*---------------------------------------------------------------------------*/
static struct uip_eth_addr macAddress;
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
@ -142,6 +146,18 @@ void netdev_init_mac(void)
}
/*---------------------------------------------------------------------------*/
void netdev_get_mac(unsigned char * mac_addr)
{
mac_addr[0] = macAddress.addr[0];
mac_addr[1] = macAddress.addr[1];
mac_addr[2] = macAddress.addr[2];
mac_addr[3] = macAddress.addr[3];
mac_addr[4] = macAddress.addr[4];
mac_addr[5] = macAddress.addr[5];
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{

View File

@ -40,6 +40,7 @@
void netdev_init(void);
void netdev_init_mac(void);
void netdev_get_mac(unsigned char * mac_addr);
unsigned int netdev_read(void);
void netdev_send(void);

View File

@ -98,6 +98,27 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_MAX_LISTENPORTS 1
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 1
/**
* UDP Maximum Connections
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CONNS 1
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 0
/**
* uIP buffer size.
*
@ -119,20 +140,6 @@ typedef unsigned short uip_stats_t;
*/
#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
*
@ -140,10 +147,12 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_STATISTICS 0
/* Here we include the header file for the application(s) we use in
our project. */
#include "boot.h"
#include "net.h"
#include "dhcpc.h"
#endif /* __UIP_CONF_H__ */

View File

@ -40,6 +40,7 @@
#if (BOOT_FILE_LOGGING_ENABLE > 0)
#include "driverlib/uartlib.h"
#endif
#include "shared_params.h" /* Shared parameters header */
/****************************************************************************************
* Function prototypes
@ -55,11 +56,44 @@ static void Init(void);
****************************************************************************************/
void main(void)
{
blt_int8u deferredInitRequestFlag = 0;
/* initialize the microcontroller */
Init();
/* initialize the shared parameters module */
SharedParamsInit();
/* initialize the bootloader */
BootInit();
#if (BOOT_COM_DEFERRED_INIT_ENABLE == 1)
/* the bootloader is configured to NOT initialize the TCP/IP network stack by default
* to bypass unnecessary delay times before starting the user program. the TCP/IP net-
* work tack is now only initialized when: (a) no valid user program is detected, or
* (b) a forced backdoor entry occurred (CpuUserProgramStartHook() returned BLT_FALSE).
*
* these demo bootloader and user programs have one extra feature implemented for
* demonstration purposes. the demo user program can detect firmware update requests
* from the TCP/IP network in which case it activates the bootloader. But...the
* TCP/IP network stack will not be initialized in this situation. for this reason
* the shared parameter module was integrated in both the bootloader and user program.
* more information about the shared parameter module can be found here:
* https://www.feaser.com/en/blog/?p=216
*
* the shared parameter at the first index (0) contains a flag. this flag is set to
* 1, right before the user program activates this bootloader, to explicitly request
* the bootloader to initialize the TCP/IP network stack. this makes it possible for
* a firmware update to proceed. the code here reads out this flag and performs the
* TCP/IP network stack initialization when requested.
*/
SharedParamsReadByIndex(0, &deferredInitRequestFlag);
if (deferredInitRequestFlag == 1)
{
/* explicitly initialize all communication interface for which the deferred
* initialization feature was enabled.
*/
ComDeferredInit();
}
#endif
/* start the infinite program loop */
while (1)
{
@ -78,6 +112,14 @@ static void Init(void)
{
/* set the clocking to run at 50MHz from the PLL */
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
/* initialize the status button as a digital input. it is used to override the
* starting of the user program.
*/
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
#if (BOOT_COM_UART_ENABLE > 0)
#if (BOOT_COM_UART_CHANNEL_INDEX == 0)
/* enable and configure UART0 related peripherals and pins */

View File

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

View File

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

View File

@ -36,6 +36,7 @@
#include "led.h" /* LED driver */
#include "time.h" /* Timer driver */
#include "net.h" /* TCP/IP server application */
#include "shared_params.h" /* Shared parameters header. */
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_nvic.h"

File diff suppressed because it is too large Load Diff

View File

@ -321,6 +321,7 @@
<state>$PROJ_DIR$\..\lib\driverlib</state>
<state>$PROJ_DIR$\..\lib\uip</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip</state>
<state>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc</state>
</option>
<option>
<name>CCStdIncCheck</name>
@ -2186,6 +2187,12 @@
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\clock.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\apps\dhcpc\dhcpc.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\..\Source\third_party\uip\uip\lc-addrlabels.h</name>
</file>
@ -2269,6 +2276,12 @@
<file>
<name>$PROJ_DIR$\..\net.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\shared_params.h</name>
</file>
<file>
<name>$PROJ_DIR$\..\time.c</name>
</file>

View File

@ -35,7 +35,7 @@
<Windows>
<Wnd1>
<Wnd0>
<Tabs>
<Tab>
<Identity>TabID-27300-28131</Identity>
@ -47,20 +47,20 @@
</Tab>
</Tabs>
<SelectedTab>0</SelectedTab></Wnd1><Wnd3><Tabs><Tab><Identity>TabID-32469-16784</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-4992-29791</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>
<SelectedTab>0</SelectedTab></Wnd0><Wnd2><Tabs><Tab><Identity>TabID-32469-16784</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-4992-29791</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd2></Windows>
<Editor>
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\led.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>45</YPos2><SelStart2>3072</SelStart2><SelEnd2>3072</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>61</YPos2><SelStart2>4156</SelStart2><SelEnd2>4156</SelEnd2></Tab><ActiveTab>1</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\net.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>60</YPos2><SelStart2>4159</SelStart2><SelEnd2>4159</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$\..\led.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>45</YPos2><SelStart2>3072</SelStart2><SelEnd2>3072</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>61</YPos2><SelStart2>3588</SelStart2><SelEnd2>3588</SelEnd2></Tab><ActiveTab>1</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\net.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>60</YPos2><SelStart2>4159</SelStart2><SelEnd2>4159</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-05D81F58><key>iaridepm.enu1</key></Toolbar-05D81F58></Sizes></Row0></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>764</Bottom><Right>357</Right><x>-2</x><y>-2</y><xscreen>186</xscreen><yscreen>205</yscreen><sizeHorzCX>96875</sizeHorzCX><sizeHorzCY>203575</sizeHorzCY><sizeVertCX>186979</sizeVertCX><sizeVertCY>760675</sizeVertCY></Rect></Wnd1></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>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198610</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
<Top><Row0><Sizes><Toolbar-03E54D40><key>iaridepm.enu1</key></Toolbar-03E54D40></Sizes></Row0></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>764</Bottom><Right>357</Right><x>-2</x><y>-2</y><xscreen>186</xscreen><yscreen>205</yscreen><sizeHorzCX>96875</sizeHorzCX><sizeHorzCY>203575</sizeHorzCY><sizeVertCX>186979</sizeVertCX><sizeVertCY>760675</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><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>198610</sizeHorzCY><sizeVertCX>104167</sizeVertCX><sizeVertCY>198610</sizeVertCY></Rect></Wnd2></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
</Desktop>
</Workspace>

View File

@ -59,6 +59,10 @@
#define NETDEV_DEFAULT_MACADDR5 (0x45)
/*---------------------------------------------------------------------------*/
static struct uip_eth_addr macAddress;
/*---------------------------------------------------------------------------*/
void netdev_init(void)
{
@ -142,6 +146,18 @@ void netdev_init_mac(void)
}
/*---------------------------------------------------------------------------*/
void netdev_get_mac(unsigned char * mac_addr)
{
mac_addr[0] = macAddress.addr[0];
mac_addr[1] = macAddress.addr[1];
mac_addr[2] = macAddress.addr[2];
mac_addr[3] = macAddress.addr[3];
mac_addr[4] = macAddress.addr[4];
mac_addr[5] = macAddress.addr[5];
}
/*---------------------------------------------------------------------------*/
unsigned int netdev_read(void)
{

View File

@ -40,6 +40,7 @@
void netdev_init(void);
void netdev_init_mac(void);
void netdev_get_mac(unsigned char * mac_addr);
unsigned int netdev_read(void);
void netdev_send(void);

View File

@ -98,6 +98,27 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_MAX_LISTENPORTS 1
/**
* UDP support on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP 1
/**
* UDP Maximum Connections
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CONNS 1
/**
* UDP checksums on or off
*
* \hideinitializer
*/
#define UIP_CONF_UDP_CHECKSUMS 0
/**
* uIP buffer size.
*
@ -119,20 +140,6 @@ typedef unsigned short uip_stats_t;
*/
#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
*
@ -140,10 +147,12 @@ typedef unsigned short uip_stats_t;
*/
#define UIP_CONF_STATISTICS 0
/* Here we include the header file for the application(s) we use in
our project. */
#include "boot.h"
#include "header.h"
#include "net.h"
#include "dhcpc.h"
#endif /* __UIP_CONF_H__ */

View File

@ -48,10 +48,17 @@ void main(void)
{
/* initialize the microcontroller */
Init();
/* initialize the shared parameters module */
SharedParamsInit();
/* initialize the network application */
NetInit();
/* initialize the bootloader interface */
BootComInit();
/* the shared parameter at index 0 is used as a boolean flag to indicate if the
* bootloader should initialize the TCP/IP network stack. by default this flag
* should be reset.
*/
SharedParamsWriteByIndex(0, 0);
/* start the infinite program loop */
while (1)

View File

@ -1,10 +1,12 @@
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00008000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00008000;
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF;
define symbol __ICFEDIT_region_ROM_start__ = 0x00008000;
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
define symbol __ICFEDIT_region_SHARED_start__ = 0x20000000;
define symbol __ICFEDIT_region_SHARED_end__ = 0x2000003F;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000040;
define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x400;
define symbol __ICFEDIT_size_heap__ = 0x800;
@ -23,6 +25,7 @@ initialize by copy { readwrite };
do not initialize { section .noinit };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place at address mem:__ICFEDIT_region_SHARED_start__ { readwrite section .shared };
place in ROM_region { readonly };
place in RAM_region { readwrite,

View File

@ -53,6 +53,10 @@
static unsigned long periodicTimerTimeOut;
/** \brief Holds the time out value of the uIP ARP timer. */
static unsigned long ARPTimerTimeOut;
#if (BOOT_COM_NET_DHCP_ENABLE > 0)
/** \brief Holds the MAC address which is used by the DHCP client. */
static struct uip_eth_addr macAddress;
#endif
/************************************************************************************//**
@ -71,6 +75,7 @@ void NetInit(void)
ARPTimerTimeOut = TimerGet() + NET_UIP_ARP_TIMER_MS;
/* initialize the uIP TCP/IP stack. */
uip_init();
#if (BOOT_COM_NET_DHCP_ENABLE == 0)
/* set the IP address */
uip_ipaddr(ipaddr, BOOT_COM_NET_IPADDR0, BOOT_COM_NET_IPADDR1, BOOT_COM_NET_IPADDR2,
BOOT_COM_NET_IPADDR3);
@ -83,10 +88,28 @@ void NetInit(void)
uip_ipaddr(ipaddr, BOOT_COM_NET_GATEWAY0, BOOT_COM_NET_GATEWAY1, BOOT_COM_NET_GATEWAY2,
BOOT_COM_NET_GATEWAY3);
uip_setdraddr(ipaddr);
#else
/* set the IP address */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_sethostaddr(ipaddr);
/* set the network mask */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_setnetmask(ipaddr);
/* set the gateway address */
uip_ipaddr(ipaddr, 0, 0, 0, 0);
uip_setdraddr(ipaddr);
#endif
/* start listening on the configured port for XCP transfers on TCP/IP */
uip_listen(HTONS(BOOT_COM_NET_PORT));
/* initialize the MAC and set the MAC address */
netdev_init_mac();
#if (BOOT_COM_NET_DHCP_ENABLE > 0)
/* initialize the DHCP client application and send the initial request. */
netdev_get_mac(&macAddress.addr[0]);
dhcpc_init(&macAddress.addr[0], 6);
dhcpc_request();
#endif
} /*** end of NetInit ***/
@ -117,6 +140,13 @@ void NetApp(void)
/* check if this was an XCP CONNECT command */
if ((newDataPtr[0] == 0xff) && (newDataPtr[1] == 0x00))
{
/* the shared parameter at index 0 is used as a boolean flag to indicate if the
* bootloader should initialize the TCP/IP network stack. we just received a
* firmware update request from the TCP/IP network and we are about to active
* the bootloader for a firmware update via TCP/IP. At this point we should
* set the flag to make sure the bootloader initializes its TCP/IP network stack.
*/
SharedParamsWriteByIndex(0, 1);
/* connection request received so start the bootloader */
BootActivate();
}
@ -136,13 +166,13 @@ void NetTask(void)
/* check for an RX packet and read it. */
packetLen = netdev_read();
if(packetLen > 0)
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))
if (NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_IP))
{
uip_arp_ipin();
uip_input();
@ -150,7 +180,7 @@ void NetTask(void)
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if(uip_len > 0)
if (uip_len > 0)
{
uip_arp_out();
netdev_send();
@ -158,7 +188,7 @@ void NetTask(void)
}
}
/* process incoming ARP packets here. */
else if(NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_ARP))
else if (NET_UIP_HEADER_BUF->type == htons(UIP_ETHTYPE_ARP))
{
uip_arp_arpin();
@ -166,14 +196,14 @@ void NetTask(void)
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if(uip_len > 0)
if (uip_len > 0)
{
netdev_send();
uip_len = 0;
}
}
}
/* process TCP/IP Periodic Timer here. */
if (TimerGet() >= periodicTimerTimeOut)
{
@ -181,6 +211,22 @@ void NetTask(void)
for (connection = 0; connection < UIP_CONNS; connection++)
{
uip_periodic(connection);
/* If the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
*/
if (uip_len > 0)
{
uip_arp_out();
netdev_send();
uip_len = 0;
}
}
#if UIP_UDP
for (connection = 0; connection < UIP_UDP_CONNS; connection++)
{
uip_udp_periodic(connection);
/* If the above function invocation resulted in data that
* should be sent out on the network, the global variable
* uip_len is set to a value > 0.
@ -192,13 +238,14 @@ void NetTask(void)
uip_len = 0;
}
}
#endif
}
/* process ARP Timer here. */
if (TimerGet() >= ARPTimerTimeOut)
{
ARPTimerTimeOut += NET_UIP_ARP_TIMER_MS;
uip_arp_timer();
ARPTimerTimeOut += NET_UIP_ARP_TIMER_MS;
uip_arp_timer();
}
} /*** end of NetServerTask ***/

View File

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

View File

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

View File

@ -70,22 +70,6 @@
#define BOOT_COM_USB_RX_MAX_DATA (63)
/****************************************************************************************
* B A C K D O O R C O N F I G U R A T I O N
****************************************************************************************/
#if (BOOT_COM_USB_ENABLE > 0)
/* For a USB bootloader, the backdoor needs to stay open long enough for the USB device
* to enumerate on the host PC. Therefore it needs to be set a bit longer than the
* default value, which is done here by overriding the macro. Note that this won't be
* long enough for a first time USB driver install on the host PC. In this case the
* bootloader should be started with the backup backdoor that uses a digital input to
* for the bootloader to stay active. Refer to CpuUserProgramStartHook() to determine
* the digital input to use for this.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (2000)
#endif
/****************************************************************************************
* B A C K D O O R E N T R Y C O N F I G U R A T I O N
****************************************************************************************/

View File

@ -70,22 +70,6 @@
#define BOOT_COM_USB_RX_MAX_DATA (63)
/****************************************************************************************
* B A C K D O O R C O N F I G U R A T I O N
****************************************************************************************/
#if (BOOT_COM_USB_ENABLE > 0)
/* For a USB bootloader, the backdoor needs to stay open long enough for the USB device
* to enumerate on the host PC. Therefore it needs to be set a bit longer than the
* default value, which is done here by overriding the macro. Note that this won't be
* long enough for a first time USB driver install on the host PC. In this case the
* bootloader should be started with the backup backdoor that uses a digital input to
* for the bootloader to stay active. Refer to CpuUserProgramStartHook() to determine
* the digital input to use for this.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (2000)
#endif
/****************************************************************************************
* B A C K D O O R E N T R Y C O N F I G U R A T I O N
****************************************************************************************/

View File

@ -70,22 +70,6 @@
#define BOOT_COM_USB_RX_MAX_DATA (63)
/****************************************************************************************
* B A C K D O O R C O N F I G U R A T I O N
****************************************************************************************/
#if (BOOT_COM_USB_ENABLE > 0)
/* For a USB bootloader, the backdoor needs to stay open long enough for the USB device
* to enumerate on the host PC. Therefore it needs to be set a bit longer than the
* default value, which is done here by overriding the macro. Note that this won't be
* long enough for a first time USB driver install on the host PC. In this case the
* bootloader should be started with the backup backdoor that uses a digital input to
* for the bootloader to stay active. Refer to CpuUserProgramStartHook() to determine
* the digital input to use for this.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (2000)
#endif
/****************************************************************************************
* B A C K D O O R E N T R Y C O N F I G U R A T I O N
****************************************************************************************/

View File

@ -70,22 +70,6 @@
#define BOOT_COM_USB_RX_MAX_DATA (63)
/****************************************************************************************
* B A C K D O O R C O N F I G U R A T I O N
****************************************************************************************/
#if (BOOT_COM_USB_ENABLE > 0)
/* For a USB bootloader, the backdoor needs to stay open long enough for the USB device
* to enumerate on the host PC. Therefore it needs to be set a bit longer than the
* default value, which is done here by overriding the macro. Note that this won't be
* long enough for a first time USB driver install on the host PC. In this case the
* bootloader should be started with the backup backdoor that uses a digital input to
* for the bootloader to stay active. Refer to CpuUserProgramStartHook() to determine
* the digital input to use for this.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (2000)
#endif
/****************************************************************************************
* B A C K D O O R E N T R Y C O N F I G U R A T I O N
****************************************************************************************/

View File

@ -98,22 +98,6 @@
#define BOOT_COM_USB_RX_MAX_DATA (63)
/****************************************************************************************
* B A C K D O O R C O N F I G U R A T I O N
****************************************************************************************/
#if (BOOT_COM_USB_ENABLE > 0)
/* For a USB bootloader, the backdoor needs to stay open long enough for the USB device
* to enumerate on the host PC. Therefore it needs to be set a bit longer than the
* default value, which is done here by overriding the macro. Note that this won't be
* long enough for a first time USB driver install on the host PC. In this case the
* bootloader should be started with the backup backdoor that uses a digital input to
* for the bootloader to stay active. Refer to CpuUserProgramStartHook() to determine
* the digital input to use for this.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (2000)
#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

@ -98,22 +98,6 @@
#define BOOT_COM_USB_RX_MAX_DATA (63)
/****************************************************************************************
* B A C K D O O R C O N F I G U R A T I O N
****************************************************************************************/
#if (BOOT_COM_USB_ENABLE > 0)
/* For a USB bootloader, the backdoor needs to stay open long enough for the USB device
* to enumerate on the host PC. Therefore it needs to be set a bit longer than the
* default value, which is done here by overriding the macro. Note that this won't be
* long enough for a first time USB driver install on the host PC. In this case the
* bootloader should be started with the backup backdoor that uses a digital input to
* for the bootloader to stay active. Refer to CpuUserProgramStartHook() to determine
* the digital input to use for this.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (2000)
#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

@ -98,22 +98,6 @@
#define BOOT_COM_USB_RX_MAX_DATA (63)
/****************************************************************************************
* B A C K D O O R C O N F I G U R A T I O N
****************************************************************************************/
#if (BOOT_COM_USB_ENABLE > 0)
/* For a USB bootloader, the backdoor needs to stay open long enough for the USB device
* to enumerate on the host PC. Therefore it needs to be set a bit longer than the
* default value, which is done here by overriding the macro. Note that this won't be
* long enough for a first time USB driver install on the host PC. In this case the
* bootloader should be started with the backup backdoor that uses a digital input to
* for the bootloader to stay active. Refer to CpuUserProgramStartHook() to determine
* the digital input to use for this.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (2000)
#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

@ -104,18 +104,6 @@
/** \brief Enable/disable the backdoor override hook functions. */
#define BOOT_BACKDOOR_HOOKS_ENABLE (0)
#if (BOOT_COM_USB_ENABLE > 0)
/* For a USB bootloader, the backdoor needs to stay open long enough for the USB device
* to enumerate on the host PC. Therefore it needs to be set a bit longer than the
* default value, which is done here by overriding the macro. Note that this won't be
* long enough for a first time USB driver install on the host PC. In this case the
* bootloader should be started with the backup backdoor that uses a digital input to
* for the bootloader to stay active. Refer to CpuUserProgramStartHook() to determine
* the digital input to use for this.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (2000)
#endif
/****************************************************************************************
* N O N - V O L A T I L E M E M O R Y D R I V E R C O N F I G U R A T I O N

View File

@ -104,18 +104,6 @@
/** \brief Enable/disable the backdoor override hook functions. */
#define BOOT_BACKDOOR_HOOKS_ENABLE (0)
#if (BOOT_COM_USB_ENABLE > 0)
/* For a USB bootloader, the backdoor needs to stay open long enough for the USB device
* to enumerate on the host PC. Therefore it needs to be set a bit longer than the
* default value, which is done here by overriding the macro. Note that this won't be
* long enough for a first time USB driver install on the host PC. In this case the
* bootloader should be started with the backup backdoor that uses a digital input to
* for the bootloader to stay active. Refer to CpuUserProgramStartHook() to determine
* the digital input to use for this.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (2000)
#endif
/****************************************************************************************
* N O N - V O L A T I L E M E M O R Y D R I V E R C O N F I G U R A T I O N

View File

@ -104,18 +104,6 @@
/** \brief Enable/disable the backdoor override hook functions. */
#define BOOT_BACKDOOR_HOOKS_ENABLE (0)
#if (BOOT_COM_USB_ENABLE > 0)
/* For a USB bootloader, the backdoor needs to stay open long enough for the USB device
* to enumerate on the host PC. Therefore it needs to be set a bit longer than the
* default value, which is done here by overriding the macro. Note that this won't be
* long enough for a first time USB driver install on the host PC. In this case the
* bootloader should be started with the backup backdoor that uses a digital input to
* for the bootloader to stay active. Refer to CpuUserProgramStartHook() to determine
* the digital input to use for this.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (2000)
#endif
/****************************************************************************************
* N O N - V O L A T I L E M E M O R Y D R I V E R C O N F I G U R A T I O N

View File

@ -122,82 +122,56 @@
* 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
* with the macros BOOT_COM_NET_IPADDRx. The default netmask is configured with the
* macro BOOT_COM_NET_NETMASKx. The default gateway is configured with the macros
* BOOT_COM_NET_GATEWAYx. The bootloader acts and a TCP/IP server. The port the server
* listen on for connections is configured with BOOT_COM_NET_PORT.
* In case the network switch/router supports a DHCP server, you can set configuration
* macro BOOT_COM_NET_DHCP_ENABLE to 1 to enable the DHCP client. In this case the
* DHCP client handles the automatic IP address assignment. In this case the macros for
* configuring the IP address, network mask and gateway address are no longer needed.
*/
/** \brief Enable/disable the NET transport layer. */
#define BOOT_COM_NET_ENABLE (1)
#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)
#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)
#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)
#define BOOT_COM_NET_PORT (1000)
/** \brief Enable/disable DHCP client for automatically obtaining an IP address. */
#define BOOT_COM_NET_DHCP_ENABLE (1)
/** \brief Configure the 1st byte of the IP address */
#define BOOT_COM_NET_IPADDR0 (169)
#define BOOT_COM_NET_IPADDR0 (192)
/** \brief Configure the 2nd byte of the IP address */
#define BOOT_COM_NET_IPADDR1 (254)
#define BOOT_COM_NET_IPADDR1 (168)
/** \brief Configure the 3rd byte of the IP address */
#define BOOT_COM_NET_IPADDR2 (19)
#define BOOT_COM_NET_IPADDR2 (178)
/** \brief Configure the 4th byte of the IP address */
#define BOOT_COM_NET_IPADDR3 (63)
#define BOOT_COM_NET_IPADDR3 (50)
/** \brief Configure the 1st byte of the network mask */
#define BOOT_COM_NET_NETMASK0 (255)
#define BOOT_COM_NET_NETMASK0 (255)
/** \brief Configure the 2nd byte of the network mask */
#define BOOT_COM_NET_NETMASK1 (255)
#define BOOT_COM_NET_NETMASK1 (255)
/** \brief Configure the 3rd byte of the network mask */
#define BOOT_COM_NET_NETMASK2 (0)
#define BOOT_COM_NET_NETMASK2 (255)
/** \brief Configure the 4th byte of the network mask */
#define BOOT_COM_NET_NETMASK3 (0)
#define BOOT_COM_NET_NETMASK3 (0)
/** \brief Configure the 1st byte of the gateway address */
#define BOOT_COM_NET_GATEWAY0 (169)
#define BOOT_COM_NET_GATEWAY0 (192)
/** \brief Configure the 2nd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY1 (254)
#define BOOT_COM_NET_GATEWAY1 (168)
/** \brief Configure the 3rd byte of the gateway address */
#define BOOT_COM_NET_GATEWAY2 (19)
#define BOOT_COM_NET_GATEWAY2 (178)
/** \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_GATEWAY3 (1)
/** \brief Enable/disable the deferred initialization mechanism. When enabled, the
* communication interface is only initialized when: (a) no valid user program
* is detected, or (b) when CpuUserProgramStartHook() returns BLT_FALSE. Your
* bootloader application can explicitly initialize the communication interface
* by calling ComDeferredInit().
*/
#define BOOT_COM_NET_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.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (10000)
#elif (BOOT_COM_USB_ENABLE > 0)
/* For a USB bootloader, the backdoor needs to stay open long enough for the USB device
* to enumerate on the host PC. Therefore it needs to be set a bit longer than the
* default value, which is done here by overriding the macro. Note that this won't be
* long enough for a first time USB driver install on the host PC. In this case the
* bootloader should be started with the backup backdoor that uses a digital input to
* for the bootloader to stay active. Refer to CpuUserProgramStartHook() to determine
* the digital input to use for this.
*/
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (2000)
#endif
#define BOOT_COM_NET_DEFERRED_INIT_ENABLE (1)
/****************************************************************************************

View File

@ -37,9 +37,10 @@ SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 48K
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
CCRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 48K
SHARED (rwx) : ORIGIN = 0x20000000, LENGTH = 64
RAM (rwx) : ORIGIN = 0x20000040, LENGTH = 128K - 64
CCRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
}
/* Linker script to place sections and symbol values. Should be used together
@ -72,6 +73,17 @@ MEMORY
SECTIONS
{
.shared (NOLOAD):
{
. = ALIGN(4);
__shared_start__ = .;
*(.shared)
*(.shared.*)
KEEP(*(.shared))
. = ALIGN(4);
__shared_end__ = .;
} > SHARED
.text :
{
KEEP(*(.isr_vector))

View File

@ -405,8 +405,9 @@ static void SetSysClock(void)
RCC->CFGR |= RCC_CFGR_SW_PLL;
/* Wait till the main PLL is used as system clock source */
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL)
{
;
}
}
else

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