Commit 2f04c670 authored by Peter Wägemann's avatar Peter Wägemann
Browse files

Make entry and init function configurable per preprocessor flag

parent 3b792997
......@@ -28,7 +28,7 @@ STACK_SIZE?=16384
JLINK = JLinkExe
JLFLAGS = -device XMC4500-1024 -if SWD -speed 900
CFLAGS = -target armv6m--none-eabi -mcpu=cortex-m4 -mthumb -integrated-as -ccc-gcc-name arm-none-eabi-gcc
CFLAGS = -target armv6m--none-eabi -mcpu=cortex-m4 -mthumb -integrated-as -ccc-gcc-name arm-none-eabi-gcc
CFLAGS+= -fno-builtin
CFLAGS+= -Os -ffunction-sections -fdata-sections
CFLAGS+= -MD -std=c99 -Wall
......@@ -36,6 +36,7 @@ CFLAGS+= -DUC_ID=$(UC_ID) -DARM_MATH_CM4 -DINTERRUPT_CONTROL_ENDPOINT
CFLAGS+= -DXMC4500_F100x1024
CFLAGS+= -I$(CMSIS)/Include -I$(CMSIS)/Infineon/$(UC)_series/Include
CFLAGS+= -Ilib/LUFA -I$(XMC)/XMCLib/inc
CFLAGS += $(CFLAGS_GENE)
ASFLAGS = -target armv6m--none-eabi -mcpu=cortex-m4 -marm -mthumb
ASFLAGS+= -O0 -ffunction-sections -fdata-sections
......
......@@ -22,6 +22,28 @@
#define SERIALSTR "<none>"
#endif
#define VOID_ARG_TYPE 1
#define UINT32_ARG_TYPE 2
#ifndef BENCHMARK_MAIN
#if defined(BENCHMARK_ARG) || defined(BENCHMARK_INIT)
#error BENCHMARK_MAIN, BENCHMARK_ARG, BENCHMARK_INIT must be defined
#endif
#define BENCHMARK_MAIN gene_main
#define BENCHMARK_ARG uint32_t
#define ARG_TYPE UINT32_ARG_TYPE
#define BENCHMARK_INIT gene_init
#endif
// use void as default
#ifndef BENCHMARK_ARG
#define ARG_TYPE VOID_ARG_TYPE
#define BENCHMARK_ARG void
#endif
void BENCHMARK_MAIN(BENCHMARK_ARG);
void BENCHMARK_INIT(void);
extern int errno;
void _init() {}
......@@ -58,10 +80,6 @@ void SystemCoreClockSetup(void)
SystemCoreClockUpdate();
}
void gene_main(uint32_t);
void gene_init(void);
/*** Begin: Interrupt Handlers ***/
IHANDLER void PendSV_Handler() { P1_1_set(); while(1) {} }
IHANDLER void SysTick_Handler() { P1_1_set(); while(1) {} }
......@@ -126,7 +144,7 @@ static void command_bch(char *arg) {
uint32_t old_basepri = __get_BASEPRI();
__set_BASEPRI(1 << (8 - __NVIC_PRIO_BITS));
gene_init();
BENCHMARK_INIT();
// flush instruction cache prior to executing the benchmark to
// ensure a "clean" system state
......@@ -136,7 +154,11 @@ static void command_bch(char *arg) {
P5_7_set();
timer_start();
gene_main(val);
#if ARG_TYPE == VOID_ARG_TYPE
BENCHMARK_MAIN();
#else
BENCHMARK_MAIN(val);
#endif
timer_stop();
P5_7_reset();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment