diff --git a/platform/stm32test/Makefile b/platform/stm32test/Makefile new file mode 100644 index 000000000..5bb618eec --- /dev/null +++ b/platform/stm32test/Makefile @@ -0,0 +1,26 @@ +TARGET=stm32test + +all: stm32tst + + +CONTIKI=../.. + +CONTIKI_TARGET_MAIN=contiki-main.c + +PROJECT_SOURCEFILES = parity.c + + +randgen: randgen.c + gcc -DNDEBUG -I $(CONTIKI)/cpu/arm/stm32f103/ -I . -I $(CONTIKI)/core randgen.c -o randgen + +randcheck: randcheck.c + gcc -DNDEBUG -I $(CONTIKI)/cpu/arm/stm32f103/ -I . -I $(CONTIKI)/core randcheck.c -o randcheck + +clean: stm32test_clean + +.PHONY: stm32test_clean + +stm32test_clean: + +include $(CONTIKI)/Makefile.include + diff --git a/platform/stm32test/Makefile.stm32test b/platform/stm32test/Makefile.stm32test new file mode 100644 index 000000000..8f003a200 --- /dev/null +++ b/platform/stm32test/Makefile.stm32test @@ -0,0 +1,35 @@ +STM32TEST = + +#CODEPROP_SOURCES = codeprop-otf.c ram-segments.c + +CONTIKI_TARGET_DIRS = . +# Master clock frequency +MCK=48000000 +CFLAGS+=-DAUTOSTART_ENABLE + +ifndef CONTIKI_TARGET_MAIN +CONTIKI_TARGET_MAIN = contiki-main.c +endif + +CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(STEPPER_ROBOT) \ + $(CODEPROP_SOURCES) $(CONTIKI_TARGET_MAIN) + +# include $(CONTIKI)/platform/$(TARGET)/apps/Makefile.apps + +include $(CONTIKI)/cpu/arm/stm32f103/Makefile.stm32f103 + +#contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} + +ifndef BASE_IP +BASE_IP := 172.16.1.1 +endif + +### System dependent Makefile + +ifndef WINDIR + ifdef OS + ifneq (,$(findstring Windows,$(OS))) + WINDIR := Windows + endif + endif +endif diff --git a/platform/stm32test/contiki-conf.h b/platform/stm32test/contiki-conf.h new file mode 100644 index 000000000..b68fbd551 --- /dev/null +++ b/platform/stm32test/contiki-conf.h @@ -0,0 +1,44 @@ +#ifndef __CONTIKI_CONF_H__CDBB4VIH3I__ +#define __CONTIKI_CONF_H__CDBB4VIH3I__ + +#include + +#define CCIF +#define CLIF + +#define WITH_UIP 1 +#define WITH_ASCII 1 + +#define CLOCK_CONF_SECOND 100 +typedef uint8_t u8_t; +typedef uint16_t u16_t; +typedef uint32_t u32_t; +typedef int8_t s8_t; +typedef int16_t s16_t; +typedef int32_t s32_t; + +typedef unsigned int clock_time_t; +typedef unsigned int uip_stats_t; + +#ifndef BV +#define BV(x) (1<<(x)) +#endif + +/* uIP configuration */ +#define UIP_CONF_LLH_LEN 0 +#define UIP_CONF_BROADCAST 1 +#define UIP_CONF_LOGGING 1 +#define UIP_CONF_BUFFER_SIZE 116 + +#define UIP_CONF_TCP_FORWARD 1 + +/* Prefix for relocation sections in ELF files */ +#define REL_SECT_PREFIX ".rel" + +#define CC_BYTE_ALIGNED __attribute__ ((packed, aligned(1))) + +#define USB_EP1_SIZE 64 +#define USB_EP2_SIZE 64 + +#define RAND_MAX 0x7fff +#endif /* __CONTIKI_CONF_H__CDBB4VIH3I__ */ diff --git a/platform/stm32test/contiki-main.c b/platform/stm32test/contiki-main.c new file mode 100644 index 000000000..015a4d730 --- /dev/null +++ b/platform/stm32test/contiki-main.c @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +unsigned int idle_count = 0; + +int +main() +{ + dbg_setup_uart(); + printf("Initialising\n"); + + clock_init(); + process_init(); + process_start(&etimer_process, NULL); + autostart_start(autostart_processes); + printf("Processes running\n"); + while(1) { + do { + } while(process_run() > 0); + idle_count++; + /* Idle! */ + /* Stop processor clock */ + /* asm("wfi"::); */ + } + return 0; +} + + + + diff --git a/platform/stm32test/structgen_opts.gen.h b/platform/stm32test/structgen_opts.gen.h new file mode 100644 index 000000000..f0a459008 --- /dev/null +++ b/platform/stm32test/structgen_opts.gen.h @@ -0,0 +1,2 @@ +#pragma target_endian little +#pragma max_target_int_bytes 8