Revision 4c72a54c
| amiroos.h | ||
|---|---|---|
| 90 | 90 |
#include "core/inc/aos_shell.h" |
| 91 | 91 |
#include "core/inc/aos_system.h" |
| 92 | 92 |
#include "core/inc/aos_thread.h" |
| 93 |
#include "core/inc/aos_unittest.h"
|
|
| 93 |
#include "core/inc/aos_test.h" |
|
| 94 | 94 |
|
| 95 | 95 |
/* module specifications */ |
| 96 | 96 |
#include <module.h> |
| amiroos.mk | ||
|---|---|---|
| 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 |
# absolute path to this directory |
|
| 27 |
AMIROOS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) |
|
| 28 |
|
|
| 29 |
# set AMiRo-OS path variable |
|
| 30 |
AMIROOS := $(AMIROOS_DIR:/=) |
|
| 31 |
|
|
| 32 |
# load bootloader files |
|
| 33 |
include $(AMIROOS)/bootloader/bootloader.mk |
|
| 34 |
|
|
| 35 |
# load kernel files |
|
| 36 |
include $(AMIROOS)/kernel/kernel.mk |
|
| 37 |
|
|
| 38 |
# load peryphery LLD files |
|
| 39 |
include $(AMIROOS)/periphery-lld/periphery-lld.mk |
|
| 40 |
|
|
| 41 |
# load AMiRo-OS files |
|
| 42 |
include $(AMIROOS)/modules/modules.mk |
|
| 43 |
include $(AMIROOS)/core/core.mk |
|
| 44 |
include $(AMIROOS)/test/test.mk |
|
| 45 |
|
|
| 46 |
# inclusion directories |
|
| 47 |
AMIROOS_INC = $(CONFDIR) \ |
|
| 48 |
$(AMIROOS) \ |
|
| 49 |
$(AMIROOS_BOOTLOADER_INC) \ |
|
| 50 |
$(AMIROOS_KERNEL_INC) \ |
|
| 51 |
$(AMIROOS_PERIPHERYLLD_INC) \ |
|
| 52 |
$(AMIROOS_MODULES_INC) \ |
|
| 53 |
$(AMIROOS_CORE_INC) \ |
|
| 54 |
$(AMIROOS_TEST_INC) \ |
|
| 55 |
$(MODULE_INC) \ |
|
| 56 |
$(APPS_INC) |
|
| 57 |
|
|
| 58 |
# C sources that can be compiled in ARM or THUMB mode depending on the global setting |
|
| 59 |
AMIROOS_CSRC = $(AMIROOS_BOOTLOADER_CSRC) \ |
|
| 60 |
$(AMIROOS_KERNEL_CSRC) \ |
|
| 61 |
$(AMIROOS_PERIPHERYLLD_CSRC) \ |
|
| 62 |
$(AMIROOS_MODULES_CSRC) \ |
|
| 63 |
$(AMIROOS_CORE_CSRC) \ |
|
| 64 |
$(AMIROOS_TEST_CSRC) \ |
|
| 65 |
$(MODULE_CSRC) \ |
|
| 66 |
$(APPS_CSRC) |
|
| 67 |
|
|
| 68 |
# C++ sources that can be compiled in ARM or THUMB mode depending on the global setting |
|
| 69 |
AMIROOS_CPPSRC = $(AMIROOS_BOOTLOADER_CPPSRC) \ |
|
| 70 |
$(AMIROOS_KERNEL_CPPSRC) \ |
|
| 71 |
$(AMIROOS_PERIPHERYLLD_CPPSRC) \ |
|
| 72 |
$(AMIROOS_MODULES_CPPSRC) \ |
|
| 73 |
$(AMIROOS_CORE_CPPSRC) \ |
|
| 74 |
$(AMIROOS_TEST_CPPSRC) \ |
|
| 75 |
$(MODULE_CPPSRC) \ |
|
| 76 |
$(APPS_CPPSRC) |
|
| 77 |
|
|
| 78 |
# ASM source files |
|
| 79 |
AMIROOS_ASMSRC = $(AMIROOS_BOOTLOADER_ASMSRC) \ |
|
| 80 |
$(AMIROOS_KERNEL_ASMSRC) \ |
|
| 81 |
$(AMIROOS_PERIPHERYLLD_ASMSRC) \ |
|
| 82 |
$(AMIROOS_MODULES_ASMSRC) \ |
|
| 83 |
$(AMIROOS_CORE_ASMSRC) \ |
|
| 84 |
$(AMIROOS_TEST_ASMSRC) \ |
|
| 85 |
$(MODULE_ASMSRC) \ |
|
| 86 |
$(APPS_ASMSRC) |
|
| 87 |
|
|
| 88 |
# ASM with preprocessor source files here |
|
| 89 |
AMIROOS_ASMXSRC = $(AMIROOS_BOOTLOADER_ASMXSRC) \ |
|
| 90 |
$(AMIROOS_KERNEL_ASMXSRC) \ |
|
| 91 |
$(AMIROOS_PERIPHERYLLD_ASMXSRC) \ |
|
| 92 |
$(AMIROOS_MODULES_ASMXSRC) \ |
|
| 93 |
$(AMIROOS_CORE_ASMXSRC) \ |
|
| 94 |
$(AMIROOS_TEST_ASMXSRC) \ |
|
| 95 |
$(MODULE_ASMXSRC) \ |
|
| 96 |
$(APPS_ASMXSRC) |
|
| 97 |
|
|
| bootloader/AMiRo-BLT | ||
|---|---|---|
| 1 |
Subproject commit e687187fa4dbbfab6c4abfb180dfaf8f3829dfa6 |
|
| 1 |
Subproject commit 591c0fd3a0677d69b3e1c89fa9e202797cb04a36 |
|
| bootloader/bootloader.mk | ||
|---|---|---|
| 24 | 24 |
|
| 25 | 25 |
|
| 26 | 26 |
# the path to this makefile |
| 27 |
BOOTLOADER_DIR := $(dir $(lastword $(MAKEFILE_LIST))) |
|
| 27 |
AMIROOS_BOOTLOADER_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
|
| 28 | 28 |
|
| 29 |
# the interface for the bootloader
|
|
| 30 |
BOOTLOADERINC = $(BOOTLOADER_DIR)AMiRo-BLT/Target/Source/AMiRo
|
|
| 29 |
# set AMiRo-BLT path variable
|
|
| 30 |
AMIROBLT := $(AMIROOS_BOOTLOADER_DIR)AMiRo-BLT
|
|
| 31 | 31 |
|
| 32 |
include $(BOOTLOADER_DIR)AMiRo-BLT/Target/Modules/moduleids.mk |
|
| 32 |
# include paths |
|
| 33 |
AMIROOS_BOOTLOADER_INC = $(AMIROBLT)/Target/Source/AMiRo |
|
| 34 |
|
|
| 35 |
# load module ID constants |
|
| 36 |
include $(AMIROBLT)/Target/Modules/moduleids.mk |
|
| 33 | 37 |
|
| 34 | 38 |
# some flashing parameters |
| 35 | 39 |
ifeq ($(OS),Windows_NT) |
| ... | ... | |
| 52 | 56 |
FLASH_BAUDRATE ?= 115200 |
| 53 | 57 |
|
| 54 | 58 |
# set the flashing tool, the command to call it, arguments, and file extensions |
| 55 |
ifneq ($(wildcard $(BOOTLOADER_DIR)AMiRo-BLT/Host/Source/SerialBoot/build/SerialBoot),)
|
|
| 59 |
ifneq ($(wildcard $(AMIROBLT)/Host/Source/SerialBoot/build/SerialBoot),)
|
|
| 56 | 60 |
# if AMiRo-BLT project is available, use SerialBoot |
| 57 |
FLASHTOOL = SerialBoot |
|
| 58 |
FLASHTOOL_CMD = $(BOOTLOADER_DIR)AMiRo-BLT/Host/Source/SerialBoot/build/SerialBoot
|
|
| 59 |
FLASHTOOL_EXT = srec |
|
| 61 |
FLASHTOOL := SerialBoot
|
|
| 62 |
FLASHTOOL_CMD := $(AMIROBLT)/Host/Source/SerialBoot/build/SerialBoot
|
|
| 63 |
FLASHTOOL_EXT := srec
|
|
| 60 | 64 |
FLASHTOOL_ARGS = -d$(FLASH_PORT) -b$(FLASH_BAUDRATE) $(foreach module,$(FLASH_MODULES),-T$($(module)_ID_HEX) $(BUILDDIR)/$(module).$(FLASHTOOL_EXT)) |
| 61 | 65 |
else |
| 62 | 66 |
# the default tool to use is stm32flash |
| 63 | 67 |
ifneq ($(words $(FLASH_MODULES)),1) |
| 64 | 68 |
FLASH_MODULES := $(firstword $(FLASH_MODULES)) |
| 65 | 69 |
endif |
| 66 |
FLASHTOOL = stm32flash |
|
| 67 |
FLASHTOOL_CMD = stm32flash |
|
| 68 |
FLASHTOOL_EXT = hex |
|
| 70 |
FLASHTOOL := stm32flash
|
|
| 71 |
FLASHTOOL_CMD := stm32flash
|
|
| 72 |
FLASHTOOL_EXT := hex
|
|
| 69 | 73 |
FLASHTOOL_ARGS = $(FLASH_PORT) -i "rts,-dtr,-rts":"rts,dtr,-rts" -R -b $(FLASH_BAUDRATE) -w $(BUILDDIR)/$(FLASH_MODULES).$(FLASHTOOL_EXT) |
| 70 | 74 |
endif |
| 71 | 75 |
|
| core/core.mk | ||
|---|---|---|
| 27 | 27 |
AMIROOS_CORE_DIR := $(dir $(lastword $(MAKEFILE_LIST))) |
| 28 | 28 |
|
| 29 | 29 |
# include paths |
| 30 |
AMIROOSCOREINC = $(AMIROOS_CORE_DIR)inc
|
|
| 30 |
AMIROOS_CORE_INC = $(AMIROOS_CORE_DIR)inc
|
|
| 31 | 31 |
|
| 32 | 32 |
# C source files |
| 33 |
AMIROOSCORECSRC = $(wildcard $(AMIROOS_CORE_DIR)src/*.c)
|
|
| 33 |
AMIROOS_CORE_CSRC = $(wildcard $(AMIROOS_CORE_DIR)src/*.[Cc])
|
|
| 34 | 34 |
|
| 35 | 35 |
# C++ source files |
| 36 |
AMIROOSCORECPPSRC = $(wildcard $(AMIROOS_CORE_DIR)src/*.c?*)
|
|
| 36 |
AMIROOS_CORE_CPPSRC = $(wildcard $(AMIROOS_CORE_DIR)src/*.[Cc]?*)
|
|
| 37 | 37 |
|
| core/inc/aos_shell.h | ||
|---|---|---|
| 195 | 195 |
|
| 196 | 196 |
/** |
| 197 | 197 |
* @brief Shell command calback type. |
| 198 |
* |
|
| 199 |
* @param[in] stream Stream to print to. |
|
| 200 |
* @param[in] argc Number of arguments. |
|
| 201 |
* @param[in] argv List of arguments. |
|
| 198 | 202 |
*/ |
| 199 | 203 |
typedef int (*aos_shellcmdcb_t)(BaseSequentialStream* stream, int argc, char* argv[]); |
| 200 | 204 |
|
| ... | ... | |
| 373 | 377 |
/* MACROS */ |
| 374 | 378 |
/******************************************************************************/ |
| 375 | 379 |
|
| 380 |
/** |
|
| 381 |
* @brief Initializes a shell command object. |
|
| 382 |
* |
|
| 383 |
* @param[in] var Name of the object variable to be initialized. |
|
| 384 |
* @param[in] name Shell command name. |
|
| 385 |
* @param[in] callback Pointer to the callback function. |
|
| 386 |
*/ |
|
| 387 |
#define AOS_SHELL_COMMAND(var, name, callback) aos_shellcommand_t var = { \
|
|
| 388 |
/* name */ name, \ |
|
| 389 |
/* callback */ callback, \ |
|
| 390 |
/* next */ NULL, \ |
|
| 391 |
} |
|
| 392 |
|
|
| 376 | 393 |
/******************************************************************************/ |
| 377 | 394 |
/* EXTERN DECLARATIONS */ |
| 378 | 395 |
/******************************************************************************/ |
| core/inc/aos_test.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 aos_test.h |
|
| 21 |
* @brief Test structures and interfaces. |
|
| 22 |
* |
|
| 23 |
* @addtogroup aos_unittests |
|
| 24 |
* @{
|
|
| 25 |
*/ |
|
| 26 |
|
|
| 27 |
#ifndef AMIROOS_TEST_H |
|
| 28 |
#define AMIROOS_TEST_H |
|
| 29 |
|
|
| 30 |
#include <amiroos.h> |
|
| 31 |
|
|
| 32 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
|
| 33 |
|
|
| 34 |
/******************************************************************************/ |
|
| 35 |
/* CONSTANTS */ |
|
| 36 |
/******************************************************************************/ |
|
| 37 |
|
|
| 38 |
/******************************************************************************/ |
|
| 39 |
/* SETTINGS */ |
|
| 40 |
/******************************************************************************/ |
|
| 41 |
|
|
| 42 |
/******************************************************************************/ |
|
| 43 |
/* CHECKS */ |
|
| 44 |
/******************************************************************************/ |
|
| 45 |
|
|
| 46 |
/******************************************************************************/ |
|
| 47 |
/* DATA STRUCTURES AND TYPES */ |
|
| 48 |
/******************************************************************************/ |
|
| 49 |
|
|
| 50 |
/* |
|
| 51 |
* forward declarations |
|
| 52 |
*/ |
|
| 53 |
typedef struct aos_testresult aos_testresult_t; |
|
| 54 |
typedef struct aos_test aos_test_t; |
|
| 55 |
|
|
| 56 |
/** |
|
| 57 |
* @brief Test interface function definition. |
|
| 58 |
* |
|
| 59 |
* @param[in] stream The stream to use for printing messages. |
|
| 60 |
* @param[in] ut The object to run the test on. |
|
| 61 |
* |
|
| 62 |
* @return Result containing the number of passed and failed tests. |
|
| 63 |
*/ |
|
| 64 |
typedef aos_testresult_t (*aos_testfunction_t)(BaseSequentialStream* stream, const aos_test_t* test); |
|
| 65 |
|
|
| 66 |
/** |
|
| 67 |
* @brief Wrapper interface definition to allow programmatical shell-like call |
|
| 68 |
* of the test. |
|
| 69 |
* @details While the first three arguments (stream, argc and argv) as well as |
|
| 70 |
* the return value are identical to a shell command, the additional |
|
| 71 |
* optional argument (result) is set by the function. |
|
| 72 |
* |
|
| 73 |
* @param[in] stream Stream to print to. |
|
| 74 |
* @param[in] argc Number of arguments given. |
|
| 75 |
* @param[in] argv List of arguments. |
|
| 76 |
* @param[out] result Result of the test (optional). |
|
| 77 |
* |
|
| 78 |
* @return Execution status of the function, which can be passed on to a |
|
| 79 |
* shell callback. |
|
| 80 |
*/ |
|
| 81 |
typedef int (*aos_testshellcallback_t)(BaseSequentialStream* stream, int argc, char* argv[], aos_testresult_t* result); |
|
| 82 |
|
|
| 83 |
/** |
|
| 84 |
* @brief Test result struct. |
|
| 85 |
*/ |
|
| 86 |
struct aos_testresult {
|
|
| 87 |
/** |
|
| 88 |
* @brief Number of passed tests. |
|
| 89 |
*/ |
|
| 90 |
uint32_t passed; |
|
| 91 |
|
|
| 92 |
/** |
|
| 93 |
* @brief Number of failed tests. |
|
| 94 |
*/ |
|
| 95 |
uint32_t failed; |
|
| 96 |
}; |
|
| 97 |
|
|
| 98 |
/** |
|
| 99 |
* @brief Test definition struct. |
|
| 100 |
*/ |
|
| 101 |
struct aos_test {
|
|
| 102 |
/** |
|
| 103 |
* @brief Name of the test. |
|
| 104 |
*/ |
|
| 105 |
const char* name; |
|
| 106 |
|
|
| 107 |
/** |
|
| 108 |
* @brief Further information about the test. |
|
| 109 |
*/ |
|
| 110 |
const char* info; |
|
| 111 |
|
|
| 112 |
/** |
|
| 113 |
* @brief Callback function to serve as wrapper between shell and test. |
|
| 114 |
* |
|
| 115 |
* @details The purpose of this wrapper is to be able to execute tests |
|
| 116 |
* programatically exactly like a shell command from the CLI. It |
|
| 117 |
* should handle any required setup depending on given arguments and |
|
| 118 |
* eventually execute the test. |
|
| 119 |
*/ |
|
| 120 |
aos_testshellcallback_t shellcb; |
|
| 121 |
|
|
| 122 |
/** |
|
| 123 |
* @brief Callback function to run that executes the test. |
|
| 124 |
*/ |
|
| 125 |
aos_testfunction_t testfunc; |
|
| 126 |
|
|
| 127 |
/** |
|
| 128 |
* @brief Further test specific data. |
|
| 129 |
*/ |
|
| 130 |
void* data; |
|
| 131 |
}; |
|
| 132 |
|
|
| 133 |
|
|
| 134 |
/******************************************************************************/ |
|
| 135 |
/* MACROS */ |
|
| 136 |
/******************************************************************************/ |
|
| 137 |
|
|
| 138 |
#define AOS_TEST(var, name, info, shellcb, testfunc, data) aos_test_t var = { \
|
|
| 139 |
/* name */ name, \ |
|
| 140 |
/* info */ info, \ |
|
| 141 |
/* shellcb */ shellcb, \ |
|
| 142 |
/* testfunc */ testfunc, \ |
|
| 143 |
/* data */ data, \ |
|
| 144 |
} |
|
| 145 |
|
|
| 146 |
/******************************************************************************/ |
|
| 147 |
/* EXTERN DECLARATIONS */ |
|
| 148 |
/******************************************************************************/ |
|
| 149 |
|
|
| 150 |
#if defined(__cplusplus) |
|
| 151 |
extern "C" {
|
|
| 152 |
#endif /* defined(__cplusplus) */ |
|
| 153 |
aos_testresult_t aosTestResultAdd(aos_testresult_t a, aos_testresult_t b); |
|
| 154 |
uint32_t aosTestResultTotal(const aos_testresult_t* result); |
|
| 155 |
float aosTestResultRatio(const aos_testresult_t* result); |
|
| 156 |
void aosTestResultPrintSummary(BaseSequentialStream* stream, const aos_testresult_t* result, const char* heading); |
|
| 157 |
aos_testresult_t aosTestRun(BaseSequentialStream* stream, const aos_test_t* test, const char* note); |
|
| 158 |
void aosTestPassed(BaseSequentialStream* stream, aos_testresult_t* result); |
|
| 159 |
void aosTestPassedMsg(BaseSequentialStream* stream, aos_testresult_t* result, const char* fmt, ...); |
|
| 160 |
void aosTestFailed(BaseSequentialStream* stream, aos_testresult_t* result); |
|
| 161 |
void aosTestFailedMsg(BaseSequentialStream* stream, aos_testresult_t* result, const char* fmt, ...); |
|
| 162 |
void aosTestInfoMsg(BaseSequentialStream* stream, const char* fmt, ...); |
|
| 163 |
#if defined(__cplusplus) |
|
| 164 |
} |
|
| 165 |
#endif /* defined(__cplusplus) */ |
|
| 166 |
|
|
| 167 |
/******************************************************************************/ |
|
| 168 |
/* INLINE FUNCTIONS */ |
|
| 169 |
/******************************************************************************/ |
|
| 170 |
|
|
| 171 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
|
| 172 |
|
|
| 173 |
#endif /* AMIROOS_TEST_H */ |
|
| 174 |
|
|
| 175 |
/** @} */ |
|
| core/inc/aos_unittest.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 aos_unittest.h |
|
| 21 |
* @brief Unittest structures. |
|
| 22 |
* |
|
| 23 |
* @addtogroup aos_unittests |
|
| 24 |
* @{
|
|
| 25 |
*/ |
|
| 26 |
|
|
| 27 |
#ifndef AMIROOS_UNITTEST_H |
|
| 28 |
#define AMIROOS_UNITTEST_H |
|
| 29 |
|
|
| 30 |
#include <amiroos.h> |
|
| 31 |
|
|
| 32 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
|
| 33 |
|
|
| 34 |
/******************************************************************************/ |
|
| 35 |
/* CONSTANTS */ |
|
| 36 |
/******************************************************************************/ |
|
| 37 |
|
|
| 38 |
/******************************************************************************/ |
|
| 39 |
/* SETTINGS */ |
|
| 40 |
/******************************************************************************/ |
|
| 41 |
|
|
| 42 |
/******************************************************************************/ |
|
| 43 |
/* CHECKS */ |
|
| 44 |
/******************************************************************************/ |
|
| 45 |
|
|
| 46 |
/******************************************************************************/ |
|
| 47 |
/* DATA STRUCTURES AND TYPES */ |
|
| 48 |
/******************************************************************************/ |
|
| 49 |
|
|
| 50 |
/* |
|
| 51 |
* forward declarations |
|
| 52 |
*/ |
|
| 53 |
typedef struct aos_utresult aos_utresult_t; |
|
| 54 |
typedef struct aos_unittest aos_unittest_t; |
|
| 55 |
|
|
| 56 |
/** |
|
| 57 |
* @brief Unit test interface function definition. |
|
| 58 |
* |
|
| 59 |
* @param[in] stream The stream to use for printing messages. |
|
| 60 |
* @param[in] ut The object to run the test on. |
|
| 61 |
* |
|
| 62 |
* @return A result containing the number of passed and failed tests. |
|
| 63 |
*/ |
|
| 64 |
typedef aos_utresult_t (*aos_utfunction_t)(BaseSequentialStream*, aos_unittest_t*); |
|
| 65 |
|
|
| 66 |
/** |
|
| 67 |
* @brief Unit test result struct. |
|
| 68 |
*/ |
|
| 69 |
struct aos_utresult {
|
|
| 70 |
/** |
|
| 71 |
* @brief Number of passed tests. |
|
| 72 |
*/ |
|
| 73 |
uint32_t passed; |
|
| 74 |
|
|
| 75 |
/** |
|
| 76 |
* @brief Number of failed tests. |
|
| 77 |
*/ |
|
| 78 |
uint32_t failed; |
|
| 79 |
}; |
|
| 80 |
|
|
| 81 |
/** |
|
| 82 |
* @brief Unit test definition struct. |
|
| 83 |
*/ |
|
| 84 |
struct aos_unittest {
|
|
| 85 |
/** |
|
| 86 |
* @brief Name of the unit test. |
|
| 87 |
*/ |
|
| 88 |
const char* name; |
|
| 89 |
|
|
| 90 |
/** |
|
| 91 |
* @brief Further information about the test. |
|
| 92 |
*/ |
|
| 93 |
const char* info; |
|
| 94 |
|
|
| 95 |
/** |
|
| 96 |
* @brief Callback function to run that executes the unit test. |
|
| 97 |
*/ |
|
| 98 |
aos_utfunction_t testfunc; |
|
| 99 |
|
|
| 100 |
/** |
|
| 101 |
* @brief Shell command to add to an shell command list. |
|
| 102 |
*/ |
|
| 103 |
aos_shellcommand_t shellcmd; |
|
| 104 |
|
|
| 105 |
/** |
|
| 106 |
* @brief Further test specific data. |
|
| 107 |
*/ |
|
| 108 |
void* data; |
|
| 109 |
}; |
|
| 110 |
|
|
| 111 |
|
|
| 112 |
/******************************************************************************/ |
|
| 113 |
/* MACROS */ |
|
| 114 |
/******************************************************************************/ |
|
| 115 |
|
|
| 116 |
/******************************************************************************/ |
|
| 117 |
/* EXTERN DECLARATIONS */ |
|
| 118 |
/******************************************************************************/ |
|
| 119 |
|
|
| 120 |
#if defined(__cplusplus) |
|
| 121 |
extern "C" {
|
|
| 122 |
#endif /* defined(__cplusplus) */ |
|
| 123 |
uint32_t aosUtResultTotal(aos_utresult_t* result); |
|
| 124 |
float aosUtResultRatio(aos_utresult_t* result); |
|
| 125 |
void aosUtResultPrintSummary(BaseSequentialStream* stream, aos_utresult_t* result, char* heading); |
|
| 126 |
void aosUtObjectInit(aos_unittest_t* ut, char* name, char* info, aos_utfunction_t func, void* data, char* shellname, aos_shellcmdcb_t shellcb); |
|
| 127 |
aos_utresult_t aosUtRun(BaseSequentialStream* stream, aos_unittest_t* ut, char* note); |
|
| 128 |
void aosUtPassed(BaseSequentialStream* stream, aos_utresult_t* result); |
|
| 129 |
void aosUtPassedMsg(BaseSequentialStream* stream, aos_utresult_t* result, const char* fmt, ...); |
|
| 130 |
void aosUtFailed(BaseSequentialStream* stream, aos_utresult_t* result); |
|
| 131 |
void aosUtFailedMsg(BaseSequentialStream* stream, aos_utresult_t* result, const char* fmt, ...); |
|
| 132 |
void aosUtInfoMsg(BaseSequentialStream* stream, const char* fmt, ...); |
|
| 133 |
#if defined(__cplusplus) |
|
| 134 |
} |
|
| 135 |
#endif /* defined(__cplusplus) */ |
|
| 136 |
|
|
| 137 |
/******************************************************************************/ |
|
| 138 |
/* INLINE FUNCTIONS */ |
|
| 139 |
/******************************************************************************/ |
|
| 140 |
|
|
| 141 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
|
| 142 |
|
|
| 143 |
#endif /* AMIROOS_UNITTEST_H */ |
|
| 144 |
|
|
| 145 |
/** @} */ |
|
| core/src/aos_main.cpp | ||
|---|---|---|
| 996 | 996 |
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_4_ARGS) */ |
| 997 | 997 |
#endif /* defined(AMIROOS_CFG_MAIN_INIT_HOOK_4) */ |
| 998 | 998 |
|
| 999 |
/* periphery communication initialization */ |
|
| 999 |
/* periphery communication interfaces initialization */
|
|
| 1000 | 1000 |
// module specific initialization (if any) |
| 1001 |
#if defined(MODULE_INIT_PERIPHERY_COMM)
|
|
| 1002 |
MODULE_INIT_PERIPHERY_COMM();
|
|
| 1003 |
#endif /* defined(MODULE_INIT_PERIPHERY_COMM) */
|
|
| 1001 |
#if defined(MODULE_INIT_PERIPHERY_IF)
|
|
| 1002 |
MODULE_INIT_PERIPHERY_IF();
|
|
| 1003 |
#endif /* defined(MODULE_INIT_PERIPHERY_IF) */
|
|
| 1004 | 1004 |
#if ((SSSP_STAGE3_ENABLE == true) && (HAL_USE_CAN == TRUE)) |
| 1005 | 1005 |
// CAN |
| 1006 | 1006 |
if (MODULE_HAL_CAN.state == CAN_STOP) {
|
| ... | ... | |
| 1339 | 1339 |
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_3_ARGS) */ |
| 1340 | 1340 |
#endif /* defined(AMIROOS_CFG_MAIN_SHUTDOWN_HOOK_3) */ |
| 1341 | 1341 |
|
| 1342 |
/* stop all periphery communication */ |
|
| 1343 |
#if defined(MODULE_SHUTDOWN_PERIPHERY_COMM)
|
|
| 1344 |
MODULE_SHUTDOWN_PERIPHERY_COMM();
|
|
| 1345 |
#endif /* defined(MODULE_SHUTDOWN_PERIPHERY_COMM) */
|
|
| 1342 |
/* stop all periphery communication interfaces */
|
|
| 1343 |
#if defined(MODULE_SHUTDOWN_PERIPHERY_IF)
|
|
| 1344 |
MODULE_SHUTDOWN_PERIPHERY_IF();
|
|
| 1345 |
#endif /* defined(MODULE_SHUTDOWN_PERIPHERY_IF) */
|
|
| 1346 | 1346 |
#if (HAL_USE_CAN == TRUE) |
| 1347 | 1347 |
if (MODULE_HAL_CAN.state != CAN_STOP) {
|
| 1348 | 1348 |
canStop(&MODULE_HAL_CAN); |
| core/src/aos_system.c | ||
|---|---|---|
| 147 | 147 |
/** |
| 148 | 148 |
* @brief Shell command to retrieve system information. |
| 149 | 149 |
*/ |
| 150 |
static aos_shellcommand_t _shellcmd_info = {
|
|
| 151 |
/* name */ "module:info", |
|
| 152 |
/* callback */ _shellcmd_infocb, |
|
| 153 |
/* next */ NULL, |
|
| 154 |
}; |
|
| 150 |
static AOS_SHELL_COMMAND(_shellcmd_info, "module:info", _shellcmd_infocb); |
|
| 155 | 151 |
|
| 156 | 152 |
/** |
| 157 | 153 |
* @brief Shell command to set or retrieve system configuration. |
| 158 | 154 |
*/ |
| 159 |
static aos_shellcommand_t _shellcmd_config = {
|
|
| 160 |
/* name */ "module:config", |
|
| 161 |
/* callback */ _shellcmd_configcb, |
|
| 162 |
/* next */ NULL, |
|
| 163 |
}; |
|
| 155 |
static AOS_SHELL_COMMAND(_shellcmd_config, "module:config", _shellcmd_configcb); |
|
| 164 | 156 |
|
| 165 | 157 |
/** |
| 166 | 158 |
* @brief Shell command to shutdown the system. |
| 167 | 159 |
*/ |
| 168 |
static aos_shellcommand_t _shellcmd_shutdown = {
|
|
| 169 | 160 |
#if (AMIROOS_CFG_SSSP_ENABLE == true) |
| 170 |
/* name */ "system:shutdown",
|
|
| 161 |
static AOS_SHELL_COMMAND(_shellcmd_shutdown, "system:shutdown", _shellcmd_shutdowncb);
|
|
| 171 | 162 |
#else /* (AMIROOS_CFG_SSSP_ENABLE == true) */ |
| 172 |
/* name */ "module:shutdown",
|
|
| 163 |
static AOS_SHELL_COMMAND(_shellcmd_shutdown, "module:shutdown", _shellcmd_shutdowncb);
|
|
| 173 | 164 |
#endif /* (AMIROOS_CFG_SSSP_ENABLE == true) */ |
| 174 |
/* callback */ _shellcmd_shutdowncb, |
|
| 175 |
/* next */ NULL, |
|
| 176 |
}; |
|
| 177 | 165 |
|
| 178 | 166 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
| 179 | 167 |
/** |
| 180 | 168 |
* @brief Shell kommand to run a test of the ChibiOS/RT kernel. |
| 181 | 169 |
*/ |
| 182 |
static aos_shellcommand_t _shellcmd_kerneltest = {
|
|
| 183 |
/* name */ "kernel:test", |
|
| 184 |
/* callback */ _shellcmd_kerneltestcb, |
|
| 185 |
/* next */ NULL, |
|
| 186 |
}; |
|
| 170 |
static AOS_SHELL_COMMAND(_shellcmd_kerneltest, "kernel:test", _shellcmd_kerneltestcb); |
|
| 187 | 171 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
| 188 | 172 |
#endif /* (AMIROOS_CFG_SHELL_ENABLE == true) || (AMIROOS_CFG_TESTS_ENABLE == true) */ |
| 189 | 173 |
|
| ... | ... | |
| 561 | 545 |
#if (AMIROOS_CFG_DBG == true) |
| 562 | 546 |
chprintf(stream, "\tthread stack size: %u bytes\n", aosThdGetStacksize(aos.shell.thread)); |
| 563 | 547 |
#if (CH_DBG_FILL_THREADS == TRUE) |
| 564 |
chprintf(stream, "\tstack peak utilization: %u bytes (%.2f%%)\n", aosThdGetStackPeakUtilization(aos.shell.thread), (float)aosThdGetStackPeakUtilization(aos.shell.thread) / (float)aosThdGetStacksize(aos.shell.thread) * 100.0f);
|
|
| 548 |
chprintf(stream, "\tstack peak utilization: %u bytes (%.2f%%)\n", aosThdGetStackPeakUtilization(aos.shell.thread), (float)(aosThdGetStackPeakUtilization(aos.shell.thread)) / (float)(aosThdGetStacksize(aos.shell.thread)) * 100.0f);
|
|
| 565 | 549 |
#endif /* (CH_DBG_FILL_THREADS == TRUE) */ |
| 566 | 550 |
#endif /* (AMIROOS_CFG_DBG == true) */ |
| 567 | 551 |
_printSystemInfoSeparator(stream, '=', SYSTEM_INFO_WIDTH); |
| core/src/aos_test.c | ||
|---|---|---|
| 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 aos_test.c |
|
| 21 |
* @brief Test code. |
|
| 22 |
* @details Functions to initialize and run tests, |
|
| 23 |
* as well as utility functions to be used in tests. |
|
| 24 |
* |
|
| 25 |
* @addtogroup aos_tests |
|
| 26 |
* @{
|
|
| 27 |
*/ |
|
| 28 |
|
|
| 29 |
#include <amiroos.h> |
|
| 30 |
|
|
| 31 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
|
| 32 |
|
|
| 33 |
#include <string.h> |
|
| 34 |
#include <stdarg.h> |
|
| 35 |
|
|
| 36 |
/******************************************************************************/ |
|
| 37 |
/* LOCAL DEFINITIONS */ |
|
| 38 |
/******************************************************************************/ |
|
| 39 |
|
|
| 40 |
/******************************************************************************/ |
|
| 41 |
/* EXPORTED VARIABLES */ |
|
| 42 |
/******************************************************************************/ |
|
| 43 |
|
|
| 44 |
/******************************************************************************/ |
|
| 45 |
/* LOCAL TYPES */ |
|
| 46 |
/******************************************************************************/ |
|
| 47 |
|
|
| 48 |
/******************************************************************************/ |
|
| 49 |
/* LOCAL VARIABLES */ |
|
| 50 |
/******************************************************************************/ |
|
| 51 |
|
|
| 52 |
/******************************************************************************/ |
|
| 53 |
/* LOCAL FUNCTIONS */ |
|
| 54 |
/******************************************************************************/ |
|
| 55 |
|
|
| 56 |
/******************************************************************************/ |
|
| 57 |
/* EXPORTED FUNCTIONS */ |
|
| 58 |
/******************************************************************************/ |
|
| 59 |
|
|
| 60 |
/** |
|
| 61 |
* @brief Adds two result objects. |
|
| 62 |
* |
|
| 63 |
* @param[in] a The first summand. |
|
| 64 |
* @param[in] b The second summand. |
|
| 65 |
* |
|
| 66 |
* @return Resulting sum of both summands added. |
|
| 67 |
*/ |
|
| 68 |
inline aos_testresult_t aosTestResultAdd(aos_testresult_t a, aos_testresult_t b) |
|
| 69 |
{
|
|
| 70 |
a.passed += b.passed; |
|
| 71 |
a.failed += b.failed; |
|
| 72 |
|
|
| 73 |
return a; |
|
| 74 |
} |
|
| 75 |
|
|
| 76 |
/** |
|
| 77 |
* @brief Retrieve the total number of tests (passed and failed). |
|
| 78 |
* |
|
| 79 |
* @param[in] result The result object to evaluate. |
|
| 80 |
* |
|
| 81 |
* @return Number of total tests executed. |
|
| 82 |
*/ |
|
| 83 |
inline uint32_t aosTestResultTotal(const aos_testresult_t* result) |
|
| 84 |
{
|
|
| 85 |
aosDbgCheck(result != NULL); |
|
| 86 |
|
|
| 87 |
return result->passed + result->failed; |
|
| 88 |
} |
|
| 89 |
|
|
| 90 |
/** |
|
| 91 |
* @brief Retrieve the ratio of passed tests. |
|
| 92 |
* |
|
| 93 |
* @param[in] result The result object to evaluate. |
|
| 94 |
* |
|
| 95 |
* @return Ratio of passed tests to total tests as float in range [0, 1]. |
|
| 96 |
*/ |
|
| 97 |
inline float aosTestResultRatio(const aos_testresult_t *result) |
|
| 98 |
{
|
|
| 99 |
aosDbgCheck(result != NULL); |
|
| 100 |
|
|
| 101 |
if (aosTestResultTotal(result) > 0) {
|
|
| 102 |
return (float)result->passed / (float)(aosTestResultTotal(result)); |
|
| 103 |
} else {
|
|
| 104 |
return 1.0f; |
|
| 105 |
} |
|
| 106 |
} |
|
| 107 |
|
|
| 108 |
/** |
|
| 109 |
* @brief Print the summary of a test. |
|
| 110 |
* @details The summary consists of: |
|
| 111 |
* - total numer of tests executed |
|
| 112 |
* - absolute number of passed tests |
|
| 113 |
* - absolute number of failed tests |
|
| 114 |
* - relative ratio of passed tests |
|
| 115 |
* |
|
| 116 |
* @param[in] stream Stream to print the result to. |
|
| 117 |
* @param[in] result Result to evaluate and print. |
|
| 118 |
* @param[in] heading Optional heading (defaults to "summary"). |
|
| 119 |
*/ |
|
| 120 |
void aosTestResultPrintSummary(BaseSequentialStream *stream, const aos_testresult_t* result, const char* heading) |
|
| 121 |
{
|
|
| 122 |
aosDbgCheck(stream != NULL); |
|
| 123 |
aosDbgCheck(result != NULL); |
|
| 124 |
|
|
| 125 |
chprintf(stream, "%s:\n", (heading != NULL) ? heading : "summary"); |
|
| 126 |
chprintf(stream, "\ttotal: %3u\n", aosTestResultTotal(result)); |
|
| 127 |
chprintf(stream, "\tpassed: %3u\n", result->passed); |
|
| 128 |
chprintf(stream, "\tfailed: %3u\n", result->failed); |
|
| 129 |
chprintf(stream, "\tratio: %3u%%\n", (uint8_t)(aosTestResultRatio(result) * 100.0f)); // implicitly rounded off by cast to integer |
|
| 130 |
|
|
| 131 |
return; |
|
| 132 |
} |
|
| 133 |
|
|
| 134 |
/** |
|
| 135 |
* @brief Run a test. |
|
| 136 |
* |
|
| 137 |
* @param[in] stream A stream for printing messages. |
|
| 138 |
* @param[in] test Test to execute. |
|
| 139 |
* @param[in] note Optional note string. |
|
| 140 |
* |
|
| 141 |
* @return Result of the test. |
|
| 142 |
*/ |
|
| 143 |
aos_testresult_t aosTestRun(BaseSequentialStream *stream, const aos_test_t *test, const char* note) |
|
| 144 |
{
|
|
| 145 |
aosDbgCheck(stream != NULL); |
|
| 146 |
aosDbgCheck(test != NULL); |
|
| 147 |
|
|
| 148 |
// print name heading |
|
| 149 |
{
|
|
| 150 |
chprintf(stream, "\n"); |
|
| 151 |
const int nchars = chprintf(stream, "%s test\n", test->name); |
|
| 152 |
for (int c = 0; c < nchars-1; ++c) {
|
|
| 153 |
chprintf(stream, "="); |
|
| 154 |
} |
|
| 155 |
chprintf(stream, "\n"); |
|
| 156 |
} |
|
| 157 |
|
|
| 158 |
// print info (if any) |
|
| 159 |
if (test->info != NULL) {
|
|
| 160 |
chprintf(stream, "info: %s\n", test->info); |
|
| 161 |
} |
|
| 162 |
// print note (if any) |
|
| 163 |
if (note != NULL) {
|
|
| 164 |
chprintf(stream, "note: %s\n", note); |
|
| 165 |
} |
|
| 166 |
chprintf(stream, "\n"); |
|
| 167 |
|
|
| 168 |
// run test |
|
| 169 |
aos_testresult_t result = test->testfunc(stream, test); |
|
| 170 |
|
|
| 171 |
// print summary |
|
| 172 |
aosTestResultPrintSummary(stream, &result, NULL); |
|
| 173 |
|
|
| 174 |
return result; |
|
| 175 |
} |
|
| 176 |
|
|
| 177 |
/** |
|
| 178 |
* @brief Helper function for passed tests. |
|
| 179 |
* @details Prints a message that the test was passed and modifies the result accordigly. |
|
| 180 |
* |
|
| 181 |
* @param[in] stream Stream to print the message to. |
|
| 182 |
* @param[in,out] result Result object to modify. |
|
| 183 |
*/ |
|
| 184 |
void aosTestPassed(BaseSequentialStream *stream, aos_testresult_t* result) |
|
| 185 |
{
|
|
| 186 |
aosDbgCheck(stream != NULL); |
|
| 187 |
aosDbgCheck(result != NULL); |
|
| 188 |
|
|
| 189 |
++result->passed; |
|
| 190 |
chprintf(stream, "\tPASSED\n"); |
|
| 191 |
chprintf(stream, "\n"); |
|
| 192 |
|
|
| 193 |
return; |
|
| 194 |
} |
|
| 195 |
|
|
| 196 |
/** |
|
| 197 |
* @brief Helper function for passed tests. |
|
| 198 |
* @details Prints a message that the test was passed, an additional custom message, and modifies the result accordigly. |
|
| 199 |
* |
|
| 200 |
* @param[in] stream Stream to print the message to. |
|
| 201 |
* @param[in,out] result Result object to modify. |
|
| 202 |
* @param[in] fmt Formatted message string. |
|
| 203 |
*/ |
|
| 204 |
void aosTestPassedMsg(BaseSequentialStream *stream, aos_testresult_t* result, const char *fmt, ...) |
|
| 205 |
{
|
|
| 206 |
aosDbgCheck(stream != NULL); |
|
| 207 |
aosDbgCheck(result != NULL); |
|
| 208 |
|
|
| 209 |
va_list ap; |
|
| 210 |
|
|
| 211 |
++result->passed; |
|
| 212 |
chprintf(stream, "\tPASSED\t"); |
|
| 213 |
va_start(ap, fmt); |
|
| 214 |
chvprintf(stream, fmt, ap); |
|
| 215 |
va_end(ap); |
|
| 216 |
chprintf(stream, "\n"); |
|
| 217 |
|
|
| 218 |
return; |
|
| 219 |
} |
|
| 220 |
|
|
| 221 |
/** |
|
| 222 |
* @brief Helper function for failed tests. |
|
| 223 |
* @details Prints a message that the test was failed and modifies the result accordigly. |
|
| 224 |
* |
|
| 225 |
* @param[in] stream Stream to print the message to. |
|
| 226 |
* @param[in,out] result Result object to modify. |
|
| 227 |
*/ |
|
| 228 |
void aosTestFailed(BaseSequentialStream *stream, aos_testresult_t* result) |
|
| 229 |
{
|
|
| 230 |
aosDbgCheck(stream != NULL); |
|
| 231 |
aosDbgCheck(result != NULL); |
|
| 232 |
|
|
| 233 |
++result->failed; |
|
| 234 |
chprintf(stream, "\tFAILED\n"); |
|
| 235 |
chprintf(stream, "\n"); |
|
| 236 |
|
|
| 237 |
return; |
|
| 238 |
} |
|
| 239 |
|
|
| 240 |
/** |
|
| 241 |
* @brief Helper function for failed tests. |
|
| 242 |
* @details Prints a message that the test was failed, an additional custom message, and modifies the result accordigly. |
|
| 243 |
* |
|
| 244 |
* @param[in] stream Stream to print the message to. |
|
| 245 |
* @param[in,out] result Result object to modify. |
|
| 246 |
* @param[in] fmt Formatted message string. |
|
| 247 |
*/ |
|
| 248 |
void aosTestFailedMsg(BaseSequentialStream *stream, aos_testresult_t* result, const char *fmt, ...) |
|
| 249 |
{
|
|
| 250 |
aosDbgCheck(stream != NULL); |
|
| 251 |
aosDbgCheck(result != NULL); |
|
| 252 |
|
|
| 253 |
va_list ap; |
|
| 254 |
|
|
| 255 |
++result->failed; |
|
| 256 |
chprintf(stream, "\tFAILED\t"); |
|
| 257 |
va_start(ap, fmt); |
|
| 258 |
chvprintf(stream, fmt, ap); |
|
| 259 |
va_end(ap); |
|
| 260 |
chprintf(stream, "\n"); |
|
| 261 |
|
|
| 262 |
return; |
|
| 263 |
} |
|
| 264 |
|
|
| 265 |
/** |
|
| 266 |
* @brief Helper function for information messages. |
|
| 267 |
* |
|
| 268 |
* @param[in] stream Strean to rpint the message to. |
|
| 269 |
* @param[in] fmt Formatted message string. |
|
| 270 |
*/ |
|
| 271 |
void aosTestInfoMsg(BaseSequentialStream* stream, const char* fmt, ...) |
|
| 272 |
{
|
|
| 273 |
aosDbgCheck(stream != NULL); |
|
| 274 |
|
|
| 275 |
va_list ap; |
|
| 276 |
va_start(ap, fmt); |
|
| 277 |
chvprintf(stream, fmt, ap); |
|
| 278 |
va_end(ap); |
|
| 279 |
chprintf(stream, "\n"); |
|
| 280 |
|
|
| 281 |
return; |
|
| 282 |
} |
|
| 283 |
|
|
| 284 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
|
| 285 |
|
|
| 286 |
/** @} */ |
|
| core/src/aos_unittest.c | ||
|---|---|---|
| 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 aos_unittest.c |
|
| 21 |
* @brief Unittest code. |
|
| 22 |
* @details Functions to initialize and run unittests, |
|
| 23 |
* as well as utility functions to be used in unittests. |
|
| 24 |
* |
|
| 25 |
* @addtogroup aos_unittests |
|
| 26 |
* @{
|
|
| 27 |
*/ |
|
| 28 |
|
|
| 29 |
#include <amiroos.h> |
|
| 30 |
#include <string.h> |
|
| 31 |
|
|
| 32 |
#if (AMIROOS_CFG_TESTS_ENABLE == true) || defined(__DOXYGEN__) |
|
| 33 |
|
|
| 34 |
/******************************************************************************/ |
|
| 35 |
/* LOCAL DEFINITIONS */ |
|
| 36 |
/******************************************************************************/ |
|
| 37 |
|
|
| 38 |
/******************************************************************************/ |
|
| 39 |
/* EXPORTED VARIABLES */ |
|
| 40 |
/******************************************************************************/ |
|
| 41 |
|
|
| 42 |
/******************************************************************************/ |
|
| 43 |
/* LOCAL TYPES */ |
|
| 44 |
/******************************************************************************/ |
|
| 45 |
|
|
| 46 |
/******************************************************************************/ |
|
| 47 |
/* LOCAL VARIABLES */ |
|
| 48 |
/******************************************************************************/ |
|
| 49 |
|
|
| 50 |
/******************************************************************************/ |
|
| 51 |
/* LOCAL FUNCTIONS */ |
|
| 52 |
/******************************************************************************/ |
|
| 53 |
|
|
| 54 |
/******************************************************************************/ |
|
| 55 |
/* EXPORTED FUNCTIONS */ |
|
| 56 |
/******************************************************************************/ |
|
| 57 |
|
|
| 58 |
/** |
|
| 59 |
* @brief Retrieve the total number of tests (passed and failed). |
|
| 60 |
* |
|
| 61 |
* @param[in] result The result object to evaluate. |
|
| 62 |
* |
|
| 63 |
* @return Number of total tests executed. |
|
| 64 |
*/ |
|
| 65 |
inline uint32_t aosUtResultTotal(aos_utresult_t *result) |
|
| 66 |
{
|
|
| 67 |
aosDbgCheck(result != NULL); |
|
| 68 |
|
|
| 69 |
return result->passed + result->failed; |
|
| 70 |
} |
|
| 71 |
|
|
| 72 |
/** |
|
| 73 |
* @brief Retrieve the ratio of passed tests. |
|
| 74 |
* |
|
| 75 |
* @param[in] result The result object to evaluate. |
|
| 76 |
* |
|
| 77 |
* @return Ratio of passed tests to total tests as float in range [0, 1]. |
|
| 78 |
*/ |
|
| 79 |
inline float aosUtResultRatio(aos_utresult_t *result) |
|
| 80 |
{
|
|
| 81 |
aosDbgCheck(result != NULL); |
|
| 82 |
|
|
| 83 |
if (aosUtResultTotal(result) > 0) {
|
|
| 84 |
return (float)result->passed / (float)aosUtResultTotal(result); |
|
| 85 |
} else {
|
|
| 86 |
return 1.0f; |
|
| 87 |
} |
|
| 88 |
} |
|
| 89 |
|
|
| 90 |
/** |
|
| 91 |
* @brief Print the summary of a test. |
|
| 92 |
* @details The summary consists of: |
|
| 93 |
* - total numer of tests executed |
|
| 94 |
* - absolute number of passed tests |
|
| 95 |
* - absolute number of failed tests |
|
| 96 |
* - relative ratio of passed tests |
|
| 97 |
* |
|
| 98 |
* @param[in] stream Stream to print the result to. |
|
| 99 |
* @param[in] result Result to evaluate and print. |
|
| 100 |
* @param[in] heading Optional heading (defaults to "summary"). |
|
| 101 |
*/ |
|
| 102 |
void aosUtResultPrintSummary(BaseSequentialStream *stream, aos_utresult_t *result, char* heading) |
|
| 103 |
{
|
|
| 104 |
aosDbgCheck(stream != NULL); |
|
| 105 |
aosDbgCheck(result != NULL); |
|
| 106 |
|
|
| 107 |
chprintf(stream, "%s:\n", (heading != NULL) ? heading : "summary"); |
|
| 108 |
chprintf(stream, "\ttotal: %3u\n", aosUtResultTotal(result)); |
|
| 109 |
chprintf(stream, "\tpassed: %3u\n", result->passed); |
|
| 110 |
chprintf(stream, "\tfailed: %3u\n", result->failed); |
|
| 111 |
chprintf(stream, "\tratio: %3u%%\n", (uint8_t)(aosUtResultRatio(result) * 100.0f)); |
|
| 112 |
|
|
| 113 |
return; |
|
| 114 |
} |
|
| 115 |
|
|
| 116 |
/** |
|
| 117 |
* @brief Initialize a unit test object. |
|
| 118 |
* |
|
| 119 |
* @param[in] ut The unit test object to initialize. |
|
| 120 |
* @param[in] name name of the unit test. |
|
| 121 |
* @param[in] info Optional information string. |
|
| 122 |
* @param[in] func Unit test calback function. |
|
| 123 |
* @param[in] data Optional data for the unit test. |
|
| 124 |
* @param[in] shellname Name of the shell command |
|
| 125 |
* @param[in] shellcb Callback for the shell command. |
|
| 126 |
*/ |
|
| 127 |
void aosUtObjectInit(aos_unittest_t* ut, char* name, char* info, aos_utfunction_t func, void* data, char* shellname, aos_shellcmdcb_t shellcb) |
|
| 128 |
{
|
|
| 129 |
aosDbgCheck(ut != NULL); |
|
| 130 |
aosDbgCheck(name != NULL && strlen(name) > 0); |
|
| 131 |
aosDbgCheck(func != NULL); |
|
| 132 |
aosDbgCheck(shellname != NULL && strlen(shellname) > 0); |
|
| 133 |
aosDbgCheck(shellcb != NULL); |
|
| 134 |
|
|
| 135 |
ut->name = name; |
|
| 136 |
ut->info = info; |
|
| 137 |
ut->testfunc = func; |
|
| 138 |
ut->shellcmd.name = shellname; |
|
| 139 |
ut->shellcmd.callback = shellcb; |
|
| 140 |
ut->shellcmd.next = NULL; |
|
| 141 |
ut->data = data; |
|
| 142 |
|
|
| 143 |
return; |
|
| 144 |
} |
|
| 145 |
|
|
| 146 |
/** |
|
| 147 |
* @brief Run an unit test. |
|
| 148 |
* |
|
| 149 |
* @param[in] stream A stream for printing messages. |
|
| 150 |
* @param[in] ut Unit test to execute. |
|
| 151 |
* @param[in] note Optional note string. |
|
| 152 |
* |
|
| 153 |
* @return Result of the test. |
|
| 154 |
*/ |
|
| 155 |
aos_utresult_t aosUtRun(BaseSequentialStream *stream, aos_unittest_t *ut, char *note) |
|
| 156 |
{
|
|
| 157 |
aosDbgCheck(stream != NULL); |
|
| 158 |
aosDbgCheck(ut != NULL); |
|
| 159 |
|
|
| 160 |
// print name heading |
|
| 161 |
{
|
|
| 162 |
chprintf(stream, "\n"); |
|
| 163 |
const int nchars = chprintf(stream, "%s unit test\n", ut->name); |
|
| 164 |
for (int c = 0; c < nchars-1; ++c) {
|
|
| 165 |
chprintf(stream, "="); |
|
| 166 |
} |
|
| 167 |
chprintf(stream, "\n"); |
|
| 168 |
} |
|
| 169 |
|
|
| 170 |
// print info (if any) |
|
| 171 |
if (ut->info != NULL) {
|
|
| 172 |
chprintf(stream, "info: %s\n", ut->info); |
|
| 173 |
} |
|
| 174 |
// print note (if any) |
|
| 175 |
if (note != NULL) {
|
|
| 176 |
chprintf(stream, "note: %s\n", note); |
|
| 177 |
} |
|
| 178 |
chprintf(stream, "\n"); |
|
| 179 |
|
|
| 180 |
// run test |
|
| 181 |
aos_utresult_t result = ut->testfunc(stream, ut); |
|
| 182 |
|
|
| 183 |
// print summary |
|
| 184 |
aosUtResultPrintSummary(stream, &result, NULL); |
|
| 185 |
|
|
| 186 |
return result; |
|
| 187 |
} |
|
| 188 |
|
|
| 189 |
/** |
|
| 190 |
* @brief Helper function for passed tests. |
|
| 191 |
* @details Prints a message that the test was passed and modifies the result accordigly. |
|
| 192 |
* |
|
| 193 |
* @param[in] stream Stream to print the message to. |
|
| 194 |
* @param[in,out] result Result object to modify. |
|
| 195 |
*/ |
|
| 196 |
void aosUtPassed(BaseSequentialStream *stream, aos_utresult_t* result) |
|
| 197 |
{
|
|
| 198 |
aosDbgCheck(stream != NULL); |
|
| 199 |
aosDbgCheck(result != NULL); |
|
| 200 |
|
|
| 201 |
++result->passed; |
|
| 202 |
chprintf(stream, "\tPASSED\n"); |
|
| 203 |
chprintf(stream, "\n"); |
|
| 204 |
|
|
| 205 |
return; |
|
| 206 |
} |
|
| 207 |
|
|
| 208 |
/** |
|
| 209 |
* @brief Helper function for passed tests. |
|
| 210 |
* @details Prints a message that the test was passed, an additional custom message, and modifies the result accordigly. |
|
| 211 |
* |
|
| 212 |
* @param[in] stream Stream to print the message to. |
|
| 213 |
* @param[in,out] result Result object to modify. |
|
| 214 |
* @param[in] fmt Formatted message string. |
|
| 215 |
*/ |
|
| 216 |
void aosUtPassedMsg(BaseSequentialStream *stream, aos_utresult_t* result, const char *fmt, ...) |
|
| 217 |
{
|
|
| 218 |
aosDbgCheck(stream != NULL); |
|
| 219 |
aosDbgCheck(result != NULL); |
|
| 220 |
|
|
| 221 |
va_list ap; |
|
| 222 |
|
|
| 223 |
++result->passed; |
|
| 224 |
chprintf(stream, "\tPASSED\t"); |
|
| 225 |
va_start(ap, fmt); |
|
| 226 |
chvprintf(stream, fmt, ap); |
|
| 227 |
va_end(ap); |
|
| 228 |
chprintf(stream, "\n"); |
|
| 229 |
|
|
| 230 |
return; |
|
| 231 |
} |
|
| 232 |
|
|
| 233 |
/** |
|
| 234 |
* @brief Helper function for failed tests. |
|
| 235 |
* @details Prints a message that the test was failed and modifies the result accordigly. |
|
| 236 |
* |
|
| 237 |
* @param[in] stream Stream to print the message to. |
|
| 238 |
* @param[in,out] result Result object to modify. |
|
| 239 |
*/ |
|
| 240 |
void aosUtFailed(BaseSequentialStream *stream, aos_utresult_t* result) |
|
| 241 |
{
|
|
| 242 |
aosDbgCheck(stream != NULL); |
|
| 243 |
aosDbgCheck(result != NULL); |
|
| 244 |
|
|
| 245 |
++result->failed; |
|
| 246 |
chprintf(stream, "\tFAILED\n"); |
|
| 247 |
chprintf(stream, "\n"); |
|
| 248 |
|
|
| 249 |
return; |
|
| 250 |
} |
|
| 251 |
|
|
| 252 |
/** |
|
| 253 |
* @brief Helper function for failed tests. |
|
| 254 |
* @details Prints a message that the test was failed, an additional custom message, and modifies the result accordigly. |
|
| 255 |
* |
|
| 256 |
* @param[in] stream Stream to print the message to. |
|
| 257 |
* @param[in,out] result Result object to modify. |
|
| 258 |
* @param[in] fmt Formatted message string. |
|
| 259 |
*/ |
|
| 260 |
void aosUtFailedMsg(BaseSequentialStream *stream, aos_utresult_t* result, const char *fmt, ...) |
|
| 261 |
{
|
|
| 262 |
aosDbgCheck(stream != NULL); |
|
| 263 |
aosDbgCheck(result != NULL); |
|
| 264 |
|
|
| 265 |
va_list ap; |
|
| 266 |
|
|
| 267 |
++result->failed; |
|
| 268 |
chprintf(stream, "\tFAILED\t"); |
|
| 269 |
va_start(ap, fmt); |
|
| 270 |
chvprintf(stream, fmt, ap); |
|
| 271 |
va_end(ap); |
|
| 272 |
chprintf(stream, "\n"); |
|
| 273 |
|
|
| 274 |
return; |
|
| 275 |
} |
|
| 276 |
|
|
| 277 |
/** |
|
| 278 |
* @brief Helper function for information messages. |
|
| 279 |
* |
|
| 280 |
* @param[in] stream Strean to rpint the message to. |
|
| 281 |
* @param[in] fmt Formatted message string. |
|
| 282 |
*/ |
|
| 283 |
void aosUtInfoMsg(BaseSequentialStream* stream, const char* fmt, ...) |
|
| 284 |
{
|
|
| 285 |
aosDbgCheck(stream != NULL); |
|
| 286 |
|
|
| 287 |
va_list ap; |
|
| 288 |
va_start(ap, fmt); |
|
| 289 |
chvprintf(stream, fmt, ap); |
|
| 290 |
va_end(ap); |
|
| 291 |
chprintf(stream, "\n"); |
|
| 292 |
|
|
| 293 |
return; |
|
| 294 |
} |
|
| 295 |
|
|
| 296 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) */ |
|
| 297 |
|
|
| 298 |
/** @} */ |
|
| kernel/kernel.mk | ||
|---|---|---|
| 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 |
|
|
| 1 | 26 |
# set kernel path variable |
| 2 |
AMIROOS_KERNEL = $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))/ChibiOS |
|
| 27 |
AMIROOS_KERNEL_DIR := $(dir $(lastword $(MAKEFILE_LIST))) |
|
| 28 |
|
|
| 29 |
# set ChibiOS path variable |
|
| 30 |
CHIBIOS := $(AMIROOS_KERNEL_DIR)ChibiOS |
|
| 31 |
|
|
| 32 |
# load licensing files |
|
| 33 |
include $(CHIBIOS)/os/license/license.mk |
|
| 34 |
|
|
| 35 |
# load startup files |
|
| 36 |
## must be loaded by each module individually |
|
| 37 |
|
|
| 38 |
# load HAL-OSAL files |
|
| 39 |
include $(CHIBIOS)/os/hal/hal.mk |
|
| 40 |
## platform.mk must be loaded by each module individually |
|
| 41 |
include $(CHIBIOS)/os/hal/osal/rt/osal.mk |
|
| 42 |
include $(CHIBIOS)/os/hal/lib/streams/streams.mk |
|
| 43 |
|
|
| 44 |
# load RTOS files |
|
| 45 |
include $(CHIBIOS)/os/rt/rt.mk |
|
| 46 |
## compiler port must be loaded by each module individually |
|
| 47 |
|
|
| 48 |
## load auto-build files in ./source recursively. |
|
| 49 |
#include $(CHIBIOS)/tools/mk/autobuild.mk |
|
| 50 |
|
|
| 51 |
# load test files |
|
| 52 |
include $(CHIBIOS)/test/lib/test.mk |
|
| 53 |
include $(CHIBIOS)/test/rt/rt_test.mk |
|
| 54 |
include $(CHIBIOS)/test/oslib/oslib_test.mk |
|
| 55 |
|
|
| 56 |
# include paths |
|
| 57 |
AMIROOS_KERNEL_INC = $(ALLINC) \ |
|
| 58 |
$(TESTINC) \ |
|
| 59 |
$(CHIBIOS)/os/hal/lib/streams |
|
| 60 |
|
|
| 61 |
# C source files |
|
| 62 |
AMIROOS_KERNEL_CSRC = $(ALLCSRC) \ |
|
| 63 |
$(CHIBIOS)/os/various/syscalls.c \ |
|
| 64 |
$(CHIBIOS)/os/various/evtimer.c \ |
|
| 65 |
$(TESTSRC) |
|
| 66 |
|
|
| 67 |
# C++ source files |
|
| 68 |
AMIROOS_KERNEL_CPPSRC = $(ALLCPPSRC) \ |
|
| 69 |
$(CHIBIOS)/os/various/cpp_wrappers/syscalls_cpp.cpp |
|
| 70 |
|
|
| 71 |
# ASM source files |
|
| 72 |
AMIROOS_KERNEL_ASMSRC = $(ALLASMSRC) |
|
| 73 |
|
|
| 74 |
# ASM with preprocessor source files |
|
| 75 |
AMIROOS_KERNEL_ASMXSRC = $(ALLXASMSRC) |
|
| 76 |
|
|
| 77 |
### Information forwarded to ChibiOS ### |
|
| 78 |
# Inclusion directories. |
|
| 79 |
INCDIR = $(AMIROOS_INC) |
|
| 80 |
|
|
| 81 |
# C sources that can be compiled in ARM or THUMB mode depending on the global |
|
| 82 |
# setting. |
|
| 83 |
CSRC = $(AMIROOS_CSRC) |
|
| 84 |
|
|
| 85 |
# C++ sources that can be compiled in ARM or THUMB mode depending on the global |
|
| 86 |
# setting. |
|
| 87 |
CPPSRC = $(AMIROOS_CPPSRC) |
|
| 88 |
|
|
| 89 |
# List ASM source files here. |
|
| 90 |
ASMSRC = $(AMIROOS_ASMSRC) |
|
| 91 |
|
|
| 92 |
# List ASM with preprocessor source files here. |
|
| 93 |
ASMXSRC = $(AMIROOS_ASMXSRC) |
|
| 3 | 94 |
|
| modules/DiWheelDrive_1-1/Makefile | ||
|---|---|---|
| 112 | 112 |
# Project, target, sources and paths # |
| 113 | 113 |
# # |
| 114 | 114 |
|
| 115 |
# Absolute path to the project |
|
| 116 |
PROJECT_PATH := $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
|
|
| 115 |
# Absolute path to the project.
|
|
| 116 |
PROJECT_PATH := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
|
|
| 117 | 117 |
|
| 118 |
# Define project name here
|
|
| 119 |
PROJECT := $(patsubst $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))..)/%,%,$(PROJECT_PATH))
|
|
| 118 |
# Project name.
|
|
| 119 |
PROJECT := $(notdir $(PROJECT_PATH))
|
|
| 120 | 120 |
|
| 121 | 121 |
# Target settings. |
| 122 |
MCU = cortex-m3 |
|
| 122 |
MCU := cortex-m3
|
|
| 123 | 123 |
|
| 124 |
# Imported source files and paths. |
|
| 125 |
include ../../kernel/kernel.mk |
|
| 126 |
CHIBIOS := $(AMIROOS_KERNEL) |
|
| 127 |
CONFDIR := . |
|
| 124 |
# Module specific paths and directories. |
|
| 125 |
MODULEDIR := . |
|
| 126 |
CONFDIR := $(MODULEDIR) |
|
| 128 | 127 |
ifeq ($(BUILDDIR),) |
| 129 | 128 |
BUILDDIR := $(PROJECT_PATH)/build |
| 130 | 129 |
endif |
| 131 |
DEPDIR := $(dir $(BUILDDIR)).dep |
|
| 132 |
AMIROOS := ../.. |
|
| 133 |
# Licensing files. |
|
| 134 |
include $(CHIBIOS)/os/license/license.mk |
|
| 135 |
# Startup files. |
|
| 130 |
DEPDIR := $(dir $(BUILDDIR)).dep |
|
| 131 |
|
|
| 132 |
# Linker script. |
|
| 133 |
LDSCRIPT= STM32F103xE.ld |
|
| 134 |
|
|
| 135 |
# General AMiRo-OS files. |
|
| 136 |
include ../../amiroos.mk |
|
| 137 |
|
|
| 138 |
# Module specific ChibiOS files. |
|
| 136 | 139 |
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f1xx.mk |
| 137 |
# HAL-OSAL files (optional). |
|
| 138 |
include $(CHIBIOS)/os/hal/hal.mk |
|
| 139 | 140 |
include $(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/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 | 141 |
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= STM32F103xE.ld |
|
| 162 | 142 |
|
| 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. |
|
| 143 |
# Periphery LLDs. |
|
| 144 |
AMIROOS_PERIPHERYLLD_INC += $(AMIROLLD)/drivers/A3906/v1 \ |
|
| 145 |
$(AMIROLLD)/drivers/AT24C01B/v1 \ |
|
| 146 |
$(AMIROLLD)/drivers/HMC5883L/v1 \ |
|
| 147 |
$(AMIROLLD)/drivers/INA219/v1 \ |
|
| 148 |
$(AMIROLLD)/drivers/L3G4200D/v1 \ |
|
| 149 |
$(AMIROLLD)/drivers/LED/v1 \ |
|
| 150 |
$(AMIROLLD)/drivers/LIS331DLH/v1 \ |
|
| 151 |
$(AMIROLLD)/drivers/LTC4412/v1 \ |
|
| 152 |
$(AMIROLLD)/drivers/PCA9544A/v1 \ |
|
| 153 |
$(AMIROLLD)/drivers/TPS6211x/v1 \ |
|
| 154 |
$(AMIROLLD)/drivers/VCNL4020/v1 |
|
| 155 |
|
|
| 156 |
# Tests. |
|
| 157 |
AMIROOS_TEST_INC += $(AMIROOS_TEST_DIR)periphery-lld/A3906_v1 \ |
|
| 158 |
$(AMIROOS_TEST_DIR)periphery-lld/AT24C01B_v1 \ |
|
| 159 |
$(AMIROOS_TEST_DIR)periphery-lld/HMC5883L_v1 \ |
|
| 160 |
$(AMIROOS_TEST_DIR)periphery-lld/INA219_v1 \ |
|
| 161 |
$(AMIROOS_TEST_DIR)periphery-lld/L3G4200D_v1 \ |
|
Also available in: Unified diff