Revision cca61a53

View differences:

modules/STM32F4Discovery/Makefile
1
################################################################################
2
# AMiRo-OS is an operating system designed for the Autonomous Mini Robot       #
3
# (AMiRo) platform.                                                            #
4
# Copyright (C) 2016..2019  Thomas Schöpping et al.                            #
5
#                                                                              #
6
# This program is free software: you can redistribute it and/or modify         #
7
# it under the terms of the GNU General Public License as published by         #
8
# the Free Software Foundation, either version 3 of the License, or            #
9
# (at your option) any later version.                                          #
10
#                                                                              #
11
# This program is distributed in the hope that it will be useful,              #
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of               #
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
14
# GNU General Public License for more details.                                 #
15
#                                                                              #
16
# You should have received a copy of the GNU General Public License            #
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.        #
18
#                                                                              #
19
# This research/work was supported by the Cluster of Excellence Cognitive      #
20
# Interaction Technology 'CITEC' (EXC 277) at Bielefeld University, which is   #
21
# funded by the German Research Foundation (DFG).                              #
22
################################################################################
23

  
24

  
25

  
26
################################################################################
27
# Build global options                                                         #
28
# NOTE: Can be overridden externally.                                          #
29
#                                                                              #
30

  
31
# Compiler options here.
32
ifeq ($(USE_OPT),)
33
  USE_OPT = -O2 -fomit-frame-pointer -falign-functions=16 -fstack-usage
34
endif
35

  
36
# C specific options here (added to USE_OPT).
37
ifeq ($(USE_COPT),)
38
  USE_COPT = -std=c11
39
endif
40

  
41
# C++ specific options here (added to USE_OPT).
42
ifeq ($(USE_CPPOPT),)
43
  USE_CPPOPT = -fno-rtti -std=c++17
44
endif
45

  
46
# Enable this if you want the linker to remove unused code and data
47
ifeq ($(USE_LINK_GC),)
48
  USE_LINK_GC = yes
49
endif
50

  
51
# Linker extra options here.
52
ifeq ($(USE_LDOPT),)
53
  USE_LDOPT =
54
endif
55

  
56
# Enable this if you want link time optimizations (LTO)
57
ifeq ($(USE_LTO),)
58
  USE_LTO = yes
59
endif
60

  
61
# If enabled, this option allows to compile the application in THUMB mode.
62
ifeq ($(USE_THUMB),)
63
  USE_THUMB = yes
64
endif
65

  
66
# Enable this if you want to see the full log while compiling.
67
ifeq ($(USE_VERBOSE_COMPILE),)
68
  USE_VERBOSE_COMPILE = no
69
endif
70

  
71
# If enabled, this option makes the build process faster by not compiling
72
# modules not used in the current configuration.
73
ifeq ($(USE_SMART_BUILD),)
74
  USE_SMART_BUILD = no
75
endif
76

  
77
#                                                                              #
78
# Build global options                                                         #
79
################################################################################
80

  
81
################################################################################
82
# Architecture or project specific options                                     #
83
#                                                                              #
84

  
85
# Stack size to be allocated to the Cortex-M process stack. This stack is
86
# the stack used by the main() thread.
87
ifeq ($(USE_PROCESS_STACKSIZE),)
88
  USE_PROCESS_STACKSIZE = 0x400
89
endif
90

  
91
# Stack size to the allocated to the Cortex-M main/exceptions stack. This
92
# stack is used for processing interrupts and exceptions.
93
ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
94
  USE_EXCEPTIONS_STACKSIZE = 0x400
95
endif
96

  
97
# Enables the use of FPU on Cortex-M4.
98
# Possible selections are:
99
#   no     - no FPU is used (probably equals 'soft')
100
#   soft   - does not use the FPU, thus all floating point operations are emulated
101
#   softfp - uses the FPU, but uses the integer registers only
102
#   hard   - uses the FPU and passes data via the FPU registers
103
ifeq ($(USE_FPU),)
104
  USE_FPU = softfp
105
endif
106

  
107
#                                                                              #
108
# Architecture or project specific options                                     #
109
################################################################################
110

  
111
################################################################################
112
# Project, sources and paths                                                   #
113
#                                                                              #
114

  
115
# Define project name here
116
PROJECT := $(patsubst $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))..)/%,%,$(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))))
117

  
118
# Imported source files and paths
119
include ../../kernel/kernel.mk
120
CHIBIOS := $(AMIROOS_KERNEL)
121
AMIROOS = ../..
122
# Licensing files
123
include $(CHIBIOS)/os/license/license.mk
124
# Startup files
125
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
126
# HAL-OSAL files
127
include $(CHIBIOS)/os/hal/hal.mk
128
include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
129
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
130
# RTOS files
131
include $(CHIBIOS)/os/rt/rt.mk
132
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
133
# Other files (optional).
134
include $(CHIBIOS)/test/lib/test.mk
135
include $(CHIBIOS)/test/rt/rt_test.mk
136
include $(CHIBIOS)/test/oslib/oslib_test.mk
137
# AMiRo-BLT files
138
include ../../bootloader/bootloader.mk
139
# AMiRo-LLD files
140
include ../../periphery-lld/periphery-lld.mk
141
# AMiRo-OS files
142
include ../modules.mk
143
include $(AMIROOS)/core/core.mk
144
include $(AMIROOS)/unittests/unittests.mk
145

  
146
# Define linker script file here
147
LDSCRIPT= STM32F407xG.ld
148

  
149
# C sources that can be compiled in ARM or THUMB mode depending on the global
150
# setting.
151
CSRC = $(LICSRC) \
152
       $(STARTUPSRC) \
153
       $(KERNSRC) \
154
       $(PORTSRC) \
155
       $(OSALSRC) \
156
       $(HALSRC) \
157
       $(PLATFORMSRC) \
158
       $(MODULESCSRC) \
159
       $(TESTSRC) \
160
       $(PERIPHERYLLDCSRC) \
161
       $(AMIROOSCORECSRC) \
162
       $(UNITTESTSCSRC) \
163
       $(CHIBIOS)/os/various/evtimer.c \
164
       $(CHIBIOS)/os/various/syscalls.c \
165
       $(CHIBIOS)/os/hal/lib/streams/chprintf.c \
166
       board.c \
167
       module.c \
168
       $(APPSCSRC)
169

  
170
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
171
# setting.
172
CPPSRC = $(AMIROOSCORECPPSRC) \
173
         $(CHIBIOS)/os/various/cpp_wrappers/syscalls_cpp.cpp \
174
         $(APPSCPPSRC)
175

  
176
# C sources to be compiled in ARM mode regardless of the global setting.
177
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
178
#       option that results in lower performance and larger code size.
179
ACSRC = $(APPSACSRC)
180

  
181
# C++ sources to be compiled in ARM mode regardless of the global setting.
182
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
183
#       option that results in lower performance and larger code size.
184
ACPPSRC = $(APPSACPPSRC)
185

  
186
# C sources to be compiled in THUMB mode regardless of the global setting.
187
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
188
#       option that results in lower performance and larger code size.
189
TCSRC = $(APPSTCSRC)
190

  
191
# C sources to be compiled in THUMB mode regardless of the global setting.
192
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
193
#       option that results in lower performance and larger code size.
194
TCPPSRC = $(APPSTCPPSRC)
195

  
196
# List ASM source files here
197
ASMSRC = $(APPSASMSRC)
198
ASMXSRC = $(STARTUPASM) \
199
          $(PORTASM) \
200
          $(OSALASM) \
201
          $(APPSASMXSRC)
202

  
203
INCDIR = $(LICINC) \
204
         $(STARTUPINC) \
205
         $(KERNINC) \
206
         $(PORTINC) \
207
         $(OSALINC) \
208
         $(HALINC) \
209
         $(PLATFORMINC) \
210
         $(MODULESINC) \
211
         $(TESTINC) \
212
         $(BOOTLOADERINC) \
213
         $(CHIBIOS)/os/hal/lib/streams \
214
         $(PERIPHERYLLDINC) \
215
         $(AMIROOS) \
216
         $(AMIROOSCOREINC) \
217
         $(UNITTESTSINC) \
218
         $(APPSINC)
219

  
220
#                                                                              #
221
# Project, sources and paths                                                   #
222
################################################################################
223

  
224
################################################################################
225
# Compiler settings                                                            #
226
# NOTE: Some can be overridden externally.                                     #
227
#                                                                              #
228

  
229
MCU  = cortex-m4
230

  
231
#TRGT = arm-elf-
232
TRGT = arm-none-eabi-
233
CC   = $(TRGT)gcc
234
CPPC = $(TRGT)g++
235
# Enable loading with g++ only if you need C++ runtime support.
236
# NOTE: You can use C++ even without C++ support if you are careful. C++
237
#       runtime support makes code size explode.
238
LD   = $(TRGT)gcc
239
#LD   = $(TRGT)g++
240
CP   = $(TRGT)objcopy
241
AS   = $(TRGT)gcc -x assembler-with-cpp
242
AR   = $(TRGT)ar
243
OD   = $(TRGT)objdump
244
SZ   = $(TRGT)size
245
HEX  = $(CP) -O ihex
246
BIN  = $(CP) -O binary
247
SREC = $(CP) -O srec --srec-len=248
248

  
249
# ARM-specific options here
250
ifeq ($(AOPT),)
251
  AOPT =
252
endif
253

  
254
# THUMB-specific options here
255
ifeq ($(TOPT),)
256
  TOPT = -mthumb -DTHUMB
257
endif
258

  
259
# Define C warning options here
260
ifeq ($(CWARN),)
261
  CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
262
endif
263

  
264
# Define C++ warning options here
265
ifeq ($(CPPWARN),)
266
  CPPWARN = -Wall -Wextra -Wundef
267
endif
268

  
269
#                                                                              #
270
# Compiler settings                                                            #
271
################################################################################
272

  
273
################################################################################
274
# Start of user section                                                        #
275
#                                                                              #
276

  
277
# List all user C define here, like -D_DEBUG=1
278
UDEFS +=
279

  
280
# Define ASM defines here
281
UADEFS +=
282

  
283
# List all user directories here
284
UINCDIR +=
285

  
286
# List the user directory to look for the libraries here
287
ULIBDIR +=
288

  
289
# List all user libraries here
290
ULIBS +=
291

  
292
#                                                                              #
293
# End of user defines                                                          #
294
################################################################################
295

  
296
################################################################################
297
# Start of targets section                                                     #
298
#                                                                              #
299

  
300
# all and its dependencies
301
BUILDDIR = ./build
302
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
303
include $(RULESPATH)/rules.mk
304

  
305
# flash
306
include $(AMIROOS)/bootloader/bootloader.mk
307

  
308
flash: $(BUILDDIR)/$(PROJECT).elf
309
	openocd -f interface/stlink-v2-1.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x.cfg -c "program build/$(PROJECT).elf verify reset exit"
310

  
311
#                                                                              #
312
# End of targets section                                                       #
313
################################################################################
314

  
modules/STM32F4Discovery/STM32F407xG.ld
1
/*
2
    ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3

  
4
    Licensed under the Apache License, Version 2.0 (the "License");
5
    you may not use this file except in compliance with the License.
6
    You may obtain a copy of the License at
7

  
8
        http://www.apache.org/licenses/LICENSE-2.0
9

  
10
    Unless required by applicable law or agreed to in writing, software
11
    distributed under the License is distributed on an "AS IS" BASIS,
12
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
    See the License for the specific language governing permissions and
14
    limitations under the License.
15
*/
16

  
17
/*
18
 * STM32F407xG memory setup.
19
 * Note: Use of ram1 and ram2 is mutually exclusive with use of ram0.
20
 */
21
MEMORY
22
{
23
    flash0  : org = 0x08000000, len = 1M
24
    flash1  : org = 0x00000000, len = 0
25
    flash2  : org = 0x00000000, len = 0
26
    flash3  : org = 0x00000000, len = 0
27
    flash4  : org = 0x00000000, len = 0
28
    flash5  : org = 0x00000000, len = 0
29
    flash6  : org = 0x00000000, len = 0
30
    flash7  : org = 0x00000000, len = 0
31
    ram0    : org = 0x20000000, len = 128k      /* SRAM1 + SRAM2 */
32
    ram1    : org = 0x20000000, len = 112k      /* SRAM1 */
33
    ram2    : org = 0x2001C000, len = 16k       /* SRAM2 */
34
    ram3    : org = 0x00000000, len = 0
35
    ram4    : org = 0x10000000, len = 64k       /* CCM SRAM */
36
    ram5    : org = 0x40024000, len = 4k        /* BCKP SRAM */
37
    ram6    : org = 0x00000000, len = 0
38
    ram7    : org = 0x00000000, len = 0
39
}
40

  
41
/* For each data/text section two region are defined, a virtual region
42
   and a load region (_LMA suffix).*/
43

  
44
/* Flash region to be used for exception vectors.*/
45
REGION_ALIAS("VECTORS_FLASH", flash0);
46
REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
47

  
48
/* Flash region to be used for constructors and destructors.*/
49
REGION_ALIAS("XTORS_FLASH", flash0);
50
REGION_ALIAS("XTORS_FLASH_LMA", flash0);
51

  
52
/* Flash region to be used for code text.*/
53
REGION_ALIAS("TEXT_FLASH", flash0);
54
REGION_ALIAS("TEXT_FLASH_LMA", flash0);
55

  
56
/* Flash region to be used for read only data.*/
57
REGION_ALIAS("RODATA_FLASH", flash0);
58
REGION_ALIAS("RODATA_FLASH_LMA", flash0);
59

  
60
/* Flash region to be used for various.*/
61
REGION_ALIAS("VARIOUS_FLASH", flash0);
62
REGION_ALIAS("VARIOUS_FLASH_LMA", flash0);
63

  
64
/* Flash region to be used for RAM(n) initialization data.*/
65
REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0);
66

  
67
/* RAM region to be used for Main stack. This stack accommodates the processing
68
   of all exceptions and interrupts.*/
69
REGION_ALIAS("MAIN_STACK_RAM", ram0);
70

  
71
/* RAM region to be used for the process stack. This is the stack used by
72
   the main() function.*/
73
REGION_ALIAS("PROCESS_STACK_RAM", ram0);
74

  
75
/* RAM region to be used for data segment.*/
76
REGION_ALIAS("DATA_RAM", ram0);
77
REGION_ALIAS("DATA_RAM_LMA", flash0);
78

  
79
/* RAM region to be used for BSS segment.*/
80
REGION_ALIAS("BSS_RAM", ram0);
81

  
82
/* RAM region to be used for the default heap.*/
83
REGION_ALIAS("HEAP_RAM", ram0);
84

  
85
/* Generic rules inclusion.*/
86
INCLUDE rules.ld
modules/STM32F4Discovery/alldconf.h
1
/*
2
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14

  
15
You should have received a copy of the GNU General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file
21
 * @brief   AMiRo-LLD configuration file for the PowerManagement v1.1 module.
22
 * @details Contains the application specific AMiRo-LLD settings.
23
 *
24
 * @addtogroup powermanagement_lld_config
25
 * @{
26
 */
27

  
28
#ifndef _ALLDCONF_H_
29
#define _ALLDCONF_H_
30

  
31
/*
32
 * compatibility guards
33
 */
34
#define _AMIRO_LLD_CFG_
35
#define AMIRO_LLD_CFG_VERSION_MAJOR         1
36
#define AMIRO_LLD_CFG_VERSION_MINOR         0
37

  
38
/**
39
 * @brief   Width of the apalTime_t data type.
40
 *
41
 * @details Possible values are 8, 16, 32, and 64 bits.
42
 *          By definition time is represented at microsecond precision.
43
 */
44
#define AMIROLLD_CFG_TIME_SIZE          32
45

  
46
#endif /* _ALLDCONF_H_ */
47

  
48
/** @} */
modules/STM32F4Discovery/aosconf.h
1
/*
2
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of