Improvements:

- HAL re-organized
- FreeRTOS running stable
- UART finished
- SPI1 & SPI3 finished and functional
- Display driver added (functional)


git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@172 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-09-20 06:51:53 +00:00
parent f5dd9e0f09
commit c9562e8bfd
313 changed files with 8279 additions and 50216 deletions

View File

@@ -26,6 +26,8 @@
<option id="gnu.c.compiler.option.debugging.level.539814773" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1508262411" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/inc&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/HAL/Misc/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/HAL/Platform/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/FreeRTOS/Source/portable/GCC/ARM_CM3}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/FreeRTOS/Source/include}&quot;"/>
</option>
@@ -146,18 +148,6 @@
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="All" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>All</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/hsb-mrts"/>
@@ -166,4 +156,16 @@
<resource resourceType="PROJECT" workspacePath="/hsb-mrts"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>all</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
</cproject>

View File

@@ -6,7 +6,7 @@
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="1037813651804734009" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-965619469903595948" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@@ -18,7 +18,7 @@
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="1037813651804734009" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-965619469903595948" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@@ -1,6 +1,6 @@
ifndef EXECUTABLE
# Define release version for Adremo firmware here
# Define release version for firmware here
S0_RELEASE_PRODUCT = \""S0\""
S0_RELEASE_MAJOR = 0
S0_RELEASE_MINOR = 1
@@ -17,22 +17,30 @@ OBJECTS_GEN = \
\
system_stm32f10x.o \
sysmem.o \
startup_stm32.o \
startup_stm32f10x_cl.o \
\
freeRTOSFixes.o \
heap_4.o\
Logger.o \
\
heap_2.o\
list.o \
port.o \
queue.o \
tasks.o \
timers.o
timers.o \
STM32_STDPERIPH_ROOT = ../STM32F10x_StdPeriph_Lib_V3.5.0
STM32_STDPERIPH_INC = ../STM32F10x_StdPeriph_Lib_V3.5.0/inc
STM32_STDPERIPH_INC = ../STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/STM32F10x_StdPeriph_Driver/inc
STM32_DEVICE_SUPPORT_DIR = ../STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x
STM32_CORE_SUPPORT_DIR = ../STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/CoreSupport
FREERTOS_DIR = ../FreeRTOS/Source/include
FREERTOS_PORT_DIR = ../FreeRTOS/Source/portable/GCC/ARM_CM3
HAL_DIR = ../HAL
HAL_Misc_DIR = ../HAL/Misc/inc
HAL_PLATFORM_DIR = ../HAL/Platform/inc
HAL_KEYPAD_DIR = ../HAL/Keypad/inc
HAL_DISPLAY_DIR = ../HAL/Display/inc
LINKER_SCRIPTS_DIR = linker
LINKER_SCRIPT = LinkerScript.ld
@@ -51,41 +59,48 @@ INCLUDES = \
-I$(FREERTOS_DIR) \
-I$(FREERTOS_PORT_DIR) \
-I$(STM32_DEVICE_SUPPORT_DIR) \
-I$(STM32_CORE_SUPPORT_DIR)
-I$(STM32_CORE_SUPPORT_DIR) \
-I$(HAL_DIR) \
-I$(HAL_Misc_DIR) \
-I$(HAL_PLATFORM_DIR) \
-I$(HAL_KEYPAD_DIR) \
-I$(HAL_DISPLAY_DIR)
all: release
release: export RELEASE_PRODUCT := $(S0_RELEASE_PRODUCT)
release: export RELEASE_MAJOR := $(S0_RELEASE_MAJOR)
release: export RELEASE_MINOR := $(S0_RELEASE_MINOR)
release: export RELEASE_BRANCH := $(S0_RELEASE_BRANCH)
release: export RELEASE_REVISION := $(S0_RELEASE_REVISION)
release: export OBJ_DIR := obj_release/
release: export OBJECTS := $(OBJECTS_GEN)
release: export OBJECTS_MAIN := $(OBJECTS_MAIN)
release: export CROSS_COMPILE := arm-none-eabi-
release: export CCFLAGS := -c -O2 -Wall -g -lc -lm -fno-common -mcpu=cortex-m3 -mthumb $(RELEASE_DEFINES) $(INCLUDES)
release: export ASFLAGS := -g -mapcs-32
release: export LDFLAGS := -g -nostartfiles -mcpu=cortex-m3 -mthumb -T$(LINKER_SCRIPTS_DIR)/$(LINKER_SCRIPT) -Wl,-Map=hsb_mrts_release.map
release: export LDARCHIVES := -L. -L$(STM32_STDPERIPH_ROOT) -lSTM_StdPeriph -lhsb_mrts_release
release: export ARFLAGS := ru
release: export OBJCOPYFLAGS := -O binary
release: export OBJDUMPFLAGS := -x --syms -S
release: export EXECUTABLE := hsb_mrts_release.out
release: export BINFILE := hsb_mrts_release.bin
release: export LIBRARY := libhsb_mrts_release.a
release: export LISTFILE := hsb_mrts_release.list
release: ;@$(MAKE)
all: OLI_STM32_H107
OLI_STM32_H107: export RELEASE_PRODUCT := $(S0_RELEASE_PRODUCT)
OLI_STM32_H107: export RELEASE_MAJOR := $(S0_RELEASE_MAJOR)
OLI_STM32_H107: export RELEASE_MINOR := $(S0_RELEASE_MINOR)
OLI_STM32_H107: export RELEASE_BRANCH := $(S0_RELEASE_BRANCH)
OLI_STM32_H107: export RELEASE_REVISION := $(S0_RELEASE_REVISION)
OLI_STM32_H107: export OBJ_DIR := obj_release/
OLI_STM32_H107: export OBJECTS := $(OBJECTS_GEN)
OLI_STM32_H107: export OBJECTS_MAIN := $(OBJECTS_MAIN)
OLI_STM32_H107: export CROSS_COMPILE := arm-none-eabi-
OLI_STM32_H107: export CCFLAGS := -c -O2 -Wall -g -lc -lm -fno-common -mcpu=cortex-m3 -DOLI_STM32_H107 -DENABLE_SERIAL_LOGGING -mthumb $(RELEASE_DEFINES) $(INCLUDES)
OLI_STM32_H107: export ASFLAGS := -g -mapcs-32
OLI_STM32_H107: export LDFLAGS := -g -nostartfiles -mcpu=cortex-m3 -mthumb -T$(LINKER_SCRIPTS_DIR)/$(LINKER_SCRIPT) -Wl,-Map=hsb_mrts_OLI_STM32_H107.map
OLI_STM32_H107: export LDARCHIVES := -L. -L$(STM32_STDPERIPH_ROOT) -L$(HAL_DIR) -lhsb_mrts_OLI_STM32_H107 -lPlatform -lDisplay -lMisc -lSTM_StdPeriph
OLI_STM32_H107: export ARFLAGS := ru
OLI_STM32_H107: export OBJCOPYFLAGS := -O binary
OLI_STM32_H107: export OBJDUMPFLAGS := -x --syms -S
OLI_STM32_H107: export EXECUTABLE := hsb_mrts_OLI_STM32_H107.out
OLI_STM32_H107: export BINFILE := hsb_mrts_OLI_STM32_H107.bin
OLI_STM32_H107: export LIBRARY := libhsb_mrts_OLI_STM32_H107.a
OLI_STM32_H107: export LISTFILE := hsb_mrts_OLI_STM32_H107.list
OLI_STM32_H107: ;@$(MAKE)
clean:
rm -f hsb_mrts_release.out hsb_mrts_release.map hsb_mrts_release.bin hsb_mrts_release.list hsb_mrts_release.map libhsb_mrts_release.a
rm -f hsb_mrts_OLI_STM32_H107.out hsb_mrts_OLI_STM32_H107.map hsb_mrts_OLI_STM32_H107.bin hsb_mrts_OLI_STM32_H107.list hsb_mrts_OLI_STM32_H107.map libhsb_mrts_OLI_STM32_H107.a
rm -rf obj_release
flash:
st-flash write hsdb_mrts_release.bin 0x8000000
st-flash write hsdb_mrts_OLI_STM32_H107.bin 0x8000000
doc:
doxygen 0322-Adremo.dox
doxygen 0387-pho-hsb-mrts-doxygen.doc
.PHONY: all clean doc flash
@@ -98,7 +113,7 @@ startup \
../FreeRTOS/Source/portable/GCC/ARM_CM3 \
../FreeRTOS/Source/portable/MemMang \
../STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x \
../STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/CoreSupport
../STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/CoreSupport \
vpath %.s \
startup
@@ -118,10 +133,10 @@ $(BINFILE): $(EXECUTABLE)
cp $@ ../$@
$(EXECUTABLE): $(OBJ_DIR) $(OBJECTS_MAIN) $(LIBRARY)
$(LD) $(LDFLAGS) $(addprefix $(OBJ_DIR)/, $(OBJECTS_MAIN)) $(LDARCHIVES) -o $@
$(LD) $(LDFLAGS) $(addprefix $(OBJ_DIR), $(OBJECTS_MAIN)) $(LDARCHIVES) -o $@
$(LIBRARY): $(OBJ_DIR) $(OBJECTS) | $(OBJ_DIR)
$(AR) $(ARFLAGS) $@ $(addprefix $(OBJ_DIR)/, $(OBJECTS))
$(AR) $(ARFLAGS) $@ $(addprefix $(OBJ_DIR), $(OBJECTS))
%.o: %.c
$(CC) $(CCFLAGS) $< -o $(OBJ_DIR)/$@

View File

@@ -37,41 +37,55 @@
// Constant and macro definitions
// -----------------------------------------------------------------------------
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( ( unsigned long ) 62500000 )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 30 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( ( unsigned long ) 8000000 )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 512 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 30 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
#define configUSE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 0
#define configUSE_ALTERNATIVE_API 0
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_RECURSIVE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 0
#define configGENERATE_RUN_TIME_STATS 1
#define configUSE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 0
#define configUSE_ALTERNATIVE_API 0
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_RECURSIVE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE (10)
#define configGENERATE_RUN_TIME_STATS 1
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
/* Software timer related definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY (4)
#define configTIMER_QUEUE_LENGTH (10)
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
/* Define to trap errors during development. */
#define configASSERT( x ) if( ( x ) == 0 ) for(;;)
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
/* This demo makes use of one or more example stats formatting functions. These
format the raw data provided by the uxTaskGetSystemState() function in to human
@@ -93,6 +107,7 @@ configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest
NVIC value of 255. */
#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------

View File

@@ -0,0 +1,136 @@
// -----------------------------------------------------------------------------
/// @file Logger.h
/// @brief File description
// -----------------------------------------------------------------------------
// Micro-Key bv
// Industrieweg 28, 9804 TG Noordhorn
// Postbus 92, 9800 AB Zuidhorn
// The Netherlands
// Tel: +31 594 503020
// Fax: +31 594 505825
// Email: support@microkey.nl
// Web: www.microkey.nl
// -----------------------------------------------------------------------------
/// $Revision: 167 $
/// $Author: mmi $
/// $Date: 2017-09-12 13:09:10 +0200 (di, 12 sep 2017) $
// (c) 2017 Micro-Key bv
// -----------------------------------------------------------------------------
/// @defgroup {group_name} {group_description}
/// Description
/// @file Logger.h
/// @ingroup {group_name}
#ifndef _LOGGER_H_
#define _LOGGER_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "stm32f10x.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_ERROR(...) \
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_ERROR, ##__VA_ARGS__)
#define LOGGER_WARNING(...) \
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_WARNING, ##__VA_ARGS__)
#define LOGGER_INFO(...) \
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_INFO, ##__VA_ARGS__)
#define LOGGER_DEBUG(...) \
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_DEBUG, ##__VA_ARGS__)
#define LOGGER_PRINT(...) \
Logger_log("", "", 0, LOGTYPE_PRINT, ##__VA_ARGS__)
#define LOGGER_ERROR_ISR(...) \
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_ERROR, ##__VA_ARGS__)
#define LOGGER_WARNING_ISR(...) \
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_WARNING, ##__VA_ARGS__)
#define LOGGER_INFO_ISR(...) \
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_INFO, ##__VA_ARGS__)
#define LOGGER_DEBUG_ISR(...) \
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_DEBUG, ##__VA_ARGS__)
#define LOGGER_PRINT_ISR(...) \
Logger_logISR("", "", 0, LOGTYPE_PRINT, ##__VA_ARGS__)
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
typedef enum
{
LOGTYPE_PRINT, /**< Raw print */
LOGTYPE_DEBUG, /**< Debug information only; will not be stored on SD-card */
LOGTYPE_INFO, /**< Informational messages of important events */
LOGTYPE_WARNING, /**< Recoverable fault */
LOGTYPE_ERROR /**< Unrecoverable fault */
} LogType;
typedef enum
{
FATALCODE_STACKOVERFLOW = 0x11,
FATALCODE_MALLOCFAILED = 0x12,
FATALCODE_USBCOMQUEUE = 0x13,
FATALCODE_LOGGERINITFAILED = 0x14,
FATALCODE_LOGGERQUEUEFAILED = 0x15,
FATALCODE_ADCOVERFLOW = 0x16,
FATALCODE_HIDQUEUETIMEOUT = 0x17,
FATALCODE_OUTPUTACTIONSQUEUETIMEOUT = 0x18,
FATALCODE_RNETQUEUEFAILED = 0x19,
FATALCODE_TEST2 = 0xFE,
FATALCODE_TEST = 0xFF
} FatalCode;
struct LogQueueItem
{
char fileName[32];
char functionName[32];
char context[128];
int lineNumber;
LogType logType;
};
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
void Logger_initialize(void* const interface);
void Logger_terminate(void);
void Logger_logISR(const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* context);
void Logger_fatal(FatalCode code);
ErrorStatus Logger_addCommandHandlers(void);
ErrorStatus Logger_logModuleInfo(void);
/**
* Logs a string.
* Use the Logging macros instead
* \memberof Logger
* \private
* \param fileName File name to be logged
* \param functionName Function name to be logged
* \param lineNumber Line number to be logged
* \param logType Type of logging
* \param format printf-type formatting string
* \param ... Variable arguments according to the formatting string
*/
void Logger_log(const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* format, ...) __attribute__((format(printf, 5, 6)));
#endif

View File

@@ -51,6 +51,7 @@
// Function declarations
// -----------------------------------------------------------------------------
void OS_logTaskInfo(xTaskHandle taskHandle);

View File

@@ -0,0 +1,64 @@
// -----------------------------------------------------------------------------
/// @file stm32f10x_it.h
/// @brief File description
// -----------------------------------------------------------------------------
// Micro-Key bv
// Industrieweg 28, 9804 TG Noordhorn
// Postbus 92, 9800 AB Zuidhorn
// The Netherlands
// Tel: +31 594 503020
// Fax: +31 594 505825
// Email: support@microkey.nl
// Web: www.microkey.nl
// -----------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2017 Micro-Key bv
// -----------------------------------------------------------------------------
/// @defgroup {group_name} {group_description}
/// Description
/// @file stm32f10x_it.h
/// @ingroup {group_name}
#ifndef STM32F10X_IT_H_
#define STM32F10X_IT_H_
#ifdef __cplusplus
extern "C" {
#endif
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "stm32f10x.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
void SysTick_Handler(void);
extern void IRQ_setInterruptProperties(uint8_t irqChannel, uint8_t preemptionPriority, uint8_t subPriority, FunctionalState command);
#ifdef __cplusplus
}
#endif
#endif /* STM32F10X_IT_H_ */

View File

@@ -0,0 +1,318 @@
// -----------------------------------------------------------------------------
/// @file Logger.c
/// @brief Description
// -----------------------------------------------------------------------------
// Micro-Key bv
// Industrieweg 28, 9804 TG Noordhorn
// Postbus 92, 9800 AB Zuidhorn
// The Netherlands
// Tel: +31 594 503020
// Fax: +31 594 505825
// Email: support@microkey.nl
// Web: www.microkey.nl
// -----------------------------------------------------------------------------
/// $Revision: 167 $
/// $Author: mmi $
/// $Date: 2017-09-12 13:09:10 +0200 (di, 12 sep 2017) $
// (c) 2017 Micro-Key bv
// -----------------------------------------------------------------------------
/// @file main.c
/// @ingroup {group_name}
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "FreeRTOS.h"
#include "Logger.h"
#include "semphr.h"
#include "queue.h"
#include "task.h"
#include "misc.h"
#include <stdio.h>
#include <stdarg.h>
#include <stdbool.h>
#include <string.h>
#include "uart.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
#define LOGQUEUE_SIZE (64)
#define LOGGER_STACK_SIZE (512)
#define LOGGER_TASK_PRIORITY (1)
// Makefile compile options:
// ENABLE_SERIAL_LOGGING: Use the serial port for logging.
#if defined(ENABLE_SERIAL_LOGGING)
#define ENABLE_LOGGING
#else
#undef ENABLE_LOGGING
#endif
// -----------------------------------------------------------------------------
// Type definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// File-scope variables
// -----------------------------------------------------------------------------
static struct Uart* loggerInterface;
static xQueueHandle logQueue;
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
static bool initialized = false;
static xTaskHandle loggerTaskHandle = NULL;
// -----------------------------------------------------------------------------
// Function definitions
// -----------------------------------------------------------------------------
static void composeLogQueueItem(struct LogQueueItem* logQueueItem, const char* fileName, const char* functionName,
int lineNumber, LogType logType, const char* context);
static void loggerTask(void* parameters);
/* ---------------------*
* Function definitions *
* ---------------------*
*/
void Logger_initialize(void* const interface)
{
if(!initialized)
{
ErrorStatus errorStatus = SUCCESS;
///TODO This is currently hardcoded into the UART - there must be a way for more generic usage
loggerInterface = (struct Uart* const) interface;
if(errorStatus == SUCCESS)
{
logQueue = xQueueCreate(LOGQUEUE_SIZE, sizeof(struct LogQueueItem));
if(logQueue == 0)
{
errorStatus = ERROR;
}
}
if(errorStatus == SUCCESS)
{
if(xTaskCreate(loggerTask, (const char*)"loggerTask", LOGGER_STACK_SIZE, NULL, LOGGER_TASK_PRIORITY, &loggerTaskHandle) != pdPASS)
{
errorStatus = ERROR;
}
}
if(errorStatus == SUCCESS)
{
initialized = true;
LOGGER_INFO("Logger started");
}
else
{
}
}
}
void Logger_terminate(void)
{
}
void Logger_log(const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* format, ...)
{
if(initialized)
{
static int nrLostMessages = 0;
static bool overflowRecovery = false;
int nrOfMessages;
struct LogQueueItem logQueueItem;
va_list ap;
nrOfMessages = uxQueueMessagesWaiting(&logQueue);
if((nrOfMessages == LOGQUEUE_SIZE - 1) && !overflowRecovery)
{
// Queue almost full, only one entry left. Log a warning instead
composeLogQueueItem(&logQueueItem, __FILE__, __func__, __LINE__, LOGTYPE_WARNING, "Log queue overflow");
(void)xQueueSend(logQueue, &logQueueItem, 0);
overflowRecovery = true;
nrLostMessages = 1;
}
else if((nrOfMessages == 0) && overflowRecovery)
{
// Queue empty again after an overflow
char str[128];
snprintf(str, sizeof(str) / sizeof(str[0]), "%d messages lost", nrLostMessages);
composeLogQueueItem(&logQueueItem, __FILE__, __func__, __LINE__, LOGTYPE_WARNING, str);
(void)xQueueSend(logQueue, &logQueueItem, 0);
overflowRecovery = false;
}
else if(!overflowRecovery)
{
// Normal behaviour, queue not full
char str[128];
va_start(ap, format);
vsnprintf(str, sizeof(str) / sizeof(str[0]), format, ap);
va_end(ap);
composeLogQueueItem(&logQueueItem, __FILE__, __func__, __LINE__, logType, str);
(void)xQueueSend(logQueue, &logQueueItem, 0);
}
else
{
// Count number of lost messages
++nrLostMessages;
}
}
}
void Logger_logISR(const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* context)
{
#if defined(ENABLE_LOGGING)
if(initialized)
{
struct LogQueueItem logQueueItem;
portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
composeLogQueueItem(&logQueueItem, fileName, functionName, lineNumber, logType, context);
if(xQueueSendFromISR(logQueue, &logQueueItem, &higherPriorityTaskWoken) != pdTRUE)
{
// Queue failed
}
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
}
#endif
}
static void composeLogQueueItem(struct LogQueueItem* logQueueItem, const char* fileName, const char* functionName,
int lineNumber, LogType logType, const char* context)
{
const size_t fileNameSize = sizeof(logQueueItem->fileName) / sizeof(logQueueItem->fileName[0]);
const size_t functionNameSize = sizeof(logQueueItem->functionName) / sizeof(logQueueItem->functionName[0]);
const size_t contextSize = sizeof(logQueueItem->context) / sizeof(logQueueItem->context[0]);
logQueueItem->logType = logType;
strncpy(&(logQueueItem->context[0]), context, contextSize);
logQueueItem->context[contextSize - 1] = '\0';
if(logType != LOGTYPE_PRINT)
{
int fileNameIndex = 0;
// If filename starts with "src/", strip this part
if((fileName[0] == 's') &&
(fileName[1] == 'r') &&
(fileName[2] == 'c') &&
(fileName[3] == '/'))
{
fileNameIndex = 4;
}
// All logtypes except LOGTYPE_PRINT need filename, functionname and linenumber.
strncpy(&(logQueueItem->fileName[0]), &fileName[fileNameIndex], fileNameSize);
strncpy(&(logQueueItem->functionName[0]), functionName, functionNameSize);
logQueueItem->lineNumber = lineNumber;
// Fix terminating null byte in strncpy in case string to be copied is too long
logQueueItem->fileName[fileNameSize - 1] = '\0';
logQueueItem->functionName[functionNameSize - 1] = '\0';
}
}
static void loggerTask(void* parameters)
{
for(;;)
{
struct LogQueueItem logQueueItem;
xQueueReceive(logQueue, &logQueueItem, portMAX_DELAY);
if(logQueueItem.logType == LOGTYPE_PRINT)
{
// Raw print
#if defined(ENABLE_SERIAL_LOGGING)
Uart_Write(loggerInterface, (const uint8_t*)logQueueItem.context, strlen(logQueueItem.context));
#endif
}
else
{
#if defined(ENABLE_SERIAL_LOGGING)
char str[256];
char* vt100Prefix = "";
const char* vt100Postfix = "\033[0m";
#endif
int hours;
int minutes;
int seconds;
#if defined(ENABLE_SERIAL_LOGGING)
if(logQueueItem.logType == LOGTYPE_INFO)
{
vt100Prefix = "\033[33m";
}
else if(logQueueItem.logType == LOGTYPE_WARNING)
{
vt100Prefix = "\033[35m";
}
else if(logQueueItem.logType == LOGTYPE_ERROR)
{
vt100Prefix = "\033[31m";
}
#endif
///TODO add RTC support
// RTC_getTime(&hours, &minutes, &seconds);
hours = 13;
minutes = 37;
seconds = 10;
#if defined(ENABLE_SERIAL_LOGGING)
// Formatted print
snprintf(str, sizeof(str) / sizeof(str[0]), "%s[%s] %02d:%02d:%02d %s, %s, %d: %s%s\n",
vt100Prefix,
(logQueueItem.logType == LOGTYPE_DEBUG) ? "DBG" :
(logQueueItem.logType == LOGTYPE_INFO) ? "INF" :
(logQueueItem.logType == LOGTYPE_WARNING) ? "WRN" : "ERR",
///TODO add RTC support
hours,
minutes,
seconds,
logQueueItem.fileName,
logQueueItem.functionName,
logQueueItem.lineNumber,
logQueueItem.context,
vt100Postfix);
#endif
#if defined(ENABLE_SERIAL_LOGGING)
Uart_Write(loggerInterface, (const uint8_t*)str, strlen(str));
#endif
}
}
}

View File

@@ -69,7 +69,7 @@ void OS_logTaskInfo(xTaskHandle taskHandle)
// Shell_sendString(text);
highWaterMark = uxTaskGetStackHighWaterMark(taskHandle);
// snprintf(text, sizeof(text), "Stack high water mark : %lu long words\n", highWaterMark);
snprintf(text, sizeof(text), "Stack high water mark : %lu long words\n", highWaterMark);
// Shell_sendString(text);
}

View File

@@ -28,8 +28,17 @@
// FreeRTOS includes
#include "FreeRTOS.h"
#include "task.h"
#include "freeRTOSFixes.h"
#include "Logger.h"
#include "misc.h"
#include "stm32f10x_rcc.h"
#include "nhd0420.h"
#include "platform.h"
#include "led.h"
#include "uart.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
@@ -43,6 +52,11 @@ tick hook. */
// Type definitions
// -----------------------------------------------------------------------------
struct LedTaskArguments
{
struct Led* led;
int frequency;
};
// -----------------------------------------------------------------------------
// File-scope variables
@@ -52,12 +66,16 @@ tick hook. */
stats. */
unsigned long ulRunTimeStatsClock = 0UL;
static struct LedTaskArguments ledTaskArguments;
static xTaskHandle initTaskHandle;
static xTaskHandle ledTaskHandle;
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
static void initTask(void* parameters);
static void ledBlinkTask(void* parameters);
// -----------------------------------------------------------------------------
// Function definitions
// -----------------------------------------------------------------------------
@@ -66,7 +84,17 @@ unsigned long ulRunTimeStatsClock = 0UL;
int main (void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
// Create TaskHandles
ledTaskArguments.led = ledOrange;
ledTaskArguments.frequency = 2;
xTaskCreate(initTask, (const char* const)"initTask", 1024, NULL, 0, &initTaskHandle);
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 1024, &ledTaskArguments, 0, &ledTaskHandle);
LOGGER_INFO("Starting the scheduler");
/* Start the scheduler. */
vTaskStartScheduler();
@@ -83,3 +111,46 @@ void vApplicationTickHook ()
{
}
static void initTask(void* parameters)
{
initPlatform();
Logger_initialize(uart1);
NHD0420_construct(spiDisplay);
NHD0420_turnOffDisplay();
vTaskDelay(1000);
NHD0420_clearScreen();
vTaskDelay(1000);
NHD0420_turnOnDisplay();
vTaskDelay(1000);
NHD0420_setContrast(30);
vTaskDelay(1000);
NHD0420_setBacklightBrightness(3);
vTaskDelay(1000);
NHD0420_setCursorToHome();
vTaskDelay(1000);
NHD0420_sendData("Hallo Welt", 10);
vTaskDelay(1);
NHD0420_setCursorToPosition(4, 5);
NHD0420_sendData("Koetjeboe", 9);
}
static void ledBlinkTask (void* parameters)
{
struct LedTaskArguments* arguments = (struct LedTaskArguments*) parameters;
struct Led* led = arguments->led;
int frequency = arguments->frequency;
while (1)
{
LED_turnOn(led);
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
LED_turnOff(led);
vTaskDelay(configTICK_RATE_HZ / (frequency * 2));
}
}

View File

@@ -0,0 +1,266 @@
// -----------------------------------------------------------------------------
/// @file stm32f10x_it.c
/// @brief Description
// -----------------------------------------------------------------------------
// Micro-Key bv
// Industrieweg 28, 9804 TG Noordhorn
// Postbus 92, 9800 AB Zuidhorn
// The Netherlands
// Tel: +31 594 503020
// Fax: +31 594 505825
// Email: support@microkey.nl
// Web: www.microkey.nl
// -----------------------------------------------------------------------------
/// $Revision: $
/// $Author: $
/// $Date: $
// (c) 2017 Micro-Key bv
// -----------------------------------------------------------------------------
/// @file stm32f10x_it.c
/// @ingroup {group_name}
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "FreeRTOS.h"
#include "misc.h"
#include "queue.h"
#include "semphr.h"
#include "stm32f10x_it.h"
#include "led.h"
#include "platform.h"
#include "spi.h"
#include "uart.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// File-scope variables
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function definitions
// -----------------------------------------------------------------------------
void IRQ_setInterruptProperties(uint8_t irqChannel, uint8_t preemptionPriority, uint8_t subPriority, FunctionalState command)
{
NVIC_InitTypeDef NVIC_InitStructure; //! Define empty NVIC structure
//! Configure the USARTx Interrupt
NVIC_InitStructure.NVIC_IRQChannel = irqChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = preemptionPriority;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = subPriority;
NVIC_InitStructure.NVIC_IRQChannelCmd = command;
//! initialize the interrupts interface will all configured items
NVIC_Init(&NVIC_InitStructure);
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
// void SVC_Handler(void)
// {
// }
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
// void PendSV_Handler(void)
// {
// }
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
// void SysTick_Handler(void)
// {
// }
/** ----------------------------------------------------------------------------
* @brief Function: USART1_IRQHandler
*
* Dedicated Interrupt Service Routine for USART1
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
void USART1_IRQHandler(void)
{
static signed portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
//! Transmission register empty interrupt
if(USART_GetITStatus(USART1, USART_IT_TXE) != RESET)
{
//! Receive element from usart transmission queue
struct usartQueueItem usartTxItem;
xQueueReceiveFromISR(uart1->txQueue, &usartTxItem, &higherPriorityTaskWoken);
//! Write one byte to the transmit data register
USART_SendData(USART1, usartTxItem.byte);
//! check if queue is empty -> all bytes transmit
if(pdTRUE == xQueueIsQueueEmptyFromISR(uart1->txQueue))
{
//! Disable the COMPORT Transmit interrupt and release semaphore
USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
xSemaphoreGiveFromISR(uart1->txSemaphore, &higherPriorityTaskWoken);
}
}
//! Current interrupt is triggered by USART_RXNE (receive register not empty)
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
//! Read one byte from the receive data register
struct usartQueueItem usartRxItem;
//! Reading from reception register automatically clears the RXNE interrupt
usartRxItem.byte = (unsigned char) 0xFF & USART_ReceiveData(USART1);
//! Add the byte to the bluetooth RX queue
//! In case of a full queue, the data is dumped
(void)xQueueSendFromISR(uart1->rxQueue, &usartRxItem, &higherPriorityTaskWoken);
}
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
}
/** ----------------------------------------------------------------------------
* @brief Function: SPI1_IRQHandler
*
* Dedicated Interrupt Service Routine for SPI1
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
void SPI1_IRQHandler (void)
{
static signed portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
//! Transmission register empty interrupt
if(SPI_I2S_GetITStatus(SPI1, SPI_I2S_IT_TXE) != RESET)
{
//! Receive element from usart transmission queue
struct spiQueueItem spiTxItem;
xQueueReceiveFromISR(spi1->txQueue, &spiTxItem, &higherPriorityTaskWoken);
//! Write one byte to the transmit data register
if (spi1->SPI_InitStruct.SPI_NSS == SPI_NSS_Soft)
{
GPIO_ResetBits(spi1->SPI_CE->GPIO_Typedef, spi1->SPI_CE->GPIO_InitStruct.GPIO_Pin);
}
SPI_I2S_SendData(SPI1, spiTxItem.byte);
if (spi1->SPI_InitStruct.SPI_NSS == SPI_NSS_Soft)
{
GPIO_SetBits(spi1->SPI_CE->GPIO_Typedef, spi1->SPI_CE->GPIO_InitStruct.GPIO_Pin);
}
//! check if queue is empty -> all bytes transmit
if(pdTRUE == xQueueIsQueueEmptyFromISR(spi1->txQueue))
{
//! Disable the COMPORT Transmit interrupt and release semaphore
SPI_I2S_ITConfig(SPI1, SPI_I2S_IT_TXE, DISABLE);
xSemaphoreGiveFromISR(spi1->txSemaphore, &higherPriorityTaskWoken);
}
}
//! Current interrupt is triggered by USART_RXNE (receive register not empty)
if(SPI_I2S_GetITStatus(SPI1, SPI_I2S_IT_RXNE) != RESET)
{
//! Read one byte from the receive data register
struct spiQueueItem spiRxItem;
//! Reading from reception register automatically clears the RXNE interrupt
spiRxItem.byte = (unsigned char) 0xFF & SPI_I2S_ReceiveData(SPI1);
//! Add the byte to the bluetooth RX queue
//! In case of a full queue, the data is dumped
(void)xQueueSendFromISR(spi1->rxQueue, &spiRxItem, &higherPriorityTaskWoken);
}
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
}
/** ----------------------------------------------------------------------------
* @brief Function: SPI3_IRQHandler
*
* Dedicated Interrupt Service Routine for SPI3
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
void SPI3_IRQHandler (void)
{
static signed portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
//! Transmission register empty interrupt
if(SPI_I2S_GetITStatus(SPI3, SPI_I2S_IT_TXE) != RESET)
{
//! Receive element from usart transmission queue
struct spiQueueItem spiTxItem;
xQueueReceiveFromISR(spi3->txQueue, &spiTxItem, &higherPriorityTaskWoken);
//! Write one byte to the transmit data register
SPI_I2S_SendData(SPI3, spiTxItem.byte);
//! check if queue is empty -> all bytes transmit
if(pdTRUE == xQueueIsQueueEmptyFromISR(spi3->txQueue))
{
//! Disable the COMPORT Transmit interrupt and release semaphore
SPI_I2S_ITConfig(SPI3, SPI_I2S_IT_TXE, DISABLE);
xSemaphoreGiveFromISR(spi3->txSemaphore, &higherPriorityTaskWoken);
}
}
//! Current interrupt is triggered by USART_RXNE (receive register not empty)
if(SPI_I2S_GetITStatus(SPI3, SPI_I2S_IT_RXNE) != RESET)
{
//! Read one byte from the receive data register
struct spiQueueItem spiRxItem;
//! Reading from reception register automatically clears the RXNE interrupt
spiRxItem.byte = (unsigned char) 0xFF & SPI_I2S_ReceiveData(SPI3);
//! Add the byte to the bluetooth RX queue
//! In case of a full queue, the data is dumped
(void)xQueueSendFromISR(spi3->rxQueue, &spiRxItem, &higherPriorityTaskWoken);
}
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
}

View File

@@ -0,0 +1,468 @@
/**
******************************************************************************
* @file startup_stm32f10x_cl.s
* @author MCD Application Team
* @version V3.5.0
* @date 11-March-2011
* @brief STM32F10x Connectivity line Devices vector table for RIDE7 toolchain.
* This module performs:
* - Set the initial SP
* - Set the initial PC == Reset_Handler,
* - Set the vector table entries with the exceptions ISR
* address.
* - Configure the clock system
* - Branches to main in the C library (which eventually
* calls main()).
* After Reset the Cortex-M3 processor is in Thread mode,
* priority is Privileged, and the Stack is set to Main.
******************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
******************************************************************************
*/
.syntax unified
.cpu cortex-m3
.fpu softvfp
.thumb
.global g_pfnVectors
.global Default_Handler
/* start address for the initialization values of the .data section.
defined in linker script */
.word _sidata
/* start address for the .data section. defined in linker script */
.word _sdata
/* end address for the .data section. defined in linker script */
.word _edata
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
.word _ebss
.equ BootRAM, 0xF1E0F85F
/**
* @brief This is the code that gets called when the processor first
* starts execution following a reset event. Only the absolutely
* necessary set is performed, after which the application
* supplied main() routine is called.
* @param None
* @retval : None
*/
.section .text.Reset_Handler
.weak Reset_Handler
.type Reset_Handler, %function
Reset_Handler:
/* Copy the data segment initializers from flash to SRAM */
movs r1, #0
b LoopCopyDataInit
CopyDataInit:
ldr r3, =_sidata
ldr r3, [r3, r1]
str r3, [r0, r1]
adds r1, r1, #4
LoopCopyDataInit:
ldr r0, =_sdata
ldr r3, =_edata
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2], #4
LoopFillZerobss:
ldr r3, = _ebss
cmp r2, r3
bcc FillZerobss
/* Call the clock system intitialization function.*/
bl SystemInit
/* Call the application's entry point.*/
bl main
bx lr
.size Reset_Handler, .-Reset_Handler
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
* @param None
* @retval None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_Handler
/******************************************************************************
*
* The minimal vector table for a Cortex M3. Note that the proper constructs
* must be placed on this to ensure that it ends up at physical address
* 0x0000.0000.
*
*******************************************************************************/
.section .isr_vector,"a",%progbits
.type g_pfnVectors, %object
.size g_pfnVectors, .-g_pfnVectors
g_pfnVectors:
.word _estack
.word Reset_Handler
.word NMI_Handler
.word HardFault_Handler
.word MemManage_Handler
.word BusFault_Handler
.word UsageFault_Handler
.word 0
.word 0
.word 0
.word 0
.word SVC_Handler
.word DebugMon_Handler
.word 0
.word PendSV_Handler
.word SysTick_Handler
.word WWDG_IRQHandler
.word PVD_IRQHandler
.word TAMPER_IRQHandler
.word RTC_IRQHandler
.word FLASH_IRQHandler
.word RCC_IRQHandler
.word EXTI0_IRQHandler
.word EXTI1_IRQHandler
.word EXTI2_IRQHandler
.word EXTI3_IRQHandler
.word EXTI4_IRQHandler
.word DMA1_Channel1_IRQHandler
.word DMA1_Channel2_IRQHandler
.word DMA1_Channel3_IRQHandler
.word DMA1_Channel4_IRQHandler
.word DMA1_Channel5_IRQHandler
.word DMA1_Channel6_IRQHandler
.word DMA1_Channel7_IRQHandler
.word ADC1_2_IRQHandler
.word CAN1_TX_IRQHandler
.word CAN1_RX0_IRQHandler
.word CAN1_RX1_IRQHandler
.word CAN1_SCE_IRQHandler
.word EXTI9_5_IRQHandler
.word TIM1_BRK_IRQHandler
.word TIM1_UP_IRQHandler
.word TIM1_TRG_COM_IRQHandler
.word TIM1_CC_IRQHandler
.word TIM2_IRQHandler
.word TIM3_IRQHandler
.word TIM4_IRQHandler
.word I2C1_EV_IRQHandler
.word I2C1_ER_IRQHandler
.word I2C2_EV_IRQHandler
.word I2C2_ER_IRQHandler
.word SPI1_IRQHandler
.word SPI2_IRQHandler
.word USART1_IRQHandler
.word USART2_IRQHandler
.word USART3_IRQHandler
.word EXTI15_10_IRQHandler
.word RTCAlarm_IRQHandler
.word OTG_FS_WKUP_IRQHandler
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word TIM5_IRQHandler
.word SPI3_IRQHandler
.word UART4_IRQHandler
.word UART5_IRQHandler
.word TIM6_IRQHandler
.word TIM7_IRQHandler
.word DMA2_Channel1_IRQHandler
.word DMA2_Channel2_IRQHandler
.word DMA2_Channel3_IRQHandler
.word DMA2_Channel4_IRQHandler
.word DMA2_Channel5_IRQHandler
.word ETH_IRQHandler
.word ETH_WKUP_IRQHandler
.word CAN2_TX_IRQHandler
.word CAN2_RX0_IRQHandler
.word CAN2_RX1_IRQHandler
.word CAN2_SCE_IRQHandler
.word OTG_FS_IRQHandler
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word BootRAM /* @0x1E0. This is for boot in RAM mode for
STM32F10x Connectivity line Devices. */
/*******************************************************************************
*
* Provide weak aliases for each Exception handler to the Default_Handler.
* As they are weak aliases, any function with the same name will override
* this definition.
*
*******************************************************************************/
.weak NMI_Handler
.thumb_set NMI_Handler,Default_Handler
.weak HardFault_Handler
.thumb_set HardFault_Handler,Default_Handler
.weak MemManage_Handler
.thumb_set MemManage_Handler,Default_Handler
.weak BusFault_Handler
.thumb_set BusFault_Handler,Default_Handler
.weak UsageFault_Handler
.thumb_set UsageFault_Handler,Default_Handler
.weak SVC_Handler
.thumb_set SVC_Handler,Default_Handler
.weak DebugMon_Handler
.thumb_set DebugMon_Handler,Default_Handler
.weak PendSV_Handler
.thumb_set PendSV_Handler,Default_Handler
.weak SysTick_Handler
.thumb_set SysTick_Handler,Default_Handler
.weak WWDG_IRQHandler
.thumb_set WWDG_IRQHandler,Default_Handler
.weak PVD_IRQHandler
.thumb_set PVD_IRQHandler,Default_Handler
.weak TAMPER_IRQHandler
.thumb_set TAMPER_IRQHandler,Default_Handler
.weak RTC_IRQHandler
.thumb_set RTC_IRQHandler,Default_Handler
.weak FLASH_IRQHandler
.thumb_set FLASH_IRQHandler,Default_Handler
.weak RCC_IRQHandler
.thumb_set RCC_IRQHandler,Default_Handler
.weak EXTI0_IRQHandler
.thumb_set EXTI0_IRQHandler,Default_Handler
.weak EXTI1_IRQHandler
.thumb_set EXTI1_IRQHandler,Default_Handler
.weak EXTI2_IRQHandler
.thumb_set EXTI2_IRQHandler,Default_Handler
.weak EXTI3_IRQHandler
.thumb_set EXTI3_IRQHandler,Default_Handler
.weak EXTI4_IRQHandler
.thumb_set EXTI4_IRQHandler,Default_Handler
.weak DMA1_Channel1_IRQHandler
.thumb_set DMA1_Channel1_IRQHandler,Default_Handler
.weak DMA1_Channel2_IRQHandler
.thumb_set DMA1_Channel2_IRQHandler,Default_Handler
.weak DMA1_Channel3_IRQHandler
.thumb_set DMA1_Channel3_IRQHandler,Default_Handler
.weak DMA1_Channel4_IRQHandler
.thumb_set DMA1_Channel4_IRQHandler,Default_Handler
.weak DMA1_Channel5_IRQHandler
.thumb_set DMA1_Channel5_IRQHandler,Default_Handler
.weak DMA1_Channel6_IRQHandler
.thumb_set DMA1_Channel6_IRQHandler,Default_Handler
.weak DMA1_Channel7_IRQHandler
.thumb_set DMA1_Channel7_IRQHandler,Default_Handler
.weak ADC1_2_IRQHandler
.thumb_set ADC1_2_IRQHandler,Default_Handler
.weak CAN1_TX_IRQHandler
.thumb_set CAN1_TX_IRQHandler,Default_Handler
.weak CAN1_RX0_IRQHandler
.thumb_set CAN1_RX0_IRQHandler,Default_Handler
.weak CAN1_RX1_IRQHandler
.thumb_set CAN1_RX1_IRQHandler,Default_Handler
.weak CAN1_SCE_IRQHandler
.thumb_set CAN1_SCE_IRQHandler,Default_Handler
.weak EXTI9_5_IRQHandler
.thumb_set EXTI9_5_IRQHandler,Default_Handler
.weak TIM1_BRK_IRQHandler
.thumb_set TIM1_BRK_IRQHandler,Default_Handler
.weak TIM1_UP_IRQHandler
.thumb_set TIM1_UP_IRQHandler,Default_Handler
.weak TIM1_TRG_COM_IRQHandler
.thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler
.weak TIM1_CC_IRQHandler
.thumb_set TIM1_CC_IRQHandler,Default_Handler
.weak TIM2_IRQHandler
.thumb_set TIM2_IRQHandler,Default_Handler
.weak TIM3_IRQHandler
.thumb_set TIM3_IRQHandler,Default_Handler
.weak TIM4_IRQHandler
.thumb_set TIM4_IRQHandler,Default_Handler
.weak I2C1_EV_IRQHandler
.thumb_set I2C1_EV_IRQHandler,Default_Handler
.weak I2C1_ER_IRQHandler
.thumb_set I2C1_ER_IRQHandler,Default_Handler
.weak I2C2_EV_IRQHandler
.thumb_set I2C2_EV_IRQHandler,Default_Handler
.weak I2C2_ER_IRQHandler
.thumb_set I2C2_ER_IRQHandler,Default_Handler
.weak SPI1_IRQHandler
.thumb_set SPI1_IRQHandler,Default_Handler
.weak SPI2_IRQHandler
.thumb_set SPI2_IRQHandler,Default_Handler
.weak USART1_IRQHandler
.thumb_set USART1_IRQHandler,Default_Handler
.weak USART2_IRQHandler
.thumb_set USART2_IRQHandler,Default_Handler
.weak USART3_IRQHandler
.thumb_set USART3_IRQHandler,Default_Handler
.weak EXTI15_10_IRQHandler
.thumb_set EXTI15_10_IRQHandler,Default_Handler
.weak RTCAlarm_IRQHandler
.thumb_set RTCAlarm_IRQHandler,Default_Handler
.weak OTG_FS_WKUP_IRQHandler
.thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler
.weak TIM5_IRQHandler
.thumb_set TIM5_IRQHandler,Default_Handler
.weak SPI3_IRQHandler
.thumb_set SPI3_IRQHandler,Default_Handler
.weak UART4_IRQHandler
.thumb_set UART4_IRQHandler,Default_Handler
.weak UART5_IRQHandler
.thumb_set UART5_IRQHandler,Default_Handler
.weak TIM6_IRQHandler
.thumb_set TIM6_IRQHandler,Default_Handler
.weak TIM7_IRQHandler
.thumb_set TIM7_IRQHandler,Default_Handler
.weak DMA2_Channel1_IRQHandler
.thumb_set DMA2_Channel1_IRQHandler,Default_Handler
.weak DMA2_Channel2_IRQHandler
.thumb_set DMA2_Channel2_IRQHandler,Default_Handler
.weak DMA2_Channel3_IRQHandler
.thumb_set DMA2_Channel3_IRQHandler,Default_Handler
.weak DMA2_Channel4_IRQHandler
.thumb_set DMA2_Channel4_IRQHandler,Default_Handler
.weak DMA2_Channel5_IRQHandler
.thumb_set DMA2_Channel5_IRQHandler,Default_Handler
.weak ETH_IRQHandler
.thumb_set ETH_IRQHandler,Default_Handler
.weak ETH_WKUP_IRQHandler
.thumb_set ETH_WKUP_IRQHandler,Default_Handler
.weak CAN2_TX_IRQHandler
.thumb_set CAN2_TX_IRQHandler,Default_Handler
.weak CAN2_RX0_IRQHandler
.thumb_set CAN2_RX0_IRQHandler,Default_Handler
.weak CAN2_RX1_IRQHandler
.thumb_set CAN2_RX1_IRQHandler,Default_Handler
.weak CAN2_SCE_IRQHandler
.thumb_set CAN2_SCE_IRQHandler,Default_Handler
.weak OTG_FS_IRQHandler
.thumb_set OTG_FS_IRQHandler ,Default_Handler
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/