Skip to content

Commit

Permalink
Develop (#19)
Browse files Browse the repository at this point in the history
* How to build details

* Backmerge (#14)

* Own watchdog file, wd delay helper, disable charger wakeup, SdFileExists to helper

* MAP_UtilsDelay

* Add wiring from Energia for millis()

* Extend new config entries (battery/timeout)

* Rename SysTickHandler / Rearrange variables

* Fix memory length of AppTarget

* Optimize buffer

* disable running watchdog if one is running (#define)

* Make use of SRAM2 region (got overflow)

* Remove unneded code

* Implement checkBattery/idle Hibernation Rearrange

* Replace MAP_UtilsDelay with UtilsDelay again (is too fast?!)

* disable opti for relocator

* allow some heap

* Several attempts to get the watchdog working as it should

* Don't move .data around.

* fix watchdog, fix Run optimization, WDT recovery seq
  • Loading branch information
SciLor authored Feb 3, 2021
1 parent 4887535 commit 2399ce1
Show file tree
Hide file tree
Showing 16 changed files with 1,125 additions and 871 deletions.
276 changes: 139 additions & 137 deletions sd-bootloader-ng/bootmanager/Makefile
Original file line number Diff line number Diff line change
@@ -1,137 +1,139 @@
#******************************************************************************
#
# Makefile - Rules for building the bootmgr application.
#
# Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the
# distribution.
#
# Neither the name of Texas Instruments Incorporated nor the names of
# its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#*****************************************************************************

#VERBOSE=x

#
# The base directory.
#
ROOT=../..

#
# Set optimization level and linkscript
#
#OPT_LEVEL=s
ADD_LINK_SCRIPT=${PWD}/concatBootmanagerRelocator.sh

ifndef LINK_FILE
LINK_FILE=bootmgr.ld
endif

#
# Include the common make definitions.
#
include ${ROOT}/common/make/makeCommon

#
# Where to find source files that do not live in this directory.
#
#VPATH=..
VPATH+=${SDKROOT}/example/common

VPATH+=lib/FatFs
VPATH+=lib/jsmn-stream

#
# Where to find header files that do not live in the source directory.
#
#IPATH=..
#IPATH+=../../..
IPATH+=${SDKROOT}/inc
IPATH+=${SDKROOT}/driverlib
IPATH+=${SDKROOT}/simplelink
IPATH+=${SDKROOT}/simplelink/source
IPATH+=${SDKROOT}/simplelink/include
IPATH+=${SDKROOT}/simplelink_extlib/flc
IPATH+=${SDKROOT}/simplelink_extlib/provisioninglib

IPATH+=lib/FatFs
IPATH+=lib/jsmn-stream

#
# The default rule, which causes the driver library to be built.
#
all: ${OBJDIR} ${BINDIR}
all: ${BINDIR}/bootmgr.axf

#
# The rule to clean out all the build products.
#
clean:
@rm -rf ${OBJDIR} ${wildcard *~}
@rm -rf ${BINDIR} ${wildcard *~}


#
# The rule to create the target directories.
#
${OBJDIR}:
@mkdir -p ${OBJDIR}

${BINDIR}:
@mkdir -p ${BINDIR}

#
# Rules for building the bootmgr example.
#
${BINDIR}/bootmgr.axf: ${OBJDIR}/main.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/helper.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/config.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/patch.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/watchdog.o

${BINDIR}/bootmgr.axf: ${OBJDIR}/udma_if.o

${BINDIR}/bootmgr.axf: ${OBJDIR}/ff.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/diskio.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/jsmn_stream.o

${BINDIR}/bootmgr.axf: ${OBJDIR}/ccsbcs.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/network_common.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/startup_${COMPILER}.o
${BINDIR}/bootmgr.axf: ${SDKROOT}/simplelink/${COMPILER}/${BINDIR}/libsimplelink_nonos_opt.a
${BINDIR}/bootmgr.axf: ${SDKROOT}/driverlib/${COMPILER}/${BINDIR}/libdriver.a

SCATTERgcc_bootmgr=${LINK_FILE}
ENTRY_bootmgr=ResetISR

#
# Include the automatically generated dependency files.
#
ifneq (${MAKECMDGOALS},clean)
-include ${wildcard ${COMPILER}/*.d} __dummy__
endif
#******************************************************************************
#
# Makefile - Rules for building the bootmgr application.
#
# Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the
# distribution.
#
# Neither the name of Texas Instruments Incorporated nor the names of
# its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#*****************************************************************************

#VERBOSE=x

#
# The base directory.
#
ROOT=../..

#
# Set optimization level and linkscript
#
#OPT_LEVEL=s
ADD_LINK_SCRIPT=${PWD}/concatBootmanagerRelocator.sh

ifndef LINK_FILE
LINK_FILE=bootmgr.ld
endif

#
# Include the common make definitions.
#
include ${ROOT}/common/make/makeCommon

#
# Where to find source files that do not live in this directory.
#
#VPATH=..
VPATH+=${SDKROOT}/example/common

VPATH+=lib/FatFs
VPATH+=lib/jsmn-stream

#
# Where to find header files that do not live in the source directory.
#
#IPATH=..
#IPATH+=../../..
IPATH+=${SDKROOT}/inc
IPATH+=${SDKROOT}/driverlib
IPATH+=${SDKROOT}/simplelink
IPATH+=${SDKROOT}/simplelink/source
IPATH+=${SDKROOT}/simplelink/include
IPATH+=${SDKROOT}/simplelink_extlib/flc
IPATH+=${SDKROOT}/simplelink_extlib/provisioninglib

IPATH+=lib/FatFs
IPATH+=lib/jsmn-stream

#
# The default rule, which causes the driver library to be built.
#
all: ${OBJDIR} ${BINDIR}
all: ${BINDIR}/bootmgr.axf

#
# The rule to clean out all the build products.
#
clean:
@rm -rf ${OBJDIR} ${wildcard *~}
@rm -rf ${BINDIR} ${wildcard *~}


#
# The rule to create the target directories.
#
${OBJDIR}:
@mkdir -p ${OBJDIR}

${BINDIR}:
@mkdir -p ${BINDIR}

#
# Rules for building the bootmgr example.
#
${BINDIR}/bootmgr.axf: ${OBJDIR}/main.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/helper.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/config.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/patch.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/watchdog.o

${BINDIR}/bootmgr.axf: ${OBJDIR}/wiring.o

${BINDIR}/bootmgr.axf: ${OBJDIR}/udma_if.o

${BINDIR}/bootmgr.axf: ${OBJDIR}/ff.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/diskio.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/jsmn_stream.o

${BINDIR}/bootmgr.axf: ${OBJDIR}/ccsbcs.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/network_common.o
${BINDIR}/bootmgr.axf: ${OBJDIR}/startup_${COMPILER}.o
${BINDIR}/bootmgr.axf: ${SDKROOT}/simplelink/${COMPILER}/${BINDIR}/libsimplelink_nonos_opt.a
${BINDIR}/bootmgr.axf: ${SDKROOT}/driverlib/${COMPILER}/${BINDIR}/libdriver.a

SCATTERgcc_bootmgr=${LINK_FILE}
ENTRY_bootmgr=ResetISR

#
# Include the automatically generated dependency files.
#
ifneq (${MAKECMDGOALS},clean)
-include ${wildcard ${COMPILER}/*.d} __dummy__
endif
12 changes: 6 additions & 6 deletions sd-bootloader-ng/bootmanager/bootmgr.debug.ld
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
******************************************************************************/


HEAP_SIZE = 0x00000000;
HEAP_SIZE = 0x00000200;

MEMORY
{
/*SRAM (rwx) : ORIGIN = 0x20038000, LENGTH = 0x8000*/
SRAM (rwx) : ORIGIN = 0x20034000, LENGTH = 0x12000
APPTARGET (rwx) : ORIGIN = 0x20004000, LENGTH = 0x34000
APPTARGET (rwx) : ORIGIN = 0x20004000, LENGTH = 0x30000
SRAM2 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000
}

Expand Down Expand Up @@ -71,9 +71,9 @@ SECTIONS
__exidx_end = .;
} > SRAM

__init_data = .;

.data : AT(__init_data)
/*__init_data = .;*/
.data : /*AT(__init_data)*/
{
_data = .;
*(.data*)
Expand All @@ -96,6 +96,6 @@ SECTIONS
. = ALIGN(8);
_eheap = .;

}
} > SRAM2
}

21 changes: 0 additions & 21 deletions sd-bootloader-ng/bootmanager/bootmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,6 @@ extern "C"
#define USER_IMG_2_TOKEN 0x55AAAA55
#define USER_BOOT_INFO_TOKEN 0xA5A55A5A



//*****************************************************************************
// Macros
//*****************************************************************************
#ifndef FAST_BOOT
#define APP_IMG_SRAM_OFFSET 0x20004000
#else
#define APP_IMG_SRAM_OFFSET 0x20008000
#endif

#define DEVICE_IS_CC3101RS 0x18
#define DEVICE_IS_CC3101S 0x1B


//*****************************************************************************
// Fucntion prototype
//*****************************************************************************
extern void Run(unsigned long);


//****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
Expand Down
8 changes: 4 additions & 4 deletions sd-bootloader-ng/bootmanager/bootmgr.ld
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
******************************************************************************/


HEAP_SIZE = 0x00000000;
HEAP_SIZE = 0x00000200;

MEMORY
{
Expand Down Expand Up @@ -70,9 +70,9 @@ SECTIONS
__exidx_end = .;
} > SRAM

__init_data = .;
/*__init_data = .;*/

.data : AT(__init_data)
.data : /*AT(__init_data)*/
{
_data = .;
*(.data*)
Expand All @@ -95,6 +95,6 @@ SECTIONS
. = ALIGN(8);
_eheap = .;

}
} > SRAM2
}

Loading

0 comments on commit 2399ce1

Please sign in to comment.