Revision b010278f

View differences:

modules/PowerManagement_1-1/alldconf.h
60 60
 * @brief   Enable flag for the BQ27500 fuel gauge.
61 61
 */
62 62
#define AMIROLLD_CFG_BQ27500                    1
63
#define BQ27500_LLD_HWVERSION                   120
63 64

  
64 65
/**
65 66
 * @brief   Enable flag for the INA219 power monitor.
modules/PowerManagement_1-2/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 -fstack-usage
34
endif
35

  
36
# C specific options here (added to USE_OPT).
37
ifeq ($(USE_COPT),)
38
  USE_COPT = -std=c17
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
# Enable this if you want to see the full log while compiling.
62
ifeq ($(USE_VERBOSE_COMPILE),)
63
  USE_VERBOSE_COMPILE = no
64
endif
65

  
66
# If enabled, this option makes the build process faster by not compiling
67
# modules not used in the current configuration.
68
ifeq ($(USE_SMART_BUILD),)
69
  USE_SMART_BUILD = no
70
endif
71

  
72
#                                                                              #
73
# Build global options                                                         #
74
################################################################################
75

  
76
################################################################################
77
# Architecture or project specific options                                     #
78
#                                                                              #
79

  
80
# Stack size to be allocated to the Cortex-M process stack. This stack is
81
# the stack used by the main() thread.
82
ifeq ($(USE_PROCESS_STACKSIZE),)
83
  USE_PROCESS_STACKSIZE = 0x400
84
endif
85

  
86
# Stack size to the allocated to the Cortex-M main/exceptions stack. This
87
# stack is used for processing interrupts and exceptions.
88
ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
89
  USE_EXCEPTIONS_STACKSIZE = 0x400
90
endif
91

  
92
# Enables the use of FPU.
93
# Possible selections are:
94
#   no     - no FPU is used (probably equals 'soft')
95
#   soft   - does not use the FPU, thus all floating point operations are emulated
96
#   softfp - uses the FPU, but uses the integer registers only
97
#   hard   - uses the FPU and passes data via the FPU registers
98
ifeq ($(USE_FPU),)
99
  USE_FPU = softfp
100
endif
101

  
102
# FPU-related options.
103
ifeq ($(USE_FPU_OPT),)
104
  USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16
105
endif
106

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

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

  
115
# Absolute path to the project
116
PROJECT_PATH := $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
117

  
118
# Define project name here
119
PROJECT := $(patsubst $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))..)/%,%,$(PROJECT_PATH))
120

  
121
# Target settings.
122
MCU = cortex-m4
123

  
124
# Imported source files and paths.
125
include ../../kernel/kernel.mk
126
CHIBIOS    := $(AMIROOS_KERNEL)
127
CONFDIR    := .
128
ifeq ($(BUILDDIR),)
129
  BUILDDIR := $(PROJECT_PATH)/build
130
endif
131
DEPDIR     := $(dir $(BUILDDIR)).dep
132
AMIROOS    := ../..
133
# Licensing files.
134
include $(CHIBIOS)/os/license/license.mk
135
# Startup files.
136
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk
137
# HAL-OSAL files (optional).
138
include $(CHIBIOS)/os/hal/hal.mk
139
include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk
140
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
141
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
142
# RTOS files (optional).
143
include $(CHIBIOS)/os/rt/rt.mk
144
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
145
# Auto-build files in ./source recursively.
146
include $(CHIBIOS)/tools/mk/autobuild.mk
147
# Other files (optional).
148
include $(CHIBIOS)/test/lib/test.mk
149
include $(CHIBIOS)/test/rt/rt_test.mk
150
include $(CHIBIOS)/test/oslib/oslib_test.mk
151
# AMiRo-BLT files
152
include ../../bootloader/bootloader.mk
153
# AMiRo-LLD files
154
include ../../periphery-lld/periphery-lld.mk
155
# AMiRo-OS files
156
include ../modules.mk
157
include $(AMIROOS)/core/core.mk
158
include $(AMIROOS)/unittests/unittests.mk
159

  
160
# Define linker script file here
161
LDSCRIPT= STM32F405xG.ld
162

  
163
# C sources that can be compiled in ARM or THUMB mode depending on the global
164
# setting.
165
CSRC = $(ALLCSRC) \
166
       $(CHIBIOS)/os/various/syscalls.c \
167
       $(CHIBIOS)/os/various/evtimer.c \
168
       $(TESTSRC) \
169
       board.c \
170
       $(PERIPHERYLLDCSRC) \
171
       $(UNITTESTSCSRC) \
172
       $(AMIROOSCORECSRC) \
173
       $(MODULESCSRC) \
174
       module.c \
175
       $(APPSCSRC)
176

  
177
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
178
# setting.
179
CPPSRC = $(ALLCPPSRC) \
180
         $(CHIBIOS)/os/various/cpp_wrappers/syscalls_cpp.cpp \
181
         $(AMIROOSCORECPPSRC) \
182
         $(APPSCPPSRC)
183

  
184
# List ASM source files here.
185
ASMSRC = $(ALLASMSRC) \
186
         $(APPSASMSRC)
187

  
188
# List ASM with preprocessor source files here.
189
ASMXSRC = $(ALLXASMSRC) \
190
          $(APPSASMXSRC)
191

  
192
# Inclusion directories.
193
INCDIR = $(CONFDIR) \
194
         $(ALLINC) \
195
         $(TESTINC) \
196
         $(CHIBIOS)/os/hal/lib/streams \
197
         $(BOOTLOADERINC) \
198
         $(PERIPHERYLLDINC) \
199
         $(AMIROOS) \
200
         $(UNITTESTSINC) \
201
         $(AMIROOSCOREINC) \
202
         $(MODULESINC) \
203
         $(APPSINC)
204

  
205
# Define C warning options here.
206
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes
207

  
208
# Define C++ warning options here.
209
CPPWARN = -Wall -Wextra -Wundef
210

  
211
# Create an additional .srec image file.
212
SREC = $(CP) -O srec --srec-len=248
213

  
214
#                                                                              #
215
# Project, target, sources and paths                                           #
216
################################################################################
217

  
218
################################################################################
219
# Start of user section                                                        #
220
#                                                                              #
221

  
222
# List all user C define here, like -D_DEBUG=1
223
UDEFS +=
224

  
225
# Define ASM defines here
226
UADEFS +=
227

  
228
# List all user directories here
229
UINCDIR +=
230

  
231
# List the user directory to look for the libraries here
232
ULIBDIR +=
233

  
234
# List all user libraries here
235
ULIBS +=
236

  
237
#                                                                              #
238
# End of user section                                                          #
239
################################################################################
240

  
241
################################################################################
242
# Common rules                                                                 #
243
#                                                                              #
244

  
245
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
246
include $(RULESPATH)/arm-none-eabi.mk
247
include $(RULESPATH)/rules.mk
248

  
249
#                                                                              #
250
# Common rules                                                                 #
251
################################################################################
252

  
253
################################################################################
254
# Custom rules                                                                 #
255
#                                                                              #
256

  
257
FLASH_MODULES = $(PROJECT)
258
FLASH_FILES = $(BUILDDIR)/$(PROJECT).$(FLASHTOOL_EXT)
259

  
260
flash: $(FLASH_FILES)
261
	$(info )
262
ifeq ($(FLASHTOOL),SerialBoot)
263
	$(info Flashing ($(FLASHTOOL)):)
264
	$(FLASHTOOL_CMD) $(FLASHTOOL_ARGS)
265
else
266
	$(info ERROR: unable to flash the module (SerialBoot unavailable))
267
endif
268

  
269
#                                                                              #
270
# Custom rules                                                                 #
271
################################################################################
272

  
modules/PowerManagement_1-2/STM32F405xG.ld
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
 * STM32F405xG memory setup.
21
 * Note: Use of ram1 and ram2 is mutually exclusive with use of ram0.
22
 */
23
MEMORY
24
{
25
    flash0  : org = 0x08008000, len = 1M-32k
26
    flash1  : org = 0x00000000, len = 0
27
    flash2  : org = 0x00000000, len = 0
28
    flash3  : org = 0x00000000, len = 0
29
    flash4  : org = 0x00000000, len = 0
30
    flash5  : org = 0x00000000, len = 0
31
    flash6  : org = 0x00000000, len = 0
32
    flash7  : org = 0x00000000, len = 0
33
    ram0    : org = 0x20000000, len = 128k      /* SRAM1 + SRAM2 */
34
    ram1    : org = 0x20000000, len = 112k      /* SRAM1 */
35
    ram2    : org = 0x2001C000, len = 16k       /* SRAM2 */
36
    ram3    : org = 0x00000000, len = 0
37
    ram4    : org = 0x10000000, len = 64k       /* CCM SRAM */
38
    ram5    : org = 0x40024000, len = 4k        /* BCKP SRAM */
39
    ram6    : org = 0x00000000, len = 0
40
    ram7    : org = 0x00000000, len = 0
41
}
42

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

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

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

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

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

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

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

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

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

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

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

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

  
87
/* Generic rules inclusion.*/
88
INCLUDE rules.ld
modules/PowerManagement_1-2/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.2 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
// required to differentiate between various sensor rings
47
#include <board.h>
48

  
49
/**
50
 * @brief   Enable flag for the AT24C01BN-SH-B EEPROM.
51
 */
52
#define AMIROLLD_CFG_AT24C01B                   1
53

  
54
/**
55
 * @brief   Enable flag for the BQ24103A charger.
56
 */
57
#define AMIROLLD_CFG_BQ241xx                    1
58

  
59
/**
60
 * @brief   Enable flag for the BQ27500 fuel gauge.
61
 */
62
#define AMIROLLD_CFG_BQ27500                    1
63
#define BQ27500_LLD_HWVERSION                   130
64

  
65
/**
66
 * @brief   Enable flag for the INA219 power monitor.
67
 */
68
#define AMIROLLD_CFG_INA219                     1
69

  
70
/**
71
 * @brief   Enable flag for the status LED.
72
 */
73
#define AMIROLLD_CFG_LED                        1
74

  
75
/**
76
 * @brief   Enable flag for the PKLCS1212E4001 buzzer.
77
 */
78
#define AMIROLLD_CFG_PKxxxExxx                  1
79
#define PKxxxExxx_LLD_FREQUENCY_MIN             2000
80
#define PKxxxExxx_LLD_FREQUENCY_SPEC            4000
81
#define PKxxxExxx_LLD_FREQUENCY_MAX             6000
82

  
83
/**
84
 * @brief   Enable flag for the TPS2051BDBV power switch.
85
 */
86
#define AMIROLLD_CFG_TPS20xxB                   1
87

  
88
/**
89
 * @brief   Enable flag for the TPS62113 step-down converter.
90
 */
91
#define AMIROLLD_CFG_TPS6211x                   1
92

  
93
#if (BOARD_SENSORRING == BOARD_PROXIMITYSENSOR) || defined(__DOXYGEN__)
94

  
95
/**
96
 * @brief   Enable flag for the MPR121 touch sensor.
97
 */
98
#define A