Generic STM32F103 platform
This commit is contained in:
parent
a1199721a6
commit
217eaaa071
26
platform/stm32test/Makefile
Normal file
26
platform/stm32test/Makefile
Normal file
|
@ -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
|
||||
|
35
platform/stm32test/Makefile.stm32test
Normal file
35
platform/stm32test/Makefile.stm32test
Normal file
|
@ -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
|
44
platform/stm32test/contiki-conf.h
Normal file
44
platform/stm32test/contiki-conf.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
#ifndef __CONTIKI_CONF_H__CDBB4VIH3I__
|
||||
#define __CONTIKI_CONF_H__CDBB4VIH3I__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#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__ */
|
40
platform/stm32test/contiki-main.c
Normal file
40
platform/stm32test/contiki-main.c
Normal file
|
@ -0,0 +1,40 @@
|
|||
#include <stm32f10x_map.h>
|
||||
#include <stm32f10x_dma.h>
|
||||
#include <gpio.h>
|
||||
#include <nvic.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <debug-uart.h>
|
||||
#include <sys/process.h>
|
||||
#include <sys/procinit.h>
|
||||
#include <etimer.h>
|
||||
#include <sys/autostart.h>
|
||||
#include <clock.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
2
platform/stm32test/structgen_opts.gen.h
Normal file
2
platform/stm32test/structgen_opts.gen.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
#pragma target_endian little
|
||||
#pragma max_target_int_bytes 8
|
Loading…
Reference in a new issue