├── .config ├── .gitignore ├── Kconfig ├── LICENSE ├── Makefile ├── README.md ├── _config.yml ├── application ├── Kconfig ├── application.c ├── cubemx │ ├── .mxproject │ ├── Drivers │ │ ├── CMSIS │ │ │ ├── Device │ │ │ │ └── ST │ │ │ │ │ └── STM32F1xx │ │ │ │ │ ├── Include │ │ │ │ │ ├── stm32f103xb.h │ │ │ │ │ ├── stm32f1xx.h │ │ │ │ │ └── system_stm32f1xx.h │ │ │ │ │ └── License.md │ │ │ ├── Include │ │ │ │ ├── cmsis_armcc.h │ │ │ │ ├── cmsis_armclang.h │ │ │ │ ├── cmsis_compiler.h │ │ │ │ ├── cmsis_gcc.h │ │ │ │ ├── cmsis_iccarm.h │ │ │ │ ├── cmsis_version.h │ │ │ │ ├── core_armv8mbl.h │ │ │ │ ├── core_armv8mml.h │ │ │ │ ├── core_cm0.h │ │ │ │ ├── core_cm0plus.h │ │ │ │ ├── core_cm1.h │ │ │ │ ├── core_cm23.h │ │ │ │ ├── core_cm3.h │ │ │ │ ├── core_cm33.h │ │ │ │ ├── core_cm4.h │ │ │ │ ├── core_cm7.h │ │ │ │ ├── core_sc000.h │ │ │ │ ├── core_sc300.h │ │ │ │ ├── mpu_armv7.h │ │ │ │ ├── mpu_armv8.h │ │ │ │ └── tz_context.h │ │ │ └── LICENSE.txt │ │ └── STM32F1xx_HAL_Driver │ │ │ ├── Inc │ │ │ ├── Legacy │ │ │ │ └── stm32_hal_legacy.h │ │ │ ├── stm32f1xx_hal.h │ │ │ ├── stm32f1xx_hal_cortex.h │ │ │ ├── stm32f1xx_hal_def.h │ │ │ ├── stm32f1xx_hal_dma.h │ │ │ ├── stm32f1xx_hal_dma_ex.h │ │ │ ├── stm32f1xx_hal_exti.h │ │ │ ├── stm32f1xx_hal_flash.h │ │ │ ├── stm32f1xx_hal_flash_ex.h │ │ │ ├── stm32f1xx_hal_gpio.h │ │ │ ├── stm32f1xx_hal_gpio_ex.h │ │ │ ├── stm32f1xx_hal_pwr.h │ │ │ ├── stm32f1xx_hal_rcc.h │ │ │ ├── stm32f1xx_hal_rcc_ex.h │ │ │ ├── stm32f1xx_hal_tim.h │ │ │ ├── stm32f1xx_hal_tim_ex.h │ │ │ ├── stm32f1xx_ll_bus.h │ │ │ ├── stm32f1xx_ll_cortex.h │ │ │ ├── stm32f1xx_ll_dma.h │ │ │ ├── stm32f1xx_ll_exti.h │ │ │ ├── stm32f1xx_ll_gpio.h │ │ │ ├── stm32f1xx_ll_pwr.h │ │ │ ├── stm32f1xx_ll_rcc.h │ │ │ ├── stm32f1xx_ll_system.h │ │ │ └── stm32f1xx_ll_utils.h │ │ │ ├── License.md │ │ │ └── Src │ │ │ ├── stm32f1xx_hal.c │ │ │ ├── stm32f1xx_hal_cortex.c │ │ │ ├── stm32f1xx_hal_dma.c │ │ │ ├── stm32f1xx_hal_exti.c │ │ │ ├── stm32f1xx_hal_flash.c │ │ │ ├── stm32f1xx_hal_flash_ex.c │ │ │ ├── stm32f1xx_hal_gpio.c │ │ │ ├── stm32f1xx_hal_gpio_ex.c │ │ │ ├── stm32f1xx_hal_pwr.c │ │ │ ├── stm32f1xx_hal_rcc.c │ │ │ ├── stm32f1xx_hal_rcc_ex.c │ │ │ ├── stm32f1xx_hal_tim.c │ │ │ └── stm32f1xx_hal_tim_ex.c │ ├── Inc │ │ ├── gpio.h │ │ ├── main.h │ │ ├── stm32f1xx_hal_conf.h │ │ └── stm32f1xx_it.h │ ├── Makefile │ ├── STM32F103C8Tx_FLASH.ld │ ├── Src │ │ ├── gpio.c │ │ ├── main.c │ │ ├── stm32f1xx_hal_msp.c │ │ ├── stm32f1xx_hal_timebase_tim.c │ │ ├── stm32f1xx_it.c │ │ └── system_stm32f1xx.c │ ├── cubemx.ioc │ └── startup_stm32f103xb.s └── kconfig.h ├── components ├── Kconfig └── freertos-10.0.1 │ ├── FreeRTOSConfig.h │ ├── Kconfig │ ├── include │ ├── FreeRTOS.h │ ├── StackMacros.h │ ├── croutine.h │ ├── deprecated_definitions.h │ ├── event_groups.h │ ├── list.h │ ├── message_buffer.h │ ├── mpu_prototypes.h │ ├── mpu_wrappers.h │ ├── portable.h │ ├── projdefs.h │ ├── queue.h │ ├── semphr.h │ ├── stack_macros.h │ ├── stdint.readme │ ├── stream_buffer.h │ ├── task.h │ └── timers.h │ ├── license.txt │ ├── portable │ ├── GCC │ │ └── ARM_CM3 │ │ │ ├── port.c │ │ │ └── portmacro.h │ └── MemMang │ │ └── heap_4.c │ └── source │ ├── croutine.c │ ├── event_groups.c │ ├── list.c │ ├── queue.c │ ├── stream_buffer.c │ ├── tasks.c │ └── timers.c └── scripts ├── Kbuild.include ├── Makefile ├── Makefile.build ├── Makefile.compiler ├── Makefile.host ├── Makefile.lib ├── basic ├── .gitignore ├── Makefile └── fixdep.c ├── kconfig ├── .gitignore ├── Makefile ├── conf.c ├── confdata.c ├── expr.c ├── expr.h ├── gconf-cfg.sh ├── gconf.c ├── gconf.glade ├── images.c ├── images.h ├── internal.h ├── lexer.l ├── list.h ├── lkc.h ├── lkc_proto.h ├── lxdialog │ ├── BIG.FAT.WARNING │ ├── checklist.c │ ├── dialog.h │ ├── inputbox.c │ ├── menubox.c │ ├── textbox.c │ ├── util.c │ └── yesno.c ├── mconf-cfg.sh ├── mconf.c ├── menu.c ├── merge_config.sh ├── nconf-cfg.sh ├── nconf.c ├── nconf.gui.c ├── nconf.h ├── parser.y ├── preprocess.c ├── qconf-cfg.sh ├── qconf.cc ├── qconf.h ├── streamline_config.pl ├── symbol.c └── util.c └── menu ├── blackpill.jpeg ├── compiler ├── ChoiceCDebugLevel ├── ChoiceCLanguageStandard ├── ChoiceCOptimizationLevel ├── FlagCDataSections ├── FlagCFunctionSections ├── FlagCStackUsage ├── FlagCWarnAll ├── FlagCWarnError ├── FlagCWarnExtra ├── FlagCWarnNoUnusedParameter ├── FlagCWarnSwitchDefault ├── FlagCWarnSwitchEnum ├── FlagUsePrintfFloat └── FlagUseScanfFloat └── menuconfig.png /.config: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # MCU App Configuration 4 | # 5 | 6 | # 7 | # Application 8 | # 9 | CONFIG_APP_BLINK_LED_DELAY=500 10 | # end of Application 11 | 12 | # 13 | # Compiler 14 | # 15 | # CONFIG_C_DEBUG_LEVEL_DEPEND_ON_OS is not set 16 | # CONFIG_C_DEBUG_LEVEL_0 is not set 17 | # CONFIG_C_DEBUG_LEVEL_1 is not set 18 | CONFIG_C_DEBUG_LEVEL_3=y 19 | CONFIG_C_DEBUG_LEVEL="-g3" 20 | # CONFIG_STD_C90 is not set 21 | # CONFIG_STD_GNU90 is not set 22 | # CONFIG_STD_C99 is not set 23 | # CONFIG_STD_GNU99 is not set 24 | CONFIG_STD_C11=y 25 | # CONFIG_STD_GNU11 is not set 26 | CONFIG_C_LANGUAGE_STANDARD="c11" 27 | # CONFIG_C_OPTIMIZATION_LEVEL_G is not set 28 | CONFIG_C_OPTIMIZATION_LEVEL_0=y 29 | # CONFIG_C_OPTIMIZATION_LEVEL_1 is not set 30 | # CONFIG_C_OPTIMIZATION_LEVEL_2 is not set 31 | # CONFIG_C_OPTIMIZATION_LEVEL_3 is not set 32 | # CONFIG_C_OPTIMIZATION_LEVEL_S is not set 33 | CONFIG_C_OPTIMIZATION_LEVEL="-O0" 34 | CONFIG_FLAG_C_DATA_SECTIONS=y 35 | CONFIG_C_DATA_SECTIONS="-fdata-sections" 36 | CONFIG_FLAG_C_FUNCTION_SECTIONS=y 37 | CONFIG_C_FUNCTION_SECTIONS="-ffunction-sections" 38 | CONFIG_FLAG_C_STACK_USAGE=y 39 | CONFIG_C_STACK_USAGE="-fstack-usage" 40 | CONFIG_FLAG_C_WARNING_ALL=y 41 | CONFIG_C_WARNING_ALL="-Wall" 42 | # CONFIG_FLAG_C_WARNING_ERROR is not set 43 | CONFIG_FLAG_C_WARNING_EXTRA=y 44 | CONFIG_C_WARNING_EXTRA="-Wextra" 45 | CONFIG_FLAG_C_WARNING_NO_UNUSED_PARAMETER=y 46 | CONFIG_C_WARNING_NO_UNUSED_PARAMETER="-Wno-unused-parameter" 47 | # CONFIG_FLAG_C_WARNING_SWITCH_DEFAULT is not set 48 | CONFIG_FLAG_C_WARNING_SWITCH_ENUM=y 49 | CONFIG_C_WARNING_SWITCH_ENUM="-Wswitch-enum" 50 | # CONFIG_FLAG_USE_PRINTF_FLOAT is not set 51 | # CONFIG_FLAG_USE_SCANF_FLOAT is not set 52 | # end of Compiler 53 | 54 | # 55 | # Components 56 | # 57 | 58 | # 59 | # FreeRTOS 60 | # 61 | CONFIG_FREERTOS_TICK_RATE_HZ=1000 62 | # end of FreeRTOS 63 | # end of Components 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .settings 3 | .cproject 4 | .project 5 | .config.old 6 | 7 | scripts/include 8 | scripts/basic/fixdep 9 | scripts/kconfig/conf 10 | scripts/kconfig/mconf 11 | scripts/kconfig/mconf-bin 12 | scripts/kconfig/mconf-cflags 13 | scripts/kconfig/mconf-libs 14 | scripts/kconfig/nconf 15 | scripts/kconfig/qconf 16 | scripts/kconfig/gconf 17 | 18 | *.o 19 | *.cmd 20 | *.tmp 21 | *.moc 22 | *conf-cfg 23 | lexer.lex.c 24 | parser.tab.* -------------------------------------------------------------------------------- /Kconfig: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | mainmenu "MCU App Configuration" 6 | 7 | menu "Application" 8 | source "application/Kconfig" 9 | endmenu 10 | 11 | menu "Compiler" 12 | source "scripts/menu/compiler/ChoiceCDebugLevel" 13 | source "scripts/menu/compiler/ChoiceCLanguageStandard" 14 | source "scripts/menu/compiler/ChoiceCOptimizationLevel" 15 | source "scripts/menu/compiler/FlagCDataSections" 16 | source "scripts/menu/compiler/FlagCFunctionSections" 17 | source "scripts/menu/compiler/FlagCStackUsage" 18 | source "scripts/menu/compiler/FlagCWarnAll" 19 | source "scripts/menu/compiler/FlagCWarnError" 20 | source "scripts/menu/compiler/FlagCWarnExtra" 21 | source "scripts/menu/compiler/FlagCWarnNoUnusedParameter" 22 | source "scripts/menu/compiler/FlagCWarnSwitchDefault" 23 | source "scripts/menu/compiler/FlagCWarnSwitchEnum" 24 | source "scripts/menu/compiler/FlagUsePrintfFloat" 25 | source "scripts/menu/compiler/FlagUseScanfFloat" 26 | endmenu 27 | 28 | menu "Components" 29 | source "components/Kconfig" 30 | endmenu 31 | 32 | ############################################################################### -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | .PHONY: all build application menuconfig check cloc clean distclean 6 | 7 | -include .config 8 | 9 | OUTDIR = build 10 | CBMXDIR = application/cubemx 11 | DEFINITIONS = -DDEBUG \ 12 | -DSTM32F103xB \ 13 | -DUSE_HAL_DRIVER 14 | 15 | ############################################################################### 16 | 17 | PROJNAME := $(notdir $(shell pwd)) 18 | DIRS := $(shell ls -R components application -Icubemx | grep : | sed 's/://') 19 | 20 | CBMXDIRS := $(shell ls -R $(CBMXDIR) | grep : | sed 's/://') 21 | CBMXASRC := $(wildcard $(addsuffix /*.s, $(CBMXDIR))) 22 | CBMXLD := $(wildcard $(addsuffix /*.ld, $(CBMXDIR))) 23 | CBMXOBJS := $(wildcard $(addsuffix /*.o, $(CBMXDIR)/build)) 24 | 25 | APPLASRC := $(wildcard $(addsuffix /*.s, $(DIRS))) 26 | APPLCSRC := $(wildcard $(addsuffix /*.c, $(DIRS))) 27 | APPLLIBS := $(wildcard $(addsuffix /*.a, $(DIRS))) 28 | APPLOBJS := $(addprefix $(OUTDIR)/, $(APPLASRC:.s=.o)) 29 | APPLOBJS += $(addprefix $(OUTDIR)/, $(APPLCSRC:.c=.o)) 30 | 31 | HEADERS := $(addprefix -I", $(addsuffix ", $(DIRS))) 32 | HEADERS += $(addprefix -I", $(addsuffix ", $(CBMXDIRS))) 33 | LINKERS := $(addprefix -T", $(addsuffix ", $(CBMXLD))) 34 | LIBDIRS := $(addprefix -L", $(addsuffix ", $(dir $(APPLLIBS)))) 35 | LIBS := $(addprefix -l, $(subst lib, , $(subst .a, , $(notdir $(APPLLIBS))))) 36 | 37 | ############################################################################### 38 | 39 | CC = arm-none-eabi-gcc 40 | OBJCOPY = arm-none-eabi-objcopy 41 | SIZE = arm-none-eabi-size 42 | 43 | CPU = $(word 2, $(shell grep ".cpu" $(CBMXASRC))) 44 | 45 | CORE = -mcpu=$(CPU) -mthumb -mfloat-abi=soft 46 | 47 | DEPS = -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" 48 | 49 | OPTIMIZATION = $(subst ",,$(CONFIG_C_OPTIMIZATION_LEVEL)) \ 50 | $(subst ",,$(CONFIG_C_DEBUG_LEVEL)) 51 | 52 | FLAGS = $(subst ",,$(CONFIG_USE_PRINTF_FLOAT)) \ 53 | $(subst ",,$(CONFIG_USE_SCANF_FLOAT)) 54 | 55 | ASFLAGS = $(CORE) -x assembler-with-cpp 56 | 57 | CFLAGS = $(CORE) \ 58 | $(FLAGS) \ 59 | $(OPTIMIZATION) \ 60 | $(DEFINITIONS) \ 61 | -std=$(subst ",,$(CONFIG_C_LANGUAGE_STANDARD)) \ 62 | $(subst ",,$(CONFIG_C_DATA_SECTIONS)) \ 63 | $(subst ",,$(CONFIG_C_FUNCTION_SECTIONS)) \ 64 | $(subst ",,$(CONFIG_C_STACK_USAGE)) \ 65 | $(subst ",,$(CONFIG_C_WARNING_ALL)) \ 66 | $(subst ",,$(CONFIG_C_WARNING_ERROR)) \ 67 | $(subst ",,$(CONFIG_C_WARNING_EXTRA)) \ 68 | $(subst ",,$(CONFIG_C_WARNING_NO_UNUSED_PARAMETER)) \ 69 | $(subst ",,$(CONFIG_C_WARNING_SWITCH_DEFAULT)) \ 70 | $(subst ",,$(CONFIG_C_WARNING_SWITCH_ENUM)) \ 71 | -specs=nano.specs \ 72 | -fmessage-length=0 \ 73 | $(HEADERS) \ 74 | $(DEPS) 75 | 76 | LDFLAGS = $(CORE) \ 77 | $(OPTIMIZATION) \ 78 | $(LINKERS) \ 79 | -Wl,-Map=$(OUTDIR)/$(PROJNAME).map \ 80 | -specs=nosys.specs \ 81 | -specs=nano.specs \ 82 | -Wl,--start-group -lc -lm -Wl,--end-group \ 83 | -Wl,--gc-sections -static 84 | 85 | MAKEFLAGS += --no-print-directory -j 86 | 87 | ############################################################################### 88 | 89 | all: build 90 | build: 91 | @cd $(CBMXDIR) && $(MAKE) -j --no-print-directory 92 | @$(MAKE) -j application --no-print-directory 93 | 94 | application: $(OUTDIR)/$(PROJNAME).bin \ 95 | $(OUTDIR)/$(PROJNAME).siz 96 | 97 | $(OUTDIR)/$(PROJNAME).elf: $(APPLOBJS) 98 | @echo linker: $@ 99 | @$(CC) $(LDFLAGS) $(CBMXOBJS) $(APPLOBJS) $(LIBDIRS) $(LIBS) -o $@ 100 | 101 | $(OUTDIR)/$(PROJNAME).bin: $(OUTDIR)/$(PROJNAME).elf 102 | @echo binary: $@ 103 | @$(OBJCOPY) -O binary $^ $@ 104 | 105 | $(OUTDIR)/$(PROJNAME).siz: $(OUTDIR)/$(PROJNAME).elf 106 | @$(SIZE) --format=berkeley $^ 107 | 108 | $(OUTDIR)/%.o: %.c $(firstword $(MAKEFILE_LIST)) 109 | @echo gcc: $(@F) 110 | @mkdir -p $(@D) 111 | @$(CC) -c $(CFLAGS) '$<' -o '$@' 112 | 113 | menuconfig: 114 | @$(MAKE) -f scripts/Makefile $@ 115 | 116 | check: 117 | @cppcheck --force --quiet -icubemx application 118 | 119 | cloc: 120 | @cloc --quiet --exclude-dir=cubemx application 121 | 122 | clean: 123 | rm -rf $(OUTDIR) 124 | 125 | distclean: clean 126 | rm -rf $(CBMXDIR)/build 127 | @$(MAKE) -f scripts/Makefile clean 128 | 129 | # Dependencies 130 | -include $(CBMXOBJS:.o=.d) 131 | -include $(APPLOBJS:.o=.d) 132 | 133 | ############################################################################### -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kconfig for embedded applications 2 | 3 | This example provides the ability to configure components and application 4 | using kconfig language 5 | ![](scripts/menu/menuconfig.png) 6 | Originally created for STM32 Black Pill but it can be used for any MCU 7 | ![](scripts/menu/blackpill.jpeg) 8 | 9 | Development environment consists of: 10 | * Ubuntu OS 11 | * STM32CubeIDE 12 | * STM32CubeMX 13 | * STM32CubeProg 14 | * [Cppcheck](https://github.com/danmar/cppcheck.git) 15 | * [Cloc](https://github.com/AlDanial/cloc.git) 16 | 17 | ## Install 18 | 19 | ```bash 20 | sudo apt install bison flex 21 | ``` 22 | 23 | ## Get GNU Arm Embedded Toolchain 24 | 25 | ```bash 26 | sudo apt install gcc-arm-none-eabi 27 | ``` 28 | ``` 29 | arm-none-eabi-gcc --version 30 | ``` 31 | 32 | Alternative way is to download 33 | [Arm GNU Toolchain](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) 34 | and setup path to compiler binaries by adding the following line 35 | into ~/.profile with your path to toolchain folder: 36 | 37 | ```bash 38 | export PATH="$PATH:$HOME/path/to/gcc-arm-none-eabi-8-2019-q3-update/bin" 39 | ``` 40 | 41 | Log out and log back in to update PATH variable 42 | 43 | ## Get project and build 44 | 45 | ```bash 46 | git clone https://github.com/mcu/kconfig.git 47 | ``` 48 | ``` 49 | cd kconfig 50 | make menuconfig 51 | make 52 | ``` 53 | ``` 54 | make clean 55 | make -f scripts/Makefile clean 56 | ``` 57 | 58 | ## How it works 59 | 60 | At first, 'make' utility use 'ls' command recursively to create a list of all 61 | folders in the 'components', 'application'. Then 'make' creates a list of all 62 | *.s, *.c, *.ld and *.a files into variables CBMXASRC, CBMXLD, CBMXOBJS... 63 | After that 'make' starts the process of compiling cubemx, components, 64 | application sorce files in parallel, linking and generating binary file. 65 | It's easy but more correctly is to build components separately into 66 | libraries (for advanced developers https://github.com/mcu/kconfig-libs). 67 | 68 | You can change cubemx source files using STM32CubeMX program or replace cubemx 69 | folder with your own, small changes need to be made to the Makefile. 70 | 71 | You can also add *.h, *.c files and folders as you want into "components", 72 | "application" folders. All source files will be compiled 73 | 74 | ## Comment 75 | 76 | Implementation of makefile has its pros and cons. Since all header files 77 | are visible to each source file during the build process it is not recommended 78 | to use this example for large projects 79 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-hacker -------------------------------------------------------------------------------- /application/Kconfig: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config APP_BLINK_LED_DELAY 6 | int "Blink led delay (Milliseconds)" 7 | default 500 8 | range 0 10000 9 | 10 | ############################################################################### -------------------------------------------------------------------------------- /application/application.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * SPDX-License-Identifier: GPL-3.0-or-later 3 | ******************************************************************************/ 4 | 5 | #include "kconfig.h" 6 | #include "FreeRTOS.h" 7 | #include "task.h" 8 | #include "main.h" 9 | 10 | void blink_led_task(void *parameters) 11 | { 12 | for(;;) 13 | { 14 | HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin); 15 | 16 | vTaskDelay(pdMS_TO_TICKS(CONFIG_APP_BLINK_LED_DELAY)); 17 | } 18 | 19 | vTaskDelete(NULL); 20 | } 21 | 22 | void application() 23 | { 24 | BaseType_t status = xTaskCreate(blink_led_task, "LED", 256, NULL, 4, NULL); 25 | if(status == pdFAIL) 26 | { 27 | HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET); 28 | } 29 | 30 | vTaskStartScheduler(); 31 | } 32 | 33 | /*****************************************************************************/ 34 | -------------------------------------------------------------------------------- /application/cubemx/.mxproject: -------------------------------------------------------------------------------- 1 | [PreviousLibFiles] 2 | LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/cmsis_armcc.h; 3 | 4 | [PreviousUsedMakefileFiles] 5 | SourceFiles=Src/main.c;Src/gpio.c;Src/stm32f1xx_it.c;Src/stm32f1xx_hal_msp.c;Src/stm32f1xx_hal_timebase_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Src/system_stm32f1xx.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Src/system_stm32f1xx.c;;; 6 | HeaderPath=Drivers/STM32F1xx_HAL_Driver/Inc;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;Drivers/CMSIS/Device/ST/STM32F1xx/Include;Drivers/CMSIS/Include;Inc; 7 | CDefines=USE_HAL_DRIVER;STM32F103xB;USE_HAL_DRIVER;USE_HAL_DRIVER; 8 | 9 | [PreviousGenFiles] 10 | HeaderPath=../Inc 11 | HeaderFiles=gpio.h;stm32f1xx_it.h;stm32f1xx_hal_conf.h;main.h; 12 | SourcePath=../Src 13 | SourceFiles=gpio.c;stm32f1xx_it.c;stm32f1xx_hal_msp.c;stm32f1xx_hal_timebase_tim.c;main.c; 14 | 15 | -------------------------------------------------------------------------------- /application/cubemx/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcu/kconfig/e17a6a6981f110676aa16e821e1a1e8d7659ee59/application/cubemx/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h -------------------------------------------------------------------------------- /application/cubemx/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcu/kconfig/e17a6a6981f110676aa16e821e1a1e8d7659ee59/application/cubemx/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h -------------------------------------------------------------------------------- /application/cubemx/Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | 20 | /** @addtogroup CMSIS 21 | * @{ 22 | */ 23 | 24 | /** @addtogroup stm32f10x_system 25 | * @{ 26 | */ 27 | 28 | /** 29 | * @brief Define to prevent recursive inclusion 30 | */ 31 | #ifndef __SYSTEM_STM32F10X_H 32 | #define __SYSTEM_STM32F10X_H 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /** @addtogroup STM32F10x_System_Includes 39 | * @{ 40 | */ 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | 47 | /** @addtogroup STM32F10x_System_Exported_types 48 | * @{ 49 | */ 50 | 51 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 52 | extern const uint8_t AHBPrescTable[16U]; /*!< AHB prescalers table values */ 53 | extern const uint8_t APBPrescTable[8U]; /*!< APB prescalers table values */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /application/cubemx/Drivers/CMSIS/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.2 5 | * @date 19. April 2017 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /application/cubemx/Drivers/CMSIS/Include/tz_context.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file tz_context.h 3 | * @brief Context Management for Armv8-M TrustZone 4 | * @version V1.0.1 5 | * @date 10. January 2018 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef TZ_CONTEXT_H 32 | #define TZ_CONTEXT_H 33 | 34 | #include 35 | 36 | #ifndef TZ_MODULEID_T 37 | #define TZ_MODULEID_T 38 | /// \details Data type that identifies secure software modules called by a process. 39 | typedef uint32_t TZ_ModuleId_t; 40 | #endif 41 | 42 | /// \details TZ Memory ID identifies an allocated memory slot. 43 | typedef uint32_t TZ_MemoryId_t; 44 | 45 | /// Initialize secure context memory system 46 | /// \return execution status (1: success, 0: error) 47 | uint32_t TZ_InitContextSystem_S (void); 48 | 49 | /// Allocate context memory for calling secure software modules in TrustZone 50 | /// \param[in] module identifies software modules called from non-secure mode 51 | /// \return value != 0 id TrustZone memory slot identifier 52 | /// \return value 0 no memory available or internal error 53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); 54 | 55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S 56 | /// \param[in] id TrustZone memory slot identifier 57 | /// \return execution status (1: success, 0: error) 58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); 59 | 60 | /// Load secure context (called on RTOS thread context switch) 61 | /// \param[in] id TrustZone memory slot identifier 62 | /// \return execution status (1: success, 0: error) 63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); 64 | 65 | /// Store secure context (called on RTOS thread context switch) 66 | /// \param[in] id TrustZone memory slot identifier 67 | /// \return execution status (1: success, 0: error) 68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); 69 | 70 | #endif // TZ_CONTEXT_H 71 | -------------------------------------------------------------------------------- /application/cubemx/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_def.h 4 | * @author MCD Application Team 5 | * @brief This file contains HAL common defines, enumeration, macros and 6 | * structures definitions. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2017 STMicroelectronics. 11 | * All rights reserved.

12 | * 13 | * This software component is licensed by ST under BSD 3-Clause license, 14 | * the "License"; You may not use this file except in compliance with the 15 | * License. You may obtain a copy of the License at: 16 | * opensource.org/licenses/BSD-3-Clause 17 | * 18 | ****************************************************************************** 19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F1xx_HAL_DEF 23 | #define __STM32F1xx_HAL_DEF 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32f1xx.h" 31 | #include "Legacy/stm32_hal_legacy.h" 32 | #include 33 | 34 | /* Exported types ------------------------------------------------------------*/ 35 | 36 | /** 37 | * @brief HAL Status structures definition 38 | */ 39 | typedef enum 40 | { 41 | HAL_OK = 0x00U, 42 | HAL_ERROR = 0x01U, 43 | HAL_BUSY = 0x02U, 44 | HAL_TIMEOUT = 0x03U 45 | } HAL_StatusTypeDef; 46 | 47 | /** 48 | * @brief HAL Lock structures definition 49 | */ 50 | typedef enum 51 | { 52 | HAL_UNLOCKED = 0x00U, 53 | HAL_LOCKED = 0x01U 54 | } HAL_LockTypeDef; 55 | 56 | /* Exported macro ------------------------------------------------------------*/ 57 | #define HAL_MAX_DELAY 0xFFFFFFFFU 58 | 59 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != 0U) 60 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U) 61 | 62 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ 63 | do{ \ 64 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ 65 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ 66 | } while(0U) 67 | 68 | #define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */ 69 | 70 | /** @brief Reset the Handle's State field. 71 | * @param __HANDLE__ specifies the Peripheral Handle. 72 | * @note This macro can be used for the following purpose: 73 | * - When the Handle is declared as local variable; before passing it as parameter 74 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro 75 | * to set to 0 the Handle's "State" field. 76 | * Otherwise, "State" field may have any random value and the first time the function 77 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed 78 | * (i.e. HAL_PPP_MspInit() will not be executed). 79 | * - When there is a need to reconfigure the low level hardware: instead of calling 80 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). 81 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function 82 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. 83 | * @retval None 84 | */ 85 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U) 86 | 87 | #if (USE_RTOS == 1U) 88 | /* Reserved for future use */ 89 | #error "USE_RTOS should be 0 in the current HAL release" 90 | #else 91 | #define __HAL_LOCK(__HANDLE__) \ 92 | do{ \ 93 | if((__HANDLE__)->Lock == HAL_LOCKED) \ 94 | { \ 95 | return HAL_BUSY; \ 96 | } \ 97 | else \ 98 | { \ 99 | (__HANDLE__)->Lock = HAL_LOCKED; \ 100 | } \ 101 | }while (0U) 102 | 103 | #define __HAL_UNLOCK(__HANDLE__) \ 104 | do{ \ 105 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ 106 | }while (0U) 107 | #endif /* USE_RTOS */ 108 | 109 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 110 | #ifndef __weak 111 | #define __weak __attribute__((weak)) 112 | #endif 113 | #ifndef __packed 114 | #define __packed __attribute__((packed)) 115 | #endif 116 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 117 | #ifndef __weak 118 | #define __weak __attribute__((weak)) 119 | #endif /* __weak */ 120 | #ifndef __packed 121 | #define __packed __attribute__((__packed__)) 122 | #endif /* __packed */ 123 | #endif /* __GNUC__ */ 124 | 125 | 126 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ 127 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 128 | #ifndef __ALIGN_BEGIN 129 | #define __ALIGN_BEGIN 130 | #endif 131 | #ifndef __ALIGN_END 132 | #define __ALIGN_END __attribute__ ((aligned (4))) 133 | #endif 134 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 135 | #ifndef __ALIGN_END 136 | #define __ALIGN_END __attribute__ ((aligned (4))) 137 | #endif /* __ALIGN_END */ 138 | #ifndef __ALIGN_BEGIN 139 | #define __ALIGN_BEGIN 140 | #endif /* __ALIGN_BEGIN */ 141 | #else 142 | #ifndef __ALIGN_END 143 | #define __ALIGN_END 144 | #endif /* __ALIGN_END */ 145 | #ifndef __ALIGN_BEGIN 146 | #if defined (__CC_ARM) /* ARM Compiler V5*/ 147 | #define __ALIGN_BEGIN __align(4) 148 | #elif defined (__ICCARM__) /* IAR Compiler */ 149 | #define __ALIGN_BEGIN 150 | #endif /* __CC_ARM */ 151 | #endif /* __ALIGN_BEGIN */ 152 | #endif /* __GNUC__ */ 153 | 154 | 155 | /** 156 | * @brief __RAM_FUNC definition 157 | */ 158 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) 159 | /* ARM Compiler V4/V5 and V6 160 | -------------------------- 161 | RAM functions are defined using the toolchain options. 162 | Functions that are executed in RAM should reside in a separate source module. 163 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 164 | area of a module to a memory space in physical RAM. 165 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 166 | dialog. 167 | */ 168 | #define __RAM_FUNC 169 | 170 | #elif defined ( __ICCARM__ ) 171 | /* ICCARM Compiler 172 | --------------- 173 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 174 | */ 175 | #define __RAM_FUNC __ramfunc 176 | 177 | #elif defined ( __GNUC__ ) 178 | /* GNU Compiler 179 | ------------ 180 | RAM functions are defined using a specific toolchain attribute 181 | "__attribute__((section(".RamFunc")))". 182 | */ 183 | #define __RAM_FUNC __attribute__((section(".RamFunc"))) 184 | 185 | #endif 186 | 187 | /** 188 | * @brief __NOINLINE definition 189 | */ 190 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ ) 191 | /* ARM V4/V5 and V6 & GNU Compiler 192 | ------------------------------- 193 | */ 194 | #define __NOINLINE __attribute__ ( (noinline) ) 195 | 196 | #elif defined ( __ICCARM__ ) 197 | /* ICCARM Compiler 198 | --------------- 199 | */ 200 | #define __NOINLINE _Pragma("optimize = no_inline") 201 | 202 | #endif 203 | 204 | #ifdef __cplusplus 205 | } 206 | #endif 207 | 208 | #endif /* ___STM32F1xx_HAL_DEF */ 209 | 210 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 211 | -------------------------------------------------------------------------------- /application/cubemx/Drivers/STM32F1xx_HAL_Driver/License.md: -------------------------------------------------------------------------------- 1 | Copyright 2016(-2021) STMicroelectronics. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation and/or 12 | other materials provided with the distribution. 13 | 14 | 3. Neither the name of the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /application/cubemx/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_gpio_ex.c 4 | * @author MCD Application Team 5 | * @brief GPIO Extension HAL module driver. 6 | * This file provides firmware functions to manage the following 7 | * functionalities of the General Purpose Input/Output (GPIO) extension peripheral. 8 | * + Extended features functions 9 | * 10 | @verbatim 11 | ============================================================================== 12 | ##### GPIO Peripheral extension features ##### 13 | ============================================================================== 14 | [..] GPIO module on STM32F1 family, manage also the AFIO register: 15 | (+) Possibility to use the EVENTOUT Cortex feature 16 | 17 | ##### How to use this driver ##### 18 | ============================================================================== 19 | [..] This driver provides functions to use EVENTOUT Cortex feature 20 | (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout() 21 | (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout() 22 | (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout() 23 | 24 | @endverbatim 25 | ****************************************************************************** 26 | * @attention 27 | * 28 | *

© Copyright (c) 2016 STMicroelectronics. 29 | * All rights reserved.

30 | * 31 | * This software component is licensed by ST under BSD 3-Clause license, 32 | * the "License"; You may not use this file except in compliance with the 33 | * License. You may obtain a copy of the License at: 34 | * opensource.org/licenses/BSD-3-Clause 35 | * 36 | ****************************************************************************** 37 | */ 38 | 39 | /* Includes ------------------------------------------------------------------*/ 40 | #include "stm32f1xx_hal.h" 41 | 42 | /** @addtogroup STM32F1xx_HAL_Driver 43 | * @{ 44 | */ 45 | 46 | /** @defgroup GPIOEx GPIOEx 47 | * @brief GPIO HAL module driver 48 | * @{ 49 | */ 50 | 51 | #ifdef HAL_GPIO_MODULE_ENABLED 52 | 53 | /** @defgroup GPIOEx_Exported_Functions GPIOEx Exported Functions 54 | * @{ 55 | */ 56 | 57 | /** @defgroup GPIOEx_Exported_Functions_Group1 Extended features functions 58 | * @brief Extended features functions 59 | * 60 | @verbatim 61 | ============================================================================== 62 | ##### Extended features functions ##### 63 | ============================================================================== 64 | [..] This section provides functions allowing to: 65 | (+) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout() 66 | (+) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout() 67 | (+) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout() 68 | 69 | @endverbatim 70 | * @{ 71 | */ 72 | 73 | /** 74 | * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected. 75 | * @param GPIO_PortSource Select the port used to output the Cortex EVENTOUT signal. 76 | * This parameter can be a value of @ref GPIOEx_EVENTOUT_PORT. 77 | * @param GPIO_PinSource Select the pin used to output the Cortex EVENTOUT signal. 78 | * This parameter can be a value of @ref GPIOEx_EVENTOUT_PIN. 79 | * @retval None 80 | */ 81 | void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource) 82 | { 83 | /* Verify the parameters */ 84 | assert_param(IS_AFIO_EVENTOUT_PORT(GPIO_PortSource)); 85 | assert_param(IS_AFIO_EVENTOUT_PIN(GPIO_PinSource)); 86 | 87 | /* Apply the new configuration */ 88 | MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT) | (AFIO_EVCR_PIN), (GPIO_PortSource) | (GPIO_PinSource)); 89 | } 90 | 91 | /** 92 | * @brief Enables the Event Output. 93 | * @retval None 94 | */ 95 | void HAL_GPIOEx_EnableEventout(void) 96 | { 97 | SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); 98 | } 99 | 100 | /** 101 | * @brief Disables the Event Output. 102 | * @retval None 103 | */ 104 | void HAL_GPIOEx_DisableEventout(void) 105 | { 106 | CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); 107 | } 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | #endif /* HAL_GPIO_MODULE_ENABLED */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 128 | -------------------------------------------------------------------------------- /application/cubemx/Inc/gpio.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file gpio.h 5 | * @brief This file contains all the function prototypes for 6 | * the gpio.c file 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | * Copyright (c) 2023 STMicroelectronics. 11 | * All rights reserved. 12 | * 13 | * This software is licensed under terms that can be found in the LICENSE file 14 | * in the root directory of this software component. 15 | * If no LICENSE file comes with this software, it is provided AS-IS. 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __GPIO_H__ 22 | #define __GPIO_H__ 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "main.h" 30 | 31 | /* USER CODE BEGIN Includes */ 32 | 33 | /* USER CODE END Includes */ 34 | 35 | /* USER CODE BEGIN Private defines */ 36 | 37 | /* USER CODE END Private defines */ 38 | 39 | void MX_GPIO_Init(void); 40 | 41 | /* USER CODE BEGIN Prototypes */ 42 | 43 | /* USER CODE END Prototypes */ 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | #endif /*__ GPIO_H__ */ 49 | 50 | -------------------------------------------------------------------------------- /application/cubemx/Inc/main.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : main.h 5 | * @brief : Header for main.c file. 6 | * This file contains the common defines of the application. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2019 STMicroelectronics. 11 | * All rights reserved.

12 | * 13 | * This software component is licensed by ST under BSD 3-Clause license, 14 | * the "License"; You may not use this file except in compliance with the 15 | * License. You may obtain a copy of the License at: 16 | * opensource.org/licenses/BSD-3-Clause 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __MAIN_H 24 | #define __MAIN_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f1xx_hal.h" 32 | 33 | /* Private includes ----------------------------------------------------------*/ 34 | /* USER CODE BEGIN Includes */ 35 | 36 | /* USER CODE END Includes */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* USER CODE BEGIN ET */ 40 | 41 | /* USER CODE END ET */ 42 | 43 | /* Exported constants --------------------------------------------------------*/ 44 | /* USER CODE BEGIN EC */ 45 | 46 | /* USER CODE END EC */ 47 | 48 | /* Exported macro ------------------------------------------------------------*/ 49 | /* USER CODE BEGIN EM */ 50 | 51 | /* USER CODE END EM */ 52 | 53 | /* Exported functions prototypes ---------------------------------------------*/ 54 | void Error_Handler(void); 55 | 56 | /* USER CODE BEGIN EFP */ 57 | 58 | /* USER CODE END EFP */ 59 | 60 | /* Private defines -----------------------------------------------------------*/ 61 | #define LED_Pin GPIO_PIN_12 62 | #define LED_GPIO_Port GPIOB 63 | 64 | /* USER CODE BEGIN Private defines */ 65 | 66 | /* USER CODE END Private defines */ 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* __MAIN_H */ 73 | -------------------------------------------------------------------------------- /application/cubemx/Inc/stm32f1xx_it.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_it.h 5 | * @brief This file contains the headers of the interrupt handlers. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2019 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F1xx_IT_H 23 | #define __STM32F1xx_IT_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Private includes ----------------------------------------------------------*/ 30 | /* USER CODE BEGIN Includes */ 31 | 32 | /* USER CODE END Includes */ 33 | 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* USER CODE BEGIN ET */ 36 | 37 | /* USER CODE END ET */ 38 | 39 | /* Exported constants --------------------------------------------------------*/ 40 | /* USER CODE BEGIN EC */ 41 | 42 | /* USER CODE END EC */ 43 | 44 | /* Exported macro ------------------------------------------------------------*/ 45 | /* USER CODE BEGIN EM */ 46 | 47 | /* USER CODE END EM */ 48 | 49 | /* Exported functions prototypes ---------------------------------------------*/ 50 | void NMI_Handler(void); 51 | void HardFault_Handler(void); 52 | void MemManage_Handler(void); 53 | void BusFault_Handler(void); 54 | void UsageFault_Handler(void); 55 | void DebugMon_Handler(void); 56 | void TIM1_UP_IRQHandler(void); 57 | /* USER CODE BEGIN EFP */ 58 | 59 | /* USER CODE END EFP */ 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif /* __STM32F1xx_IT_H */ 66 | -------------------------------------------------------------------------------- /application/cubemx/Makefile: -------------------------------------------------------------------------------- 1 | ########################################################################################################################## 2 | # File automatically-generated by tool: [projectgenerator] version: [3.18.0-B7] date: [Mon Mar 13 12:55:29 GMT+02:00 2023] 3 | ########################################################################################################################## 4 | 5 | # ------------------------------------------------ 6 | # Generic Makefile (based on gcc) 7 | # 8 | # ChangeLog : 9 | # 2017-02-10 - Several enhancements + project update mode 10 | # 2015-07-22 - first version 11 | # ------------------------------------------------ 12 | 13 | ###################################### 14 | # target 15 | ###################################### 16 | TARGET = cubemx 17 | 18 | 19 | ###################################### 20 | # building variables 21 | ###################################### 22 | # debug build? 23 | DEBUG = 0 24 | # optimization 25 | OPT = -Os 26 | 27 | 28 | ####################################### 29 | # paths 30 | ####################################### 31 | # Build path 32 | BUILD_DIR = build 33 | 34 | ###################################### 35 | # source 36 | ###################################### 37 | # C sources 38 | C_SOURCES = \ 39 | Src/main.c \ 40 | Src/gpio.c \ 41 | Src/stm32f1xx_hal_timebase_tim.c \ 42 | Src/stm32f1xx_it.c \ 43 | Src/stm32f1xx_hal_msp.c \ 44 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \ 45 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ 46 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ 47 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ 48 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \ 49 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \ 50 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \ 51 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \ 52 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \ 53 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \ 54 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \ 55 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \ 56 | Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \ 57 | Src/system_stm32f1xx.c 58 | 59 | # ASM sources 60 | ASM_SOURCES = \ 61 | startup_stm32f103xb.s 62 | 63 | 64 | ####################################### 65 | # binaries 66 | ####################################### 67 | PREFIX = arm-none-eabi- 68 | # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) 69 | # either it can be added to the PATH environment variable. 70 | ifdef GCC_PATH 71 | CC = $(GCC_PATH)/$(PREFIX)gcc 72 | AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp 73 | CP = $(GCC_PATH)/$(PREFIX)objcopy 74 | SZ = $(GCC_PATH)/$(PREFIX)size 75 | else 76 | CC = $(PREFIX)gcc 77 | AS = $(PREFIX)gcc -x assembler-with-cpp 78 | CP = $(PREFIX)objcopy 79 | SZ = $(PREFIX)size 80 | endif 81 | HEX = $(CP) -O ihex 82 | BIN = $(CP) -O binary -S 83 | 84 | ####################################### 85 | # CFLAGS 86 | ####################################### 87 | # cpu 88 | CPU = -mcpu=cortex-m3 89 | 90 | # fpu 91 | # NONE for Cortex-M0/M0+/M3 92 | 93 | # float-abi 94 | 95 | 96 | # mcu 97 | MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) 98 | 99 | # macros for gcc 100 | # AS defines 101 | AS_DEFS = 102 | 103 | # C defines 104 | C_DEFS = \ 105 | -DUSE_HAL_DRIVER \ 106 | -DSTM32F103xB 107 | 108 | 109 | # AS includes 110 | AS_INCLUDES = 111 | 112 | # C includes 113 | C_INCLUDES = \ 114 | -IInc \ 115 | -IDrivers/STM32F1xx_HAL_Driver/Inc \ 116 | -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \ 117 | -IDrivers/CMSIS/Device/ST/STM32F1xx/Include \ 118 | -IDrivers/CMSIS/Include 119 | 120 | 121 | # compile gcc flags 122 | ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 123 | 124 | CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections 125 | 126 | ifeq ($(DEBUG), 1) 127 | CFLAGS += -g -gdwarf-2 128 | endif 129 | 130 | 131 | # Generate dependency information 132 | CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" 133 | 134 | 135 | ####################################### 136 | # LDFLAGS 137 | ####################################### 138 | # link script 139 | LDSCRIPT = STM32F103C8Tx_FLASH.ld 140 | 141 | # libraries 142 | LIBS = -lc -lm -lnosys 143 | LIBDIR = 144 | LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections 145 | 146 | 147 | ####################################### 148 | # build the application 149 | ####################################### 150 | # list of objects 151 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) 152 | vpath %.c $(sort $(dir $(C_SOURCES))) 153 | # list of ASM program objects 154 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) 155 | vpath %.s $(sort $(dir $(ASM_SOURCES))) 156 | 157 | all: $(OBJECTS) Makefile 158 | @: # no print "Nothing to be done for 'all'" 159 | 160 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 161 | @echo cbmx: $(@F) 162 | @$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ 163 | 164 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) 165 | @echo cbmx: $(@F) 166 | @$(AS) -c $(CFLAGS) $< -o $@ 167 | 168 | $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile 169 | $(CC) $(OBJECTS) $(LDFLAGS) -o $@ 170 | $(SZ) $@ 171 | 172 | $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 173 | $(HEX) $< $@ 174 | 175 | $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) 176 | $(BIN) $< $@ 177 | 178 | $(BUILD_DIR): 179 | mkdir $@ 180 | 181 | ####################################### 182 | # clean up 183 | ####################################### 184 | clean: 185 | -rm -fR $(BUILD_DIR) 186 | 187 | ####################################### 188 | # dependencies 189 | ####################################### 190 | -include $(wildcard $(BUILD_DIR)/*.d) 191 | 192 | # *** EOF *** 193 | -------------------------------------------------------------------------------- /application/cubemx/STM32F103C8Tx_FLASH.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ****************************************************************************** 3 | ** 4 | 5 | ** File : LinkerScript.ld 6 | ** 7 | ** Author : Auto-generated by System Workbench for STM32 8 | ** 9 | ** Abstract : Linker script for STM32F103C8Tx series 10 | ** 64Kbytes FLASH and 20Kbytes RAM 11 | ** 12 | ** Set heap size, stack size and stack location according 13 | ** to application requirements. 14 | ** 15 | ** Set memory bank area and size if external memory is used. 16 | ** 17 | ** Target : STMicroelectronics STM32 18 | ** 19 | ** Distribution: The file is distributed “as is,” without any warranty 20 | ** of any kind. 21 | ** 22 | ***************************************************************************** 23 | ** @attention 24 | ** 25 | **

© COPYRIGHT(c) 2019 STMicroelectronics

26 | ** 27 | ** Redistribution and use in source and binary forms, with or without modification, 28 | ** are permitted provided that the following conditions are met: 29 | ** 1. Redistributions of source code must retain the above copyright notice, 30 | ** this list of conditions and the following disclaimer. 31 | ** 2. Redistributions in binary form must reproduce the above copyright notice, 32 | ** this list of conditions and the following disclaimer in the documentation 33 | ** and/or other materials provided with the distribution. 34 | ** 3. Neither the name of STMicroelectronics nor the names of its contributors 35 | ** may be used to endorse or promote products derived from this software 36 | ** without specific prior written permission. 37 | ** 38 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 39 | ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40 | ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 42 | ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 43 | ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 44 | ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 45 | ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 46 | ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 47 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | ** 49 | ***************************************************************************** 50 | */ 51 | 52 | /* Entry Point */ 53 | ENTRY(Reset_Handler) 54 | 55 | /* Highest address of the user mode stack */ 56 | _estack = 0x20005000; /* end of RAM */ 57 | /* Generate a link error if heap and stack don't fit into RAM */ 58 | _Min_Heap_Size = 0x200; /* required amount of heap */ 59 | _Min_Stack_Size = 0x400; /* required amount of stack */ 60 | 61 | /* Specify the memory areas */ 62 | MEMORY 63 | { 64 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K 65 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K 66 | } 67 | 68 | /* Define output sections */ 69 | SECTIONS 70 | { 71 | /* The startup code goes first into FLASH */ 72 | .isr_vector : 73 | { 74 | . = ALIGN(4); 75 | KEEP(*(.isr_vector)) /* Startup code */ 76 | . = ALIGN(4); 77 | } >FLASH 78 | 79 | /* The program code and other data goes into FLASH */ 80 | .text : 81 | { 82 | . = ALIGN(4); 83 | *(.text) /* .text sections (code) */ 84 | *(.text*) /* .text* sections (code) */ 85 | *(.glue_7) /* glue arm to thumb code */ 86 | *(.glue_7t) /* glue thumb to arm code */ 87 | *(.eh_frame) 88 | 89 | KEEP (*(.init)) 90 | KEEP (*(.fini)) 91 | 92 | . = ALIGN(4); 93 | _etext = .; /* define a global symbols at end of code */ 94 | } >FLASH 95 | 96 | /* Constant data goes into FLASH */ 97 | .rodata : 98 | { 99 | . = ALIGN(4); 100 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 101 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 102 | . = ALIGN(4); 103 | } >FLASH 104 | 105 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH 106 | .ARM : { 107 | __exidx_start = .; 108 | *(.ARM.exidx*) 109 | __exidx_end = .; 110 | } >FLASH 111 | 112 | .preinit_array : 113 | { 114 | PROVIDE_HIDDEN (__preinit_array_start = .); 115 | KEEP (*(.preinit_array*)) 116 | PROVIDE_HIDDEN (__preinit_array_end = .); 117 | } >FLASH 118 | .init_array : 119 | { 120 | PROVIDE_HIDDEN (__init_array_start = .); 121 | KEEP (*(SORT(.init_array.*))) 122 | KEEP (*(.init_array*)) 123 | PROVIDE_HIDDEN (__init_array_end = .); 124 | } >FLASH 125 | .fini_array : 126 | { 127 | PROVIDE_HIDDEN (__fini_array_start = .); 128 | KEEP (*(SORT(.fini_array.*))) 129 | KEEP (*(.fini_array*)) 130 | PROVIDE_HIDDEN (__fini_array_end = .); 131 | } >FLASH 132 | 133 | /* used by the startup to initialize data */ 134 | _sidata = LOADADDR(.data); 135 | 136 | /* Initialized data sections goes into RAM, load LMA copy after code */ 137 | .data : 138 | { 139 | . = ALIGN(4); 140 | _sdata = .; /* create a global symbol at data start */ 141 | *(.data) /* .data sections */ 142 | *(.data*) /* .data* sections */ 143 | 144 | . = ALIGN(4); 145 | _edata = .; /* define a global symbol at data end */ 146 | } >RAM AT> FLASH 147 | 148 | 149 | /* Uninitialized data section */ 150 | . = ALIGN(4); 151 | .bss : 152 | { 153 | /* This is used by the startup in order to initialize the .bss secion */ 154 | _sbss = .; /* define a global symbol at bss start */ 155 | __bss_start__ = _sbss; 156 | *(.bss) 157 | *(.bss*) 158 | *(COMMON) 159 | 160 | . = ALIGN(4); 161 | _ebss = .; /* define a global symbol at bss end */ 162 | __bss_end__ = _ebss; 163 | } >RAM 164 | 165 | /* User_heap_stack section, used to check that there is enough RAM left */ 166 | ._user_heap_stack : 167 | { 168 | . = ALIGN(8); 169 | PROVIDE ( end = . ); 170 | PROVIDE ( _end = . ); 171 | . = . + _Min_Heap_Size; 172 | . = . + _Min_Stack_Size; 173 | . = ALIGN(8); 174 | } >RAM 175 | 176 | 177 | 178 | /* Remove information from the standard libraries */ 179 | /DISCARD/ : 180 | { 181 | libc.a ( * ) 182 | libm.a ( * ) 183 | libgcc.a ( * ) 184 | } 185 | 186 | .ARM.attributes 0 : { *(.ARM.attributes) } 187 | } 188 | 189 | 190 | -------------------------------------------------------------------------------- /application/cubemx/Src/gpio.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file gpio.c 5 | * @brief This file provides code for the configuration 6 | * of all used GPIO pins. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | * Copyright (c) 2023 STMicroelectronics. 11 | * All rights reserved. 12 | * 13 | * This software is licensed under terms that can be found in the LICENSE file 14 | * in the root directory of this software component. 15 | * If no LICENSE file comes with this software, it is provided AS-IS. 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "gpio.h" 23 | 24 | /* USER CODE BEGIN 0 */ 25 | 26 | /* USER CODE END 0 */ 27 | 28 | /*----------------------------------------------------------------------------*/ 29 | /* Configure GPIO */ 30 | /*----------------------------------------------------------------------------*/ 31 | /* USER CODE BEGIN 1 */ 32 | 33 | /* USER CODE END 1 */ 34 | 35 | /** Configure pins as 36 | * Analog 37 | * Input 38 | * Output 39 | * EVENT_OUT 40 | * EXTI 41 | * Free pins are configured automatically as Analog (this feature is enabled through 42 | * the Code Generation settings) 43 | */ 44 | void MX_GPIO_Init(void) 45 | { 46 | 47 | GPIO_InitTypeDef GPIO_InitStruct = {0}; 48 | 49 | /* GPIO Ports Clock Enable */ 50 | __HAL_RCC_GPIOC_CLK_ENABLE(); 51 | __HAL_RCC_GPIOD_CLK_ENABLE(); 52 | __HAL_RCC_GPIOA_CLK_ENABLE(); 53 | __HAL_RCC_GPIOB_CLK_ENABLE(); 54 | 55 | /*Configure GPIO pin Output Level */ 56 | HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET); 57 | 58 | /*Configure GPIO pins : PC13 PC14 PC15 */ 59 | GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15; 60 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; 61 | HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); 62 | 63 | /*Configure GPIO pins : PA0 PA1 PA2 PA3 64 | PA4 PA5 PA6 PA7 65 | PA8 PA9 PA10 PA11 66 | PA12 PA15 */ 67 | GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3 68 | |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7 69 | |GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11 70 | |GPIO_PIN_12|GPIO_PIN_15; 71 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; 72 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); 73 | 74 | /*Configure GPIO pins : PB0 PB1 PB2 PB10 75 | PB11 PB13 PB14 PB15 76 | PB3 PB4 PB5 PB6 77 | PB7 PB8 PB9 */ 78 | GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_10 79 | |GPIO_PIN_11|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15 80 | |GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6 81 | |GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9; 82 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; 83 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); 84 | 85 | /*Configure GPIO pin : PtPin */ 86 | GPIO_InitStruct.Pin = LED_Pin; 87 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; 88 | GPIO_InitStruct.Pull = GPIO_NOPULL; 89 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; 90 | HAL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct); 91 | 92 | } 93 | 94 | /* USER CODE BEGIN 2 */ 95 | 96 | /* USER CODE END 2 */ 97 | -------------------------------------------------------------------------------- /application/cubemx/Src/main.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : main.c 5 | * @brief : Main program body 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2019 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "main.h" 22 | #include "gpio.h" 23 | 24 | /* Private includes ----------------------------------------------------------*/ 25 | /* USER CODE BEGIN Includes */ 26 | 27 | /* USER CODE END Includes */ 28 | 29 | /* Private typedef -----------------------------------------------------------*/ 30 | /* USER CODE BEGIN PTD */ 31 | 32 | /* USER CODE END PTD */ 33 | 34 | /* Private define ------------------------------------------------------------*/ 35 | /* USER CODE BEGIN PD */ 36 | /* USER CODE END PD */ 37 | 38 | /* Private macro -------------------------------------------------------------*/ 39 | /* USER CODE BEGIN PM */ 40 | 41 | /* USER CODE END PM */ 42 | 43 | /* Private variables ---------------------------------------------------------*/ 44 | 45 | /* USER CODE BEGIN PV */ 46 | 47 | /* USER CODE END PV */ 48 | 49 | /* Private function prototypes -----------------------------------------------*/ 50 | void SystemClock_Config(void); 51 | /* USER CODE BEGIN PFP */ 52 | void application(); 53 | /* USER CODE END PFP */ 54 | 55 | /* Private user code ---------------------------------------------------------*/ 56 | /* USER CODE BEGIN 0 */ 57 | 58 | /* USER CODE END 0 */ 59 | 60 | /** 61 | * @brief The application entry point. 62 | * @retval int 63 | */ 64 | int main(void) 65 | { 66 | /* USER CODE BEGIN 1 */ 67 | 68 | /* USER CODE END 1 */ 69 | 70 | /* MCU Configuration--------------------------------------------------------*/ 71 | 72 | /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ 73 | HAL_Init(); 74 | 75 | /* USER CODE BEGIN Init */ 76 | 77 | /* USER CODE END Init */ 78 | 79 | /* Configure the system clock */ 80 | SystemClock_Config(); 81 | 82 | /* USER CODE BEGIN SysInit */ 83 | 84 | /* USER CODE END SysInit */ 85 | 86 | /* Initialize all configured peripherals */ 87 | MX_GPIO_Init(); 88 | /* USER CODE BEGIN 2 */ 89 | application(); 90 | /* USER CODE END 2 */ 91 | 92 | /* Infinite loop */ 93 | /* USER CODE BEGIN WHILE */ 94 | while (1) 95 | { 96 | /* USER CODE END WHILE */ 97 | 98 | /* USER CODE BEGIN 3 */ 99 | } 100 | /* USER CODE END 3 */ 101 | } 102 | 103 | /** 104 | * @brief System Clock Configuration 105 | * @retval None 106 | */ 107 | void SystemClock_Config(void) 108 | { 109 | RCC_OscInitTypeDef RCC_OscInitStruct = {0}; 110 | RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; 111 | 112 | /** Initializes the RCC Oscillators according to the specified parameters 113 | * in the RCC_OscInitTypeDef structure. 114 | */ 115 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; 116 | RCC_OscInitStruct.HSEState = RCC_HSE_ON; 117 | RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1; 118 | RCC_OscInitStruct.HSIState = RCC_HSI_ON; 119 | RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; 120 | RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; 121 | RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; 122 | if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) 123 | { 124 | Error_Handler(); 125 | } 126 | 127 | /** Initializes the CPU, AHB and APB buses clocks 128 | */ 129 | RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK 130 | |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; 131 | RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; 132 | RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; 133 | RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; 134 | RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; 135 | 136 | if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) 137 | { 138 | Error_Handler(); 139 | } 140 | } 141 | 142 | /* USER CODE BEGIN 4 */ 143 | 144 | /* USER CODE END 4 */ 145 | 146 | /** 147 | * @brief Period elapsed callback in non blocking mode 148 | * @note This function is called when TIM1 interrupt took place, inside 149 | * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment 150 | * a global variable "uwTick" used as application time base. 151 | * @param htim : TIM handle 152 | * @retval None 153 | */ 154 | void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) 155 | { 156 | /* USER CODE BEGIN Callback 0 */ 157 | 158 | /* USER CODE END Callback 0 */ 159 | if (htim->Instance == TIM1) { 160 | HAL_IncTick(); 161 | } 162 | /* USER CODE BEGIN Callback 1 */ 163 | 164 | /* USER CODE END Callback 1 */ 165 | } 166 | 167 | /** 168 | * @brief This function is executed in case of error occurrence. 169 | * @retval None 170 | */ 171 | void Error_Handler(void) 172 | { 173 | /* USER CODE BEGIN Error_Handler_Debug */ 174 | /* User can add his own implementation to report the HAL error return state */ 175 | 176 | /* USER CODE END Error_Handler_Debug */ 177 | } 178 | 179 | #ifdef USE_FULL_ASSERT 180 | /** 181 | * @brief Reports the name of the source file and the source line number 182 | * where the assert_param error has occurred. 183 | * @param file: pointer to the source file name 184 | * @param line: assert_param error line source number 185 | * @retval None 186 | */ 187 | void assert_failed(uint8_t *file, uint32_t line) 188 | { 189 | /* USER CODE BEGIN 6 */ 190 | /* User can add his own implementation to report the file name and line number, 191 | tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ 192 | /* USER CODE END 6 */ 193 | } 194 | #endif /* USE_FULL_ASSERT */ 195 | -------------------------------------------------------------------------------- /application/cubemx/Src/stm32f1xx_hal_msp.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * File Name : stm32f1xx_hal_msp.c 5 | * Description : This file provides code for the MSP Initialization 6 | * and de-Initialization codes. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2019 STMicroelectronics. 11 | * All rights reserved.

12 | * 13 | * This software component is licensed by ST under BSD 3-Clause license, 14 | * the "License"; You may not use this file except in compliance with the 15 | * License. You may obtain a copy of the License at: 16 | * opensource.org/licenses/BSD-3-Clause 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "main.h" 24 | /* USER CODE BEGIN Includes */ 25 | 26 | /* USER CODE END Includes */ 27 | 28 | /* Private typedef -----------------------------------------------------------*/ 29 | /* USER CODE BEGIN TD */ 30 | 31 | /* USER CODE END TD */ 32 | 33 | /* Private define ------------------------------------------------------------*/ 34 | /* USER CODE BEGIN Define */ 35 | 36 | /* USER CODE END Define */ 37 | 38 | /* Private macro -------------------------------------------------------------*/ 39 | /* USER CODE BEGIN Macro */ 40 | 41 | /* USER CODE END Macro */ 42 | 43 | /* Private variables ---------------------------------------------------------*/ 44 | /* USER CODE BEGIN PV */ 45 | 46 | /* USER CODE END PV */ 47 | 48 | /* Private function prototypes -----------------------------------------------*/ 49 | /* USER CODE BEGIN PFP */ 50 | 51 | /* USER CODE END PFP */ 52 | 53 | /* External functions --------------------------------------------------------*/ 54 | /* USER CODE BEGIN ExternalFunctions */ 55 | 56 | /* USER CODE END ExternalFunctions */ 57 | 58 | /* USER CODE BEGIN 0 */ 59 | 60 | /* USER CODE END 0 */ 61 | /** 62 | * Initializes the Global MSP. 63 | */ 64 | void HAL_MspInit(void) 65 | { 66 | /* USER CODE BEGIN MspInit 0 */ 67 | 68 | /* USER CODE END MspInit 0 */ 69 | 70 | __HAL_RCC_AFIO_CLK_ENABLE(); 71 | __HAL_RCC_PWR_CLK_ENABLE(); 72 | 73 | /* System interrupt init*/ 74 | 75 | /** NOJTAG: JTAG-DP Disabled and SW-DP Enabled 76 | */ 77 | __HAL_AFIO_REMAP_SWJ_NOJTAG(); 78 | 79 | /* USER CODE BEGIN MspInit 1 */ 80 | 81 | /* USER CODE END MspInit 1 */ 82 | } 83 | 84 | /* USER CODE BEGIN 1 */ 85 | 86 | /* USER CODE END 1 */ 87 | -------------------------------------------------------------------------------- /application/cubemx/Src/stm32f1xx_hal_timebase_tim.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_hal_timebase_TIM.c 5 | * @brief HAL time base based on the hardware TIM. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2019 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "stm32f1xx_hal.h" 23 | #include "stm32f1xx_hal_tim.h" 24 | 25 | /* Private typedef -----------------------------------------------------------*/ 26 | /* Private define ------------------------------------------------------------*/ 27 | /* Private macro -------------------------------------------------------------*/ 28 | /* Private variables ---------------------------------------------------------*/ 29 | TIM_HandleTypeDef htim1; 30 | /* Private function prototypes -----------------------------------------------*/ 31 | void TIM1_IRQHandler(void); 32 | /* Private functions ---------------------------------------------------------*/ 33 | 34 | /** 35 | * @brief This function configures the TIM1 as a time base source. 36 | * The time source is configured to have 1ms time base with a dedicated 37 | * Tick interrupt priority. 38 | * @note This function is called automatically at the beginning of program after 39 | * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig(). 40 | * @param TickPriority: Tick interrupt priority. 41 | * @retval HAL status 42 | */ 43 | HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) 44 | { 45 | RCC_ClkInitTypeDef clkconfig; 46 | uint32_t uwTimclock = 0U; 47 | 48 | uint32_t uwPrescalerValue = 0U; 49 | uint32_t pFLatency; 50 | HAL_StatusTypeDef status = HAL_OK; 51 | 52 | /* Enable TIM1 clock */ 53 | __HAL_RCC_TIM1_CLK_ENABLE(); 54 | 55 | /* Get clock configuration */ 56 | HAL_RCC_GetClockConfig(&clkconfig, &pFLatency); 57 | 58 | /* Compute TIM1 clock */ 59 | uwTimclock = HAL_RCC_GetPCLK2Freq(); 60 | 61 | /* Compute the prescaler value to have TIM1 counter clock equal to 1MHz */ 62 | uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000U) - 1U); 63 | 64 | /* Initialize TIM1 */ 65 | htim1.Instance = TIM1; 66 | 67 | /* Initialize TIMx peripheral as follow: 68 | + Period = [(TIM1CLK/1000) - 1]. to have a (1/1000) s time base. 69 | + Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock. 70 | + ClockDivision = 0 71 | + Counter direction = Up 72 | */ 73 | htim1.Init.Period = (1000000U / 1000U) - 1U; 74 | htim1.Init.Prescaler = uwPrescalerValue; 75 | htim1.Init.ClockDivision = 0; 76 | htim1.Init.CounterMode = TIM_COUNTERMODE_UP; 77 | htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; 78 | 79 | status = HAL_TIM_Base_Init(&htim1); 80 | if (status == HAL_OK) 81 | { 82 | /* Start the TIM time Base generation in interrupt mode */ 83 | status = HAL_TIM_Base_Start_IT(&htim1); 84 | if (status == HAL_OK) 85 | { 86 | /* Enable the TIM1 global Interrupt */ 87 | HAL_NVIC_EnableIRQ(TIM1_UP_IRQn); 88 | /* Configure the SysTick IRQ priority */ 89 | if (TickPriority < (1UL << __NVIC_PRIO_BITS)) 90 | { 91 | /* Configure the TIM IRQ priority */ 92 | HAL_NVIC_SetPriority(TIM1_UP_IRQn, TickPriority, 0U); 93 | uwTickPrio = TickPriority; 94 | } 95 | else 96 | { 97 | status = HAL_ERROR; 98 | } 99 | } 100 | } 101 | 102 | /* Return function status */ 103 | return status; 104 | } 105 | 106 | /** 107 | * @brief Suspend Tick increment. 108 | * @note Disable the tick increment by disabling TIM1 update interrupt. 109 | * @param None 110 | * @retval None 111 | */ 112 | void HAL_SuspendTick(void) 113 | { 114 | /* Disable TIM1 update Interrupt */ 115 | __HAL_TIM_DISABLE_IT(&htim1, TIM_IT_UPDATE); 116 | } 117 | 118 | /** 119 | * @brief Resume Tick increment. 120 | * @note Enable the tick increment by Enabling TIM1 update interrupt. 121 | * @param None 122 | * @retval None 123 | */ 124 | void HAL_ResumeTick(void) 125 | { 126 | /* Enable TIM1 Update interrupt */ 127 | __HAL_TIM_ENABLE_IT(&htim1, TIM_IT_UPDATE); 128 | } 129 | 130 | -------------------------------------------------------------------------------- /application/cubemx/Src/stm32f1xx_it.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_it.c 5 | * @brief Interrupt Service Routines. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2019 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "main.h" 23 | #include "stm32f1xx_it.h" 24 | /* Private includes ----------------------------------------------------------*/ 25 | /* USER CODE BEGIN Includes */ 26 | /* USER CODE END Includes */ 27 | 28 | /* Private typedef -----------------------------------------------------------*/ 29 | /* USER CODE BEGIN TD */ 30 | 31 | /* USER CODE END TD */ 32 | 33 | /* Private define ------------------------------------------------------------*/ 34 | /* USER CODE BEGIN PD */ 35 | 36 | /* USER CODE END PD */ 37 | 38 | /* Private macro -------------------------------------------------------------*/ 39 | /* USER CODE BEGIN PM */ 40 | 41 | /* USER CODE END PM */ 42 | 43 | /* Private variables ---------------------------------------------------------*/ 44 | /* USER CODE BEGIN PV */ 45 | 46 | /* USER CODE END PV */ 47 | 48 | /* Private function prototypes -----------------------------------------------*/ 49 | /* USER CODE BEGIN PFP */ 50 | 51 | /* USER CODE END PFP */ 52 | 53 | /* Private user code ---------------------------------------------------------*/ 54 | /* USER CODE BEGIN 0 */ 55 | 56 | /* USER CODE END 0 */ 57 | 58 | /* External variables --------------------------------------------------------*/ 59 | extern TIM_HandleTypeDef htim1; 60 | 61 | /* USER CODE BEGIN EV */ 62 | 63 | /* USER CODE END EV */ 64 | 65 | /******************************************************************************/ 66 | /* Cortex-M3 Processor Interruption and Exception Handlers */ 67 | /******************************************************************************/ 68 | /** 69 | * @brief This function handles Non maskable interrupt. 70 | */ 71 | void NMI_Handler(void) 72 | { 73 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ 74 | 75 | /* USER CODE END NonMaskableInt_IRQn 0 */ 76 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ 77 | 78 | /* USER CODE END NonMaskableInt_IRQn 1 */ 79 | } 80 | 81 | /** 82 | * @brief This function handles Hard fault interrupt. 83 | */ 84 | void HardFault_Handler(void) 85 | { 86 | /* USER CODE BEGIN HardFault_IRQn 0 */ 87 | 88 | /* USER CODE END HardFault_IRQn 0 */ 89 | while (1) 90 | { 91 | /* USER CODE BEGIN W1_HardFault_IRQn 0 */ 92 | /* USER CODE END W1_HardFault_IRQn 0 */ 93 | } 94 | } 95 | 96 | /** 97 | * @brief This function handles Memory management fault. 98 | */ 99 | void MemManage_Handler(void) 100 | { 101 | /* USER CODE BEGIN MemoryManagement_IRQn 0 */ 102 | 103 | /* USER CODE END MemoryManagement_IRQn 0 */ 104 | while (1) 105 | { 106 | /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ 107 | /* USER CODE END W1_MemoryManagement_IRQn 0 */ 108 | } 109 | } 110 | 111 | /** 112 | * @brief This function handles Prefetch fault, memory access fault. 113 | */ 114 | void BusFault_Handler(void) 115 | { 116 | /* USER CODE BEGIN BusFault_IRQn 0 */ 117 | 118 | /* USER CODE END BusFault_IRQn 0 */ 119 | while (1) 120 | { 121 | /* USER CODE BEGIN W1_BusFault_IRQn 0 */ 122 | /* USER CODE END W1_BusFault_IRQn 0 */ 123 | } 124 | } 125 | 126 | /** 127 | * @brief This function handles Undefined instruction or illegal state. 128 | */ 129 | void UsageFault_Handler(void) 130 | { 131 | /* USER CODE BEGIN UsageFault_IRQn 0 */ 132 | 133 | /* USER CODE END UsageFault_IRQn 0 */ 134 | while (1) 135 | { 136 | /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ 137 | /* USER CODE END W1_UsageFault_IRQn 0 */ 138 | } 139 | } 140 | 141 | /** 142 | * @brief This function handles Debug monitor. 143 | */ 144 | void DebugMon_Handler(void) 145 | { 146 | /* USER CODE BEGIN DebugMonitor_IRQn 0 */ 147 | 148 | /* USER CODE END DebugMonitor_IRQn 0 */ 149 | /* USER CODE BEGIN DebugMonitor_IRQn 1 */ 150 | 151 | /* USER CODE END DebugMonitor_IRQn 1 */ 152 | } 153 | 154 | /******************************************************************************/ 155 | /* STM32F1xx Peripheral Interrupt Handlers */ 156 | /* Add here the Interrupt Handlers for the used peripherals. */ 157 | /* For the available peripheral interrupt handler names, */ 158 | /* please refer to the startup file (startup_stm32f1xx.s). */ 159 | /******************************************************************************/ 160 | 161 | /** 162 | * @brief This function handles TIM1 update interrupt. 163 | */ 164 | void TIM1_UP_IRQHandler(void) 165 | { 166 | /* USER CODE BEGIN TIM1_UP_IRQn 0 */ 167 | 168 | /* USER CODE END TIM1_UP_IRQn 0 */ 169 | HAL_TIM_IRQHandler(&htim1); 170 | /* USER CODE BEGIN TIM1_UP_IRQn 1 */ 171 | 172 | /* USER CODE END TIM1_UP_IRQn 1 */ 173 | } 174 | 175 | /* USER CODE BEGIN 1 */ 176 | 177 | /* USER CODE END 1 */ 178 | -------------------------------------------------------------------------------- /application/cubemx/cubemx.ioc: -------------------------------------------------------------------------------- 1 | #MicroXplorer Configuration settings - do not modify 2 | CAD.formats= 3 | CAD.pinconfig= 4 | CAD.provider= 5 | File.Version=6 6 | KeepUserPlacement=false 7 | Mcu.CPN=STM32F103C8T6 8 | Mcu.Family=STM32F1 9 | Mcu.IP0=NVIC 10 | Mcu.IP1=RCC 11 | Mcu.IP2=SYS 12 | Mcu.IPNb=3 13 | Mcu.Name=STM32F103C(8-B)Tx 14 | Mcu.Package=LQFP48 15 | Mcu.Pin0=PD0-OSC_IN 16 | Mcu.Pin1=PD1-OSC_OUT 17 | Mcu.Pin2=PB12 18 | Mcu.Pin3=PA13 19 | Mcu.Pin4=PA14 20 | Mcu.Pin5=VP_SYS_VS_tim1 21 | Mcu.PinsNb=6 22 | Mcu.ThirdPartyNb=0 23 | Mcu.UserConstants= 24 | Mcu.UserName=STM32F103C8Tx 25 | MxCube.Version=6.7.0 26 | MxDb.Version=DB.6.0.70 27 | NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false 28 | NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false 29 | NVIC.ForceEnableDMAVector=true 30 | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false 31 | NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false 32 | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false 33 | NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false 34 | NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 35 | NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false 36 | NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false 37 | NVIC.TIM1_UP_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:true 38 | NVIC.TimeBase=TIM1_UP_IRQn 39 | NVIC.TimeBaseIP=TIM1 40 | NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false 41 | PA13.Mode=Serial_Wire 42 | PA13.Signal=SYS_JTMS-SWDIO 43 | PA14.Mode=Serial_Wire 44 | PA14.Signal=SYS_JTCK-SWCLK 45 | PB12.GPIOParameters=GPIO_Label 46 | PB12.GPIO_Label=LED 47 | PB12.Locked=true 48 | PB12.Signal=GPIO_Output 49 | PD0-OSC_IN.Mode=HSE-External-Oscillator 50 | PD0-OSC_IN.Signal=RCC_OSC_IN 51 | PD1-OSC_OUT.Mode=HSE-External-Oscillator 52 | PD1-OSC_OUT.Signal=RCC_OSC_OUT 53 | PinOutPanel.RotationAngle=0 54 | ProjectManager.AskForMigrate=true 55 | ProjectManager.BackupPrevious=false 56 | ProjectManager.CompilerOptimize=6 57 | ProjectManager.ComputerToolchain=false 58 | ProjectManager.CoupleFile=true 59 | ProjectManager.CustomerFirmwarePackage= 60 | ProjectManager.DefaultFWLocation=true 61 | ProjectManager.DeletePrevious=true 62 | ProjectManager.DeviceId=STM32F103C8Tx 63 | ProjectManager.FirmwarePackage=STM32Cube FW_F1 V1.8.4 64 | ProjectManager.FreePins=true 65 | ProjectManager.HalAssertFull=false 66 | ProjectManager.HeapSize=0x200 67 | ProjectManager.KeepUserCode=true 68 | ProjectManager.LastFirmware=true 69 | ProjectManager.LibraryCopy=1 70 | ProjectManager.MainLocation=Src 71 | ProjectManager.NoMain=false 72 | ProjectManager.PreviousToolchain= 73 | ProjectManager.ProjectBuild=false 74 | ProjectManager.ProjectFileName=cubemx.ioc 75 | ProjectManager.ProjectName=cubemx 76 | ProjectManager.RegisterCallBack= 77 | ProjectManager.StackSize=0x400 78 | ProjectManager.TargetToolchain=Makefile 79 | ProjectManager.ToolChainLocation= 80 | ProjectManager.UnderRoot=false 81 | ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true 82 | RCC.ADCFreqValue=36000000 83 | RCC.AHBFreq_Value=72000000 84 | RCC.APB1CLKDivider=RCC_HCLK_DIV2 85 | RCC.APB1Freq_Value=36000000 86 | RCC.APB1TimFreq_Value=72000000 87 | RCC.APB2Freq_Value=72000000 88 | RCC.APB2TimFreq_Value=72000000 89 | RCC.FCLKCortexFreq_Value=72000000 90 | RCC.FamilyName=M 91 | RCC.HCLKFreq_Value=72000000 92 | RCC.IPParameters=ADCFreqValue,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSourceVirtual,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,VCOOutput2Freq_Value 93 | RCC.MCOFreq_Value=72000000 94 | RCC.PLLCLKFreq_Value=72000000 95 | RCC.PLLMCOFreq_Value=36000000 96 | RCC.PLLMUL=RCC_PLL_MUL9 97 | RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE 98 | RCC.SYSCLKFreq_VALUE=72000000 99 | RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK 100 | RCC.TimSysFreq_Value=72000000 101 | RCC.USBFreq_Value=72000000 102 | RCC.VCOOutput2Freq_Value=8000000 103 | VP_SYS_VS_tim1.Mode=TIM1 104 | VP_SYS_VS_tim1.Signal=SYS_VS_tim1 105 | board=custom 106 | -------------------------------------------------------------------------------- /application/kconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Automatically generated file; DO NOT EDIT. 3 | * MCU App Configuration 4 | */ 5 | #define CONFIG_C_OPTIMIZATION_LEVEL "-O0" 6 | #define CONFIG_C_WARNING_SWITCH_ENUM "-Wswitch-enum" 7 | #define CONFIG_C_DEBUG_LEVEL "-g3" 8 | #define CONFIG_FLAG_C_STACK_USAGE 1 9 | #define CONFIG_C_DEBUG_LEVEL_3 1 10 | #define CONFIG_FLAG_C_DATA_SECTIONS 1 11 | #define CONFIG_FLAG_C_WARNING_EXTRA 1 12 | #define CONFIG_C_WARNING_ALL "-Wall" 13 | #define CONFIG_C_DATA_SECTIONS "-fdata-sections" 14 | #define CONFIG_FLAG_C_WARNING_SWITCH_ENUM 1 15 | #define CONFIG_FREERTOS_TICK_RATE_HZ 1000 16 | #define CONFIG_C_FUNCTION_SECTIONS "-ffunction-sections" 17 | #define CONFIG_FLAG_C_WARNING_ALL 1 18 | #define CONFIG_STD_C11 1 19 | #define CONFIG_C_WARNING_EXTRA "-Wextra" 20 | #define CONFIG_FLAG_C_WARNING_NO_UNUSED_PARAMETER 1 21 | #define CONFIG_C_LANGUAGE_STANDARD "c11" 22 | #define CONFIG_C_WARNING_NO_UNUSED_PARAMETER "-Wno-unused-parameter" 23 | #define CONFIG_C_OPTIMIZATION_LEVEL_0 1 24 | #define CONFIG_FLAG_C_FUNCTION_SECTIONS 1 25 | #define CONFIG_C_STACK_USAGE "-fstack-usage" 26 | #define CONFIG_APP_BLINK_LED_DELAY 500 27 | -------------------------------------------------------------------------------- /components/Kconfig: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | source "components/freertos-10.0.1/Kconfig" 6 | 7 | ############################################################################### -------------------------------------------------------------------------------- /components/freertos-10.0.1/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef FREERTOS_CONFIG_H 29 | #define FREERTOS_CONFIG_H 30 | 31 | /*----------------------------------------------------------- 32 | * Application specific definitions. 33 | * 34 | * These definitions should be adjusted for your particular hardware and 35 | * application requirements. 36 | * 37 | * These parameters and more are described within the 'configuration' section of the 38 | * FreeRTOS API documentation available on the FreeRTOS.org web site. 39 | * 40 | * See http://www.freertos.org/a00110.html 41 | *----------------------------------------------------------*/ 42 | 43 | #include "kconfig.h" 44 | 45 | 46 | /* Ensure definitions are only used by the compiler, and not by the assembler. */ 47 | #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 48 | #include 49 | extern uint32_t SystemCoreClock; 50 | #endif 51 | #define configUSE_PREEMPTION 1 52 | #define configSUPPORT_STATIC_ALLOCATION 0 53 | #define configSUPPORT_DYNAMIC_ALLOCATION 1 54 | #define configUSE_IDLE_HOOK 0 55 | #define configUSE_TICK_HOOK 0 56 | #define configCPU_CLOCK_HZ ( SystemCoreClock ) 57 | #define configTICK_RATE_HZ ((TickType_t)CONFIG_FREERTOS_TICK_RATE_HZ) 58 | #define configMAX_PRIORITIES ( 7 ) 59 | #define configMINIMAL_STACK_SIZE ((uint16_t)128) 60 | #define configTOTAL_HEAP_SIZE ((size_t)3072) 61 | #define configMAX_TASK_NAME_LEN ( 16 ) 62 | #define configUSE_16_BIT_TICKS 0 63 | #define configUSE_MUTEXES 1 64 | #define configQUEUE_REGISTRY_SIZE 8 65 | #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 66 | 67 | /* Co-routine definitions. */ 68 | #define configUSE_CO_ROUTINES 0 69 | #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) 70 | 71 | /* Set the following definitions to 1 to include the API function, or zero 72 | to exclude the API function. */ 73 | #define INCLUDE_vTaskPrioritySet 1 74 | #define INCLUDE_uxTaskPriorityGet 1 75 | #define INCLUDE_vTaskDelete 1 76 | #define INCLUDE_vTaskCleanUpResources 0 77 | #define INCLUDE_vTaskSuspend 1 78 | #define INCLUDE_vTaskDelayUntil 0 79 | #define INCLUDE_vTaskDelay 1 80 | #define INCLUDE_xTaskGetSchedulerState 1 81 | 82 | /* Cortex-M specific definitions. */ 83 | #ifdef __NVIC_PRIO_BITS 84 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 85 | #define configPRIO_BITS __NVIC_PRIO_BITS 86 | #else 87 | #define configPRIO_BITS 4 88 | #endif 89 | 90 | /* The lowest interrupt priority that can be used in a call to a "set priority" 91 | function. */ 92 | #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 93 | 94 | /* The highest interrupt priority that can be used by any interrupt service 95 | routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL 96 | INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 97 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 98 | #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 99 | 100 | /* Interrupt priorities used by the kernel port layer itself. These are generic 101 | to all Cortex-M ports, and do not rely on any particular library functions. */ 102 | #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 103 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! 104 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ 105 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 106 | 107 | /* Normal assert() semantics without relying on the provision of an assert.h 108 | header file. */ 109 | #define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );} 110 | 111 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS 112 | standard names. */ 113 | #define vPortSVCHandler SVC_Handler 114 | #define xPortPendSVHandler PendSV_Handler 115 | 116 | /* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick, 117 | to prevent overwriting SysTick_Handler defined within STM32Cube HAL */ 118 | #define xPortSysTickHandler SysTick_Handler 119 | 120 | /* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */ 121 | 122 | #endif /* FREERTOS_CONFIG_H */ 123 | -------------------------------------------------------------------------------- /components/freertos-10.0.1/Kconfig: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | menu "FreeRTOS" 6 | 7 | config FREERTOS_TICK_RATE_HZ 8 | int "Tick rate (Hz)" 9 | default 1000 10 | range 1 1000 11 | 12 | endmenu 13 | 14 | ############################################################################### -------------------------------------------------------------------------------- /components/freertos-10.0.1/include/StackMacros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef STACK_MACROS_H 29 | #define STACK_MACROS_H 30 | 31 | #ifndef _MSC_VER /* Visual Studio doesn't support #warning. */ 32 | #warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in future released. 33 | #endif 34 | 35 | /* 36 | * Call the stack overflow hook function if the stack of the task being swapped 37 | * out is currently overflowed, or looks like it might have overflowed in the 38 | * past. 39 | * 40 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check 41 | * the current stack state only - comparing the current top of stack value to 42 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 43 | * will also cause the last few stack bytes to be checked to ensure the value 44 | * to which the bytes were set when the task was created have not been 45 | * overwritten. Note this second test does not guarantee that an overflowed 46 | * stack will always be recognised. 47 | */ 48 | 49 | /*-----------------------------------------------------------*/ 50 | 51 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) ) 52 | 53 | /* Only the current stack state is to be checked. */ 54 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 55 | { \ 56 | /* Is the currently saved stack pointer within the stack limit? */ \ 57 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ 58 | { \ 59 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 60 | } \ 61 | } 62 | 63 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 64 | /*-----------------------------------------------------------*/ 65 | 66 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) ) 67 | 68 | /* Only the current stack state is to be checked. */ 69 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 70 | { \ 71 | \ 72 | /* Is the currently saved stack pointer within the stack limit? */ \ 73 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ 74 | { \ 75 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 76 | } \ 77 | } 78 | 79 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 80 | /*-----------------------------------------------------------*/ 81 | 82 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) 83 | 84 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 85 | { \ 86 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ 87 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ 88 | \ 89 | if( ( pulStack[ 0 ] != ulCheckValue ) || \ 90 | ( pulStack[ 1 ] != ulCheckValue ) || \ 91 | ( pulStack[ 2 ] != ulCheckValue ) || \ 92 | ( pulStack[ 3 ] != ulCheckValue ) ) \ 93 | { \ 94 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 95 | } \ 96 | } 97 | 98 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 99 | /*-----------------------------------------------------------*/ 100 | 101 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) ) 102 | 103 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 104 | { \ 105 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ 106 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 107 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 108 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 109 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 110 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ 111 | \ 112 | \ 113 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ 114 | \ 115 | /* Has the extremity of the task stack ever been written over? */ \ 116 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ 117 | { \ 118 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 119 | } \ 120 | } 121 | 122 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 123 | /*-----------------------------------------------------------*/ 124 | 125 | /* Remove stack overflow macro if not being used. */ 126 | #ifndef taskCHECK_FOR_STACK_OVERFLOW 127 | #define taskCHECK_FOR_STACK_OVERFLOW() 128 | #endif 129 | 130 | 131 | 132 | #endif /* STACK_MACROS_H */ 133 | 134 | -------------------------------------------------------------------------------- /components/freertos-10.0.1/include/deprecated_definitions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef DEPRECATED_DEFINITIONS_H 29 | #define DEPRECATED_DEFINITIONS_H 30 | 31 | 32 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a 33 | pre-processor definition was used to ensure the pre-processor found the correct 34 | portmacro.h file for the port being used. That scheme was deprecated in favour 35 | of setting the compiler's include path such that it found the correct 36 | portmacro.h file - removing the need for the constant and allowing the 37 | portmacro.h file to be located anywhere in relation to the port being used. The 38 | definitions below remain in the code for backward compatibility only. New 39 | projects should not use them. */ 40 | 41 | #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT 42 | #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h" 43 | typedef void ( __interrupt __far *pxISR )(); 44 | #endif 45 | 46 | #ifdef OPEN_WATCOM_FLASH_LITE_186_PORT 47 | #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h" 48 | typedef void ( __interrupt __far *pxISR )(); 49 | #endif 50 | 51 | #ifdef GCC_MEGA_AVR 52 | #include "../portable/GCC/ATMega323/portmacro.h" 53 | #endif 54 | 55 | #ifdef IAR_MEGA_AVR 56 | #include "../portable/IAR/ATMega323/portmacro.h" 57 | #endif 58 | 59 | #ifdef MPLAB_PIC24_PORT 60 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h" 61 | #endif 62 | 63 | #ifdef MPLAB_DSPIC_PORT 64 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h" 65 | #endif 66 | 67 | #ifdef MPLAB_PIC18F_PORT 68 | #include "../../Source/portable/MPLAB/PIC18F/portmacro.h" 69 | #endif 70 | 71 | #ifdef MPLAB_PIC32MX_PORT 72 | #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h" 73 | #endif 74 | 75 | #ifdef _FEDPICC 76 | #include "libFreeRTOS/Include/portmacro.h" 77 | #endif 78 | 79 | #ifdef SDCC_CYGNAL 80 | #include "../../Source/portable/SDCC/Cygnal/portmacro.h" 81 | #endif 82 | 83 | #ifdef GCC_ARM7 84 | #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h" 85 | #endif 86 | 87 | #ifdef GCC_ARM7_ECLIPSE 88 | #include "portmacro.h" 89 | #endif 90 | 91 | #ifdef ROWLEY_LPC23xx 92 | #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h" 93 | #endif 94 | 95 | #ifdef IAR_MSP430 96 | #include "..\..\Source\portable\IAR\MSP430\portmacro.h" 97 | #endif 98 | 99 | #ifdef GCC_MSP430 100 | #include "../../Source/portable/GCC/MSP430F449/portmacro.h" 101 | #endif 102 | 103 | #ifdef ROWLEY_MSP430 104 | #include "../../Source/portable/Rowley/MSP430F449/portmacro.h" 105 | #endif 106 | 107 | #ifdef ARM7_LPC21xx_KEIL_RVDS 108 | #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h" 109 | #endif 110 | 111 | #ifdef SAM7_GCC 112 | #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h" 113 | #endif 114 | 115 | #ifdef SAM7_IAR 116 | #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h" 117 | #endif 118 | 119 | #ifdef SAM9XE_IAR 120 | #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h" 121 | #endif 122 | 123 | #ifdef LPC2000_IAR 124 | #include "..\..\Source\portable\IAR\LPC2000\portmacro.h" 125 | #endif 126 | 127 | #ifdef STR71X_IAR 128 | #include "..\..\Source\portable\IAR\STR71x\portmacro.h" 129 | #endif 130 | 131 | #ifdef STR75X_IAR 132 | #include "..\..\Source\portable\IAR\STR75x\portmacro.h" 133 | #endif 134 | 135 | #ifdef STR75X_GCC 136 | #include "..\..\Source\portable\GCC\STR75x\portmacro.h" 137 | #endif 138 | 139 | #ifdef STR91X_IAR 140 | #include "..\..\Source\portable\IAR\STR91x\portmacro.h" 141 | #endif 142 | 143 | #ifdef GCC_H8S 144 | #include "../../Source/portable/GCC/H8S2329/portmacro.h" 145 | #endif 146 | 147 | #ifdef GCC_AT91FR40008 148 | #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h" 149 | #endif 150 | 151 | #ifdef RVDS_ARMCM3_LM3S102 152 | #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h" 153 | #endif 154 | 155 | #ifdef GCC_ARMCM3_LM3S102 156 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h" 157 | #endif 158 | 159 | #ifdef GCC_ARMCM3 160 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h" 161 | #endif 162 | 163 | #ifdef IAR_ARM_CM3 164 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h" 165 | #endif 166 | 167 | #ifdef IAR_ARMCM3_LM 168 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h" 169 | #endif 170 | 171 | #ifdef HCS12_CODE_WARRIOR 172 | #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h" 173 | #endif 174 | 175 | #ifdef MICROBLAZE_GCC 176 | #include "../../Source/portable/GCC/MicroBlaze/portmacro.h" 177 | #endif 178 | 179 | #ifdef TERN_EE 180 | #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h" 181 | #endif 182 | 183 | #ifdef GCC_HCS12 184 | #include "../../Source/portable/GCC/HCS12/portmacro.h" 185 | #endif 186 | 187 | #ifdef GCC_MCF5235 188 | #include "../../Source/portable/GCC/MCF5235/portmacro.h" 189 | #endif 190 | 191 | #ifdef COLDFIRE_V2_GCC 192 | #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h" 193 | #endif 194 | 195 | #ifdef COLDFIRE_V2_CODEWARRIOR 196 | #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h" 197 | #endif 198 | 199 | #ifdef GCC_PPC405 200 | #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h" 201 | #endif 202 | 203 | #ifdef GCC_PPC440 204 | #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h" 205 | #endif 206 | 207 | #ifdef _16FX_SOFTUNE 208 | #include "..\..\Source\portable\Softune\MB96340\portmacro.h" 209 | #endif 210 | 211 | #ifdef BCC_INDUSTRIAL_PC_PORT 212 | /* A short file name has to be used in place of the normal 213 | FreeRTOSConfig.h when using the Borland compiler. */ 214 | #include "frconfig.h" 215 | #include "..\portable\BCC\16BitDOS\PC\prtmacro.h" 216 | typedef void ( __interrupt __far *pxISR )(); 217 | #endif 218 | 219 | #ifdef BCC_FLASH_LITE_186_PORT 220 | /* A short file name has to be used in place of the normal 221 | FreeRTOSConfig.h when using the Borland compiler. */ 222 | #include "frconfig.h" 223 | #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h" 224 | typedef void ( __interrupt __far *pxISR )(); 225 | #endif 226 | 227 | #ifdef __GNUC__ 228 | #ifdef __AVR32_AVR32A__ 229 | #include "portmacro.h" 230 | #endif 231 | #endif 232 | 233 | #ifdef __ICCAVR32__ 234 | #ifdef __CORE__ 235 | #if __CORE__ == __AVR32A__ 236 | #include "portmacro.h" 237 | #endif 238 | #endif 239 | #endif 240 | 241 | #ifdef __91467D 242 | #include "portmacro.h" 243 | #endif 244 | 245 | #ifdef __96340 246 | #include "portmacro.h" 247 | #endif 248 | 249 | 250 | #ifdef __IAR_V850ES_Fx3__ 251 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 252 | #endif 253 | 254 | #ifdef __IAR_V850ES_Jx3__ 255 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 256 | #endif 257 | 258 | #ifdef __IAR_V850ES_Jx3_L__ 259 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 260 | #endif 261 | 262 | #ifdef __IAR_V850ES_Jx2__ 263 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 264 | #endif 265 | 266 | #ifdef __IAR_V850ES_Hx2__ 267 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 268 | #endif 269 | 270 | #ifdef __IAR_78K0R_Kx3__ 271 | #include "../../Source/portable/IAR/78K0R/portmacro.h" 272 | #endif 273 | 274 | #ifdef __IAR_78K0R_Kx3L__ 275 | #include "../../Source/portable/IAR/78K0R/portmacro.h" 276 | #endif 277 | 278 | #endif /* DEPRECATED_DEFINITIONS_H */ 279 | 280 | -------------------------------------------------------------------------------- /components/freertos-10.0.1/include/portable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /*----------------------------------------------------------- 29 | * Portable layer API. Each function must be defined for each port. 30 | *----------------------------------------------------------*/ 31 | 32 | #ifndef PORTABLE_H 33 | #define PORTABLE_H 34 | 35 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a 36 | pre-processor definition was used to ensure the pre-processor found the correct 37 | portmacro.h file for the port being used. That scheme was deprecated in favour 38 | of setting the compiler's include path such that it found the correct 39 | portmacro.h file - removing the need for the constant and allowing the 40 | portmacro.h file to be located anywhere in relation to the port being used. 41 | Purely for reasons of backward compatibility the old method is still valid, but 42 | to make it clear that new projects should not use it, support for the port 43 | specific constants has been moved into the deprecated_definitions.h header 44 | file. */ 45 | #include "deprecated_definitions.h" 46 | 47 | /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h 48 | did not result in a portmacro.h header file being included - and it should be 49 | included here. In this case the path to the correct portmacro.h header file 50 | must be set in the compiler's include path. */ 51 | #ifndef portENTER_CRITICAL 52 | #include "portmacro.h" 53 | #endif 54 | 55 | #if portBYTE_ALIGNMENT == 32 56 | #define portBYTE_ALIGNMENT_MASK ( 0x001f ) 57 | #endif 58 | 59 | #if portBYTE_ALIGNMENT == 16 60 | #define portBYTE_ALIGNMENT_MASK ( 0x000f ) 61 | #endif 62 | 63 | #if portBYTE_ALIGNMENT == 8 64 | #define portBYTE_ALIGNMENT_MASK ( 0x0007 ) 65 | #endif 66 | 67 | #if portBYTE_ALIGNMENT == 4 68 | #define portBYTE_ALIGNMENT_MASK ( 0x0003 ) 69 | #endif 70 | 71 | #if portBYTE_ALIGNMENT == 2 72 | #define portBYTE_ALIGNMENT_MASK ( 0x0001 ) 73 | #endif 74 | 75 | #if portBYTE_ALIGNMENT == 1 76 | #define portBYTE_ALIGNMENT_MASK ( 0x0000 ) 77 | #endif 78 | 79 | #ifndef portBYTE_ALIGNMENT_MASK 80 | #error "Invalid portBYTE_ALIGNMENT definition" 81 | #endif 82 | 83 | #ifndef portNUM_CONFIGURABLE_REGIONS 84 | #define portNUM_CONFIGURABLE_REGIONS 1 85 | #endif 86 | 87 | #ifdef __cplusplus 88 | extern "C" { 89 | #endif 90 | 91 | #include "mpu_wrappers.h" 92 | 93 | /* 94 | * Setup the stack of a new task so it is ready to be placed under the 95 | * scheduler control. The registers have to be placed on the stack in 96 | * the order that the port expects to find them. 97 | * 98 | */ 99 | #if( portUSING_MPU_WRAPPERS == 1 ) 100 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION; 101 | #else 102 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION; 103 | #endif 104 | 105 | /* Used by heap_5.c. */ 106 | typedef struct HeapRegion 107 | { 108 | uint8_t *pucStartAddress; 109 | size_t xSizeInBytes; 110 | } HeapRegion_t; 111 | 112 | /* 113 | * Used to define multiple heap regions for use by heap_5.c. This function 114 | * must be called before any calls to pvPortMalloc() - not creating a task, 115 | * queue, semaphore, mutex, software timer, event group, etc. will result in 116 | * pvPortMalloc being called. 117 | * 118 | * pxHeapRegions passes in an array of HeapRegion_t structures - each of which 119 | * defines a region of memory that can be used as the heap. The array is 120 | * terminated by a HeapRegions_t structure that has a size of 0. The region 121 | * with the lowest start address must appear first in the array. 122 | */ 123 | void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION; 124 | 125 | 126 | /* 127 | * Map to the memory management routines required for the port. 128 | */ 129 | void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION; 130 | void vPortFree( void *pv ) PRIVILEGED_FUNCTION; 131 | void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION; 132 | size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION; 133 | size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION; 134 | 135 | /* 136 | * Setup the hardware ready for the scheduler to take control. This generally 137 | * sets up a tick interrupt and sets timers for the correct tick frequency. 138 | */ 139 | BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION; 140 | 141 | /* 142 | * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so 143 | * the hardware is left in its original condition after the scheduler stops 144 | * executing. 145 | */ 146 | void vPortEndScheduler( void ) PRIVILEGED_FUNCTION; 147 | 148 | /* 149 | * The structures and methods of manipulating the MPU are contained within the 150 | * port layer. 151 | * 152 | * Fills the xMPUSettings structure with the memory region information 153 | * contained in xRegions. 154 | */ 155 | #if( portUSING_MPU_WRAPPERS == 1 ) 156 | struct xMEMORY_REGION; 157 | void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION; 158 | #endif 159 | 160 | #ifdef __cplusplus 161 | } 162 | #endif 163 | 164 | #endif /* PORTABLE_H */ 165 | 166 | -------------------------------------------------------------------------------- /components/freertos-10.0.1/include/projdefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef PROJDEFS_H 29 | #define PROJDEFS_H 30 | 31 | /* 32 | * Defines the prototype to which task functions must conform. Defined in this 33 | * file to ensure the type is known before portable.h is included. 34 | */ 35 | typedef void (*TaskFunction_t)( void * ); 36 | 37 | /* Converts a time in milliseconds to a time in ticks. This macro can be 38 | overridden by a macro of the same name defined in FreeRTOSConfig.h in case the 39 | definition here is not suitable for your application. */ 40 | #ifndef pdMS_TO_TICKS 41 | #define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) ) 42 | #endif 43 | 44 | #define pdFALSE ( ( BaseType_t ) 0 ) 45 | #define pdTRUE ( ( BaseType_t ) 1 ) 46 | 47 | #define pdPASS ( pdTRUE ) 48 | #define pdFAIL ( pdFALSE ) 49 | #define errQUEUE_EMPTY ( ( BaseType_t ) 0 ) 50 | #define errQUEUE_FULL ( ( BaseType_t ) 0 ) 51 | 52 | /* FreeRTOS error definitions. */ 53 | #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 ) 54 | #define errQUEUE_BLOCKED ( -4 ) 55 | #define errQUEUE_YIELD ( -5 ) 56 | 57 | /* Macros used for basic data corruption checks. */ 58 | #ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 59 | #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0 60 | #endif 61 | 62 | #if( configUSE_16_BIT_TICKS == 1 ) 63 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a 64 | #else 65 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL 66 | #endif 67 | 68 | /* The following errno values are used by FreeRTOS+ components, not FreeRTOS 69 | itself. */ 70 | #define pdFREERTOS_ERRNO_NONE 0 /* No errors */ 71 | #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */ 72 | #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */ 73 | #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */ 74 | #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */ 75 | #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */ 76 | #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */ 77 | #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */ 78 | #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */ 79 | #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */ 80 | #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */ 81 | #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */ 82 | #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */ 83 | #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */ 84 | #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */ 85 | #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */ 86 | #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */ 87 | #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */ 88 | #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */ 89 | #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */ 90 | #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */ 91 | #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */ 92 | #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */ 93 | #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */ 94 | #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */ 95 | #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */ 96 | #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */ 97 | #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ 98 | #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */ 99 | #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */ 100 | #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */ 101 | #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */ 102 | #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */ 103 | #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */ 104 | #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */ 105 | #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */ 106 | #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */ 107 | #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */ 108 | #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */ 109 | #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */ 110 | 111 | /* The following endian values are used by FreeRTOS+ components, not FreeRTOS 112 | itself. */ 113 | #define pdFREERTOS_LITTLE_ENDIAN 0 114 | #define pdFREERTOS_BIG_ENDIAN 1 115 | 116 | /* Re-defining endian values for generic naming. */ 117 | #define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN 118 | #define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN 119 | 120 | 121 | #endif /* PROJDEFS_H */ 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /components/freertos-10.0.1/include/stack_macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef STACK_MACROS_H 29 | #define STACK_MACROS_H 30 | 31 | /* 32 | * Call the stack overflow hook function if the stack of the task being swapped 33 | * out is currently overflowed, or looks like it might have overflowed in the 34 | * past. 35 | * 36 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check 37 | * the current stack state only - comparing the current top of stack value to 38 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 39 | * will also cause the last few stack bytes to be checked to ensure the value 40 | * to which the bytes were set when the task was created have not been 41 | * overwritten. Note this second test does not guarantee that an overflowed 42 | * stack will always be recognised. 43 | */ 44 | 45 | /*-----------------------------------------------------------*/ 46 | 47 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) ) 48 | 49 | /* Only the current stack state is to be checked. */ 50 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 51 | { \ 52 | /* Is the currently saved stack pointer within the stack limit? */ \ 53 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ 54 | { \ 55 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 56 | } \ 57 | } 58 | 59 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 60 | /*-----------------------------------------------------------*/ 61 | 62 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) ) 63 | 64 | /* Only the current stack state is to be checked. */ 65 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 66 | { \ 67 | \ 68 | /* Is the currently saved stack pointer within the stack limit? */ \ 69 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ 70 | { \ 71 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 72 | } \ 73 | } 74 | 75 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 76 | /*-----------------------------------------------------------*/ 77 | 78 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) 79 | 80 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 81 | { \ 82 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ 83 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ 84 | \ 85 | if( ( pulStack[ 0 ] != ulCheckValue ) || \ 86 | ( pulStack[ 1 ] != ulCheckValue ) || \ 87 | ( pulStack[ 2 ] != ulCheckValue ) || \ 88 | ( pulStack[ 3 ] != ulCheckValue ) ) \ 89 | { \ 90 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 91 | } \ 92 | } 93 | 94 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 95 | /*-----------------------------------------------------------*/ 96 | 97 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) ) 98 | 99 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 100 | { \ 101 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ 102 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 103 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 104 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 105 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 106 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ 107 | \ 108 | \ 109 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ 110 | \ 111 | /* Has the extremity of the task stack ever been written over? */ \ 112 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ 113 | { \ 114 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 115 | } \ 116 | } 117 | 118 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 119 | /*-----------------------------------------------------------*/ 120 | 121 | /* Remove stack overflow macro if not being used. */ 122 | #ifndef taskCHECK_FOR_STACK_OVERFLOW 123 | #define taskCHECK_FOR_STACK_OVERFLOW() 124 | #endif 125 | 126 | 127 | 128 | #endif /* STACK_MACROS_H */ 129 | 130 | -------------------------------------------------------------------------------- /components/freertos-10.0.1/include/stdint.readme: -------------------------------------------------------------------------------- 1 | 2 | #ifndef FREERTOS_STDINT 3 | #define FREERTOS_STDINT 4 | 5 | /******************************************************************************* 6 | * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions 7 | * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be 8 | * built using compilers that do not provide their own stdint.h definition. 9 | * 10 | * To use this file: 11 | * 12 | * 1) Copy this file into the directory that contains your FreeRTOSConfig.h 13 | * header file, as that directory will already be in the compilers include 14 | * path. 15 | * 16 | * 2) Rename the copied file stdint.h. 17 | * 18 | */ 19 | 20 | typedef signed char int8_t; 21 | typedef unsigned char uint8_t; 22 | typedef short int16_t; 23 | typedef unsigned short uint16_t; 24 | typedef long int32_t; 25 | typedef unsigned long uint32_t; 26 | 27 | #endif /* FREERTOS_STDINT */ 28 | -------------------------------------------------------------------------------- /components/freertos-10.0.1/license.txt: -------------------------------------------------------------------------------- 1 | The FreeRTOS kernel is released under the MIT open source license, the text of 2 | which is provided below. 3 | 4 | This license covers the FreeRTOS kernel source files, which are located in the 5 | /FreeRTOS/Source directory of the official FreeRTOS kernel download. It also 6 | covers most of the source files in the demo application projects, which are 7 | located in the /FreeRTOS/Demo directory of the official FreeRTOS download. The 8 | demo projects may also include third party software that is not part of FreeRTOS 9 | and is licensed separately to FreeRTOS. Examples of third party software 10 | includes header files provided by chip or tools vendors, linker scripts, 11 | peripheral drivers, etc. All the software in subdirectories of the /FreeRTOS 12 | directory is either open source or distributed with permission, and is free for 13 | use. For the avoidance of doubt, refer to the comments at the top of each 14 | source file. 15 | 16 | 17 | License text: 18 | ------------- 19 | 20 | Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 21 | Permission is hereby granted, free of charge, to any person obtaining a copy of 22 | this software and associated documentation files (the "Software"), to deal in 23 | the Software without restriction, including without limitation the rights to 24 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 25 | the Software, and to permit persons to whom the Software is furnished to do so, 26 | subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 33 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 34 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 35 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 36 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 37 | 38 | -------------------------------------------------------------------------------- /scripts/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | .PHONY: fixdep %config clean force 6 | 7 | VERSION = 6 8 | PATCHLEVEL = 2 9 | SUBLEVEL = 0 10 | EXTRAVERSION = 11 | NAME = Hurr durr I'ma ninja sloth 12 | 13 | KBUILD_VERBOSE = 0 14 | quiet = quiet_ 15 | Q = @ 16 | 17 | srctree = $(CURDIR) 18 | objtree = $(CURDIR) 19 | 20 | export KBUILD_VERBOSE quiet Q srctree objtree 21 | 22 | include scripts/Kbuild.include 23 | 24 | KCONFIG_CONFIG = .config 25 | KCONFIG_AUTOHEADER = application/kconfig.h 26 | KCONFIG_AUTOCONFIG = scripts/include/config/auto.conf 27 | KCONFIG_TRISTATE = scripts/include/config/tristate.conf 28 | KCONFIG_RUSTCCFG = scripts/include/generated/rustc_cfg 29 | 30 | export KCONFIG_CONFIG KCONFIG_AUTOHEADER KCONFIG_AUTOCONFIG \ 31 | KCONFIG_TRISTATE KCONFIG_RUSTCCFG 32 | 33 | # SHELL used by kbuild 34 | CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ 35 | else if [ -x /bin/bash ]; then echo /bin/bash; \ 36 | else echo sh; fi ; fi) 37 | 38 | HOSTCC = gcc 39 | HOSTCXX = g++ 40 | HOSTCFLAGS = -O2 -Wall -Wextra 41 | HOSTCXXFLAGS = -O2 -Wall -Wextra 42 | 43 | export CONFIG_SHELL HOSTCC HOSTCXX HOSTCFLAGS HOSTCXXFLAGS 44 | 45 | %config: fixdep force 46 | @$(MAKE) $(build)=scripts/kconfig $@ 47 | @$(MAKE) $(build)=scripts/kconfig syncconfig 48 | 49 | fixdep: 50 | @cd scripts/basic && make 51 | 52 | clean: 53 | @cd scripts/basic && make --no-print-directory clean 54 | rm -rf scripts/include 55 | rm -rf scripts/kconfig/*.o 56 | rm -rf scripts/kconfig/lxdialog/*.o 57 | rm -rf scripts/kconfig/lxdialog/.*.cmd 58 | rm -rf scripts/kconfig/.*.cmd 59 | rm -rf scripts/kconfig/*.tmp 60 | rm -rf scripts/kconfig/conf 61 | rm -rf scripts/kconfig/lexer.lex.c 62 | rm -rf scripts/kconfig/mconf 63 | rm -rf scripts/kconfig/mconf-bin 64 | rm -rf scripts/kconfig/mconf-cfg 65 | rm -rf scripts/kconfig/mconf-cflags 66 | rm -rf scripts/kconfig/mconf-libs 67 | rm -rf scripts/kconfig/parser.tab.* 68 | 69 | force: 70 | 71 | ############################################################################### -------------------------------------------------------------------------------- /scripts/Makefile.compiler: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | 3 | # cc-cross-prefix 4 | # Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-) 5 | # Return first where a gcc is found in PATH. 6 | # If no gcc found in PATH with listed prefixes return nothing 7 | # 8 | # Note: '2>/dev/null' is here to force Make to invoke a shell. Otherwise, it 9 | # would try to directly execute the shell builtin 'command'. This workaround 10 | # should be kept for a long time since this issue was fixed only after the 11 | # GNU Make 4.2.1 release. 12 | cc-cross-prefix = $(firstword $(foreach c, $(1), \ 13 | $(if $(shell command -v -- $(c)gcc 2>/dev/null), $(c)))) 14 | 15 | # output directory for tests below 16 | TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$ 17 | 18 | # try-run 19 | # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise) 20 | # Exit code chooses option. "$$TMP" serves as a temporary file and is 21 | # automatically cleaned up. 22 | try-run = $(shell set -e; \ 23 | TMP=$(TMPOUT)/tmp; \ 24 | trap "rm -rf $(TMPOUT)" EXIT; \ 25 | mkdir -p $(TMPOUT); \ 26 | if ($(1)) >/dev/null 2>&1; \ 27 | then echo "$(2)"; \ 28 | else echo "$(3)"; \ 29 | fi) 30 | 31 | # as-option 32 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) 33 | 34 | as-option = $(call try-run,\ 35 | $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2)) 36 | 37 | # as-instr 38 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) 39 | 40 | as-instr = $(call try-run,\ 41 | printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) 42 | 43 | # __cc-option 44 | # Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586) 45 | __cc-option = $(call try-run,\ 46 | $(1) -Werror $(2) $(3) -c -x c /dev/null -o "$$TMP",$(3),$(4)) 47 | 48 | # cc-option 49 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) 50 | 51 | cc-option = $(call __cc-option, $(CC),\ 52 | $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS),$(1),$(2)) 53 | 54 | # cc-option-yn 55 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) 56 | cc-option-yn = $(call try-run,\ 57 | $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) 58 | 59 | # cc-disable-warning 60 | # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) 61 | cc-disable-warning = $(call try-run,\ 62 | $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) 63 | 64 | # gcc-min-version 65 | # Usage: cflags-$(call gcc-min-version, 70100) += -foo 66 | gcc-min-version = $(call test-ge, $(CONFIG_GCC_VERSION), $1) 67 | 68 | # clang-min-version 69 | # Usage: cflags-$(call clang-min-version, 110000) += -foo 70 | clang-min-version = $(call test-ge, $(CONFIG_CLANG_VERSION), $1) 71 | 72 | # ld-option 73 | # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y) 74 | ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3)) 75 | 76 | # ld-ifversion 77 | # Usage: $(call ld-ifversion, -ge, 22252, y) 78 | ld-ifversion = $(shell [ $(CONFIG_LD_VERSION)0 $(1) $(2)0 ] && echo $(3) || echo $(4)) 79 | -------------------------------------------------------------------------------- /scripts/Makefile.host: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0 2 | 3 | # LEX 4 | # --------------------------------------------------------------------------- 5 | quiet_cmd_flex = LEX $@ 6 | cmd_flex = $(LEX) -o$@ -L $< 7 | 8 | $(obj)/%.lex.c: $(src)/%.l FORCE 9 | $(call if_changed,flex) 10 | 11 | # YACC 12 | # --------------------------------------------------------------------------- 13 | quiet_cmd_bison = YACC $(basename $@).[ch] 14 | cmd_bison = $(YACC) -o $(basename $@).c --defines=$(basename $@).h -t -l $< 15 | 16 | $(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE 17 | $(call if_changed,bison) 18 | 19 | # ========================================================================== 20 | # Building binaries on the host system 21 | # Binaries are used during the compilation of the kernel, for example 22 | # to preprocess a data file. 23 | # 24 | # Both C and C++ are supported, but preferred language is C for such utilities. 25 | # Rust is also supported, but it may only be used in scenarios where a Rust 26 | # toolchain is required to be available (e.g. when `CONFIG_RUST` is enabled). 27 | # 28 | # Sample syntax (see Documentation/kbuild/makefiles.rst for reference) 29 | # hostprogs := bin2hex 30 | # Will compile bin2hex.c and create an executable named bin2hex 31 | # 32 | # hostprogs := lxdialog 33 | # lxdialog-objs := checklist.o lxdialog.o 34 | # Will compile lxdialog.c and checklist.c, and then link the executable 35 | # lxdialog, based on checklist.o and lxdialog.o 36 | # 37 | # hostprogs := qconf 38 | # qconf-cxxobjs := qconf.o 39 | # qconf-objs := menu.o 40 | # Will compile qconf as a C++ program, and menu as a C program. 41 | # They are linked as C++ code to the executable qconf 42 | # 43 | # hostprogs := target 44 | # target-rust := y 45 | # Will compile `target` as a Rust program, using `target.rs` as the crate root. 46 | # The crate may consist of several source files. 47 | 48 | # C code 49 | # Executables compiled from a single .c file 50 | host-csingle := $(foreach m,$(hostprogs), \ 51 | $(if $($(m)-objs)$($(m)-cxxobjs)$($(m)-rust),,$(m))) 52 | 53 | # C executables linked based on several .o files 54 | host-cmulti := $(foreach m,$(hostprogs),\ 55 | $(if $($(m)-cxxobjs)$($(m)-rust),,$(if $($(m)-objs),$(m)))) 56 | 57 | # Object (.o) files compiled from .c files 58 | host-cobjs := $(sort $(foreach m,$(hostprogs),$($(m)-objs))) 59 | 60 | # C++ code 61 | # C++ executables compiled from at least one .cc file 62 | # and zero or more .c files 63 | host-cxxmulti := $(foreach m,$(hostprogs),$(if $($(m)-cxxobjs),$(m))) 64 | 65 | # C++ Object (.o) files compiled from .cc files 66 | host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) 67 | 68 | # Rust code 69 | # Executables compiled from a single Rust crate (which may consist of 70 | # one or more .rs files) 71 | host-rust := $(foreach m,$(hostprogs),$(if $($(m)-rust),$(m))) 72 | 73 | host-csingle := $(addprefix $(obj)/,$(host-csingle)) 74 | host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) 75 | host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) 76 | host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) 77 | host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) 78 | host-rust := $(addprefix $(obj)/,$(host-rust)) 79 | 80 | ##### 81 | # Handle options to gcc. Support building with separate output directory 82 | 83 | _hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ 84 | $(HOSTCFLAGS_$(target-stem).o) 85 | _hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ 86 | $(HOSTCXXFLAGS_$(target-stem).o) 87 | _hostrust_flags = $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \ 88 | $(HOSTRUSTFLAGS_$(target-stem)) 89 | 90 | # $(objtree)/$(obj) for including generated headers from checkin source files 91 | ifeq ($(KBUILD_EXTMOD),) 92 | ifdef building_out_of_srctree 93 | _hostc_flags += -I $(objtree)/$(obj) 94 | _hostcxx_flags += -I $(objtree)/$(obj) 95 | endif 96 | endif 97 | 98 | hostc_flags = -Wp,-MMD,$(depfile) $(_hostc_flags) 99 | hostcxx_flags = -Wp,-MMD,$(depfile) $(_hostcxx_flags) 100 | hostrust_flags = $(_hostrust_flags) 101 | 102 | ##### 103 | # Compile programs on the host 104 | 105 | # Create executable from a single .c file 106 | # host-csingle -> Executable 107 | quiet_cmd_host-csingle = HOSTCC $@ 108 | cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \ 109 | $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem)) 110 | $(host-csingle): $(obj)/%: $(src)/%.c FORCE 111 | $(call if_changed_dep,host-csingle) 112 | 113 | # Link an executable based on list of .o files, all plain c 114 | # host-cmulti -> executable 115 | quiet_cmd_host-cmulti = HOSTLD $@ 116 | cmd_host-cmulti = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ \ 117 | $(addprefix $(obj)/, $($(target-stem)-objs)) \ 118 | $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem)) 119 | $(host-cmulti): FORCE 120 | $(call if_changed,host-cmulti) 121 | $(call multi_depend, $(host-cmulti), , -objs) 122 | 123 | # Create .o file from a single .c file 124 | # host-cobjs -> .o 125 | quiet_cmd_host-cobjs = HOSTCC $@ 126 | cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $< 127 | $(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE 128 | $(call if_changed_dep,host-cobjs) 129 | 130 | # Link an executable based on list of .o files, a mixture of .c and .cc 131 | # host-cxxmulti -> executable 132 | quiet_cmd_host-cxxmulti = HOSTLD $@ 133 | cmd_host-cxxmulti = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -o $@ \ 134 | $(foreach o,objs cxxobjs,\ 135 | $(addprefix $(obj)/, $($(target-stem)-$(o)))) \ 136 | $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem)) 137 | $(host-cxxmulti): FORCE 138 | $(call if_changed,host-cxxmulti) 139 | $(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs) 140 | 141 | # Create .o file from a single .cc (C++) file 142 | quiet_cmd_host-cxxobjs = HOSTCXX $@ 143 | cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $< 144 | $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE 145 | $(call if_changed_dep,host-cxxobjs) 146 | 147 | # Create executable from a single Rust crate (which may consist of 148 | # one or more `.rs` files) 149 | # host-rust -> Executable 150 | quiet_cmd_host-rust = HOSTRUSTC $@ 151 | cmd_host-rust = \ 152 | $(HOSTRUSTC) $(hostrust_flags) --emit=dep-info,link \ 153 | --out-dir=$(obj)/ $<; \ 154 | mv $(obj)/$(target-stem).d $(depfile); \ 155 | sed -i '/^\#/d' $(depfile) 156 | $(host-rust): $(obj)/%: $(src)/%.rs FORCE 157 | $(call if_changed_dep,host-rust) 158 | 159 | targets += $(host-csingle) $(host-cmulti) $(host-cobjs) \ 160 | $(host-cxxmulti) $(host-cxxobjs) $(host-rust) 161 | -------------------------------------------------------------------------------- /scripts/basic/.gitignore: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | /fixdep 3 | /randstruct.seed 4 | -------------------------------------------------------------------------------- /scripts/basic/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | .PHONY: all build fixdep clean 6 | 7 | all: build 8 | build: fixdep 9 | fixdep: fixdep.o 10 | @gcc '$<' -o '$@' 11 | 12 | %.o: %.c 13 | @echo ' HOSTCC scripts/basic/$(@F)' 14 | @gcc -c '$<' -o '$@' 15 | 16 | clean: 17 | rm -rf *.o 18 | rm -rf *.cmd 19 | rm -rf fixdep 20 | 21 | ############################################################################### -------------------------------------------------------------------------------- /scripts/kconfig/.gitignore: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-only 2 | /conf 3 | /[gmnq]conf 4 | /[gmnq]conf-bin 5 | /[gmnq]conf-cflags 6 | /[gmnq]conf-libs 7 | /qconf-moc.cc 8 | -------------------------------------------------------------------------------- /scripts/kconfig/gconf-cfg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SPDX-License-Identifier: GPL-2.0 3 | 4 | cflags=$1 5 | libs=$2 6 | 7 | PKG="gtk+-2.0 gmodule-2.0 libglade-2.0" 8 | 9 | if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then 10 | echo >&2 "*" 11 | echo >&2 "* 'make gconfig' requires '${HOSTPKG_CONFIG}'. Please install it." 12 | echo >&2 "*" 13 | exit 1 14 | fi 15 | 16 | if ! ${HOSTPKG_CONFIG} --exists $PKG; then 17 | echo >&2 "*" 18 | echo >&2 "* Unable to find the GTK+ installation. Please make sure that" 19 | echo >&2 "* the GTK+ 2.0 development package is correctly installed." 20 | echo >&2 "* You need $PKG" 21 | echo >&2 "*" 22 | exit 1 23 | fi 24 | 25 | if ! ${HOSTPKG_CONFIG} --atleast-version=2.0.0 gtk+-2.0; then 26 | echo >&2 "*" 27 | echo >&2 "* GTK+ is present but version >= 2.0.0 is required." 28 | echo >&2 "*" 29 | exit 1 30 | fi 31 | 32 | ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} 33 | ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs} 34 | -------------------------------------------------------------------------------- /scripts/kconfig/images.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0 2 | /* 3 | * Copyright (C) 2002 Roman Zippel 4 | */ 5 | 6 | #include "images.h" 7 | 8 | const char * const xpm_load[] = { 9 | "22 22 5 1", 10 | ". c None", 11 | "# c #000000", 12 | "c c #838100", 13 | "a c #ffff00", 14 | "b c #ffffff", 15 | "......................", 16 | "......................", 17 | "......................", 18 | "............####....#.", 19 | "...........#....##.##.", 20 | "..................###.", 21 | ".................####.", 22 | ".####...........#####.", 23 | "#abab##########.......", 24 | "#babababababab#.......", 25 | "#ababababababa#.......", 26 | "#babababababab#.......", 27 | "#ababab###############", 28 | "#babab##cccccccccccc##", 29 | "#abab##cccccccccccc##.", 30 | "#bab##cccccccccccc##..", 31 | "#ab##cccccccccccc##...", 32 | "#b##cccccccccccc##....", 33 | "###cccccccccccc##.....", 34 | "##cccccccccccc##......", 35 | "###############.......", 36 | "......................"}; 37 | 38 | const char * const xpm_save[] = { 39 | "22 22 5 1", 40 | ". c None", 41 | "# c #000000", 42 | "a c #838100", 43 | "b c #c5c2c5", 44 | "c c #cdb6d5", 45 | "......................", 46 | ".####################.", 47 | ".#aa#bbbbbbbbbbbb#bb#.", 48 | ".#aa#bbbbbbbbbbbb#bb#.", 49 | ".#aa#bbbbbbbbbcbb####.", 50 | ".#aa#bbbccbbbbbbb#aa#.", 51 | ".#aa#bbbccbbbbbbb#aa#.", 52 | ".#aa#bbbbbbbbbbbb#aa#.", 53 | ".#aa#bbbbbbbbbbbb#aa#.", 54 | ".#aa#bbbbbbbbbbbb#aa#.", 55 | ".#aa#bbbbbbbbbbbb#aa#.", 56 | ".#aaa############aaa#.", 57 | ".#aaaaaaaaaaaaaaaaaa#.", 58 | ".#aaaaaaaaaaaaaaaaaa#.", 59 | ".#aaa#############aa#.", 60 | ".#aaa#########bbb#aa#.", 61 | ".#aaa#########bbb#aa#.", 62 | ".#aaa#########bbb#aa#.", 63 | ".#aaa#########bbb#aa#.", 64 | ".#aaa#########bbb#aa#.", 65 | "..##################..", 66 | "......................"}; 67 | 68 | const char * const xpm_back[] = { 69 | "22 22 3 1", 70 | ". c None", 71 | "# c #000083", 72 | "a c #838183", 73 | "......................", 74 | "......................", 75 | "......................", 76 | "......................", 77 | "......................", 78 | "...........######a....", 79 | "..#......##########...", 80 | "..##...####......##a..", 81 | "..###.###.........##..", 82 | "..######..........##..", 83 | "..#####...........##..", 84 | "..######..........##..", 85 | "..#######.........##..", 86 | "..########.......##a..", 87 | "...............a###...", 88 | "...............###....", 89 | "......................", 90 | "......................", 91 | "......................", 92 | "......................", 93 | "......................", 94 | "......................"}; 95 | 96 | const char * const xpm_tree_view[] = { 97 | "22 22 2 1", 98 | ". c None", 99 | "# c #000000", 100 | "......................", 101 | "......................", 102 | "......#...............", 103 | "......#...............", 104 | "......#...............", 105 | "......#...............", 106 | "......#...............", 107 | "......########........", 108 | "......#...............", 109 | "......#...............", 110 | "......#...............", 111 | "......#...............", 112 | "......#...............", 113 | "......########........", 114 | "......#...............", 115 | "......#...............", 116 | "......#...............", 117 | "......#...............", 118 | "......#...............", 119 | "......########........", 120 | "......................", 121 | "......................"}; 122 | 123 | const char * const xpm_single_view[] = { 124 | "22 22 2 1", 125 | ". c None", 126 | "# c #000000", 127 | "......................", 128 | "......................", 129 | "..........#...........", 130 | "..........#...........", 131 | "..........#...........", 132 | "..........#...........", 133 | "..........#...........", 134 | "..........#...........", 135 | "..........#...........", 136 | "..........#...........", 137 | "..........#...........", 138 | "..........#...........", 139 | "..........#...........", 140 | "..........#...........", 141 | "..........#...........", 142 | "..........#...........", 143 | "..........#...........", 144 | "..........#...........", 145 | "..........#...........", 146 | "..........#...........", 147 | "......................", 148 | "......................"}; 149 | 150 | const char * const xpm_split_view[] = { 151 | "22 22 2 1", 152 | ". c None", 153 | "# c #000000", 154 | "......................", 155 | "......................", 156 | "......#......#........", 157 | "......#......#........", 158 | "......#......#........", 159 | "......#......#........", 160 | "......#......#........", 161 | "......#......#........", 162 | "......#......#........", 163 | "......#......#........", 164 | "......#......#........", 165 | "......#......#........", 166 | "......#......#........", 167 | "......#......#........", 168 | "......#......#........", 169 | "......#......#........", 170 | "......#......#........", 171 | "......#......#........", 172 | "......#......#........", 173 | "......#......#........", 174 | "......................", 175 | "......................"}; 176 | 177 | const char * const xpm_symbol_no[] = { 178 | "12 12 2 1", 179 | " c white", 180 | ". c black", 181 | " ", 182 | " .......... ", 183 | " . . ", 184 | " . . ", 185 | " . . ", 186 | " . . ", 187 | " . . ", 188 | " . . ", 189 | " . . ", 190 | " . . ", 191 | " .......... ", 192 | " "}; 193 | 194 | const char * const xpm_symbol_mod[] = { 195 | "12 12 2 1", 196 | " c white", 197 | ". c black", 198 | " ", 199 | " .......... ", 200 | " . . ", 201 | " . . ", 202 | " . .. . ", 203 | " . .... . ", 204 | " . .... . ", 205 | " . .. . ", 206 | " . . ", 207 | " . . ", 208 | " .......... ", 209 | " "}; 210 | 211 | const char * const xpm_symbol_yes[] = { 212 | "12 12 2 1", 213 | " c white", 214 | ". c black", 215 | " ", 216 | " .......... ", 217 | " . . ", 218 | " . . ", 219 | " . . . ", 220 | " . .. . ", 221 | " . . .. . ", 222 | " . .... . ", 223 | " . .. . ", 224 | " . . ", 225 | " .......... ", 226 | " "}; 227 | 228 | const char * const xpm_choice_no[] = { 229 | "12 12 2 1", 230 | " c white", 231 | ". c black", 232 | " ", 233 | " .... ", 234 | " .. .. ", 235 | " . . ", 236 | " . . ", 237 | " . . ", 238 | " . . ", 239 | " . . ", 240 | " . . ", 241 | " .. .. ", 242 | " .... ", 243 | " "}; 244 | 245 | const char * const xpm_choice_yes[] = { 246 | "12 12 2 1", 247 | " c white", 248 | ". c black", 249 | " ", 250 | " .... ", 251 | " .. .. ", 252 | " . . ", 253 | " . .. . ", 254 | " . .... . ", 255 | " . .... . ", 256 | " . .. . ", 257 | " . . ", 258 | " .. .. ", 259 | " .... ", 260 | " "}; 261 | 262 | const char * const xpm_menu[] = { 263 | "12 12 2 1", 264 | " c white", 265 | ". c black", 266 | " ", 267 | " .......... ", 268 | " . . ", 269 | " . .. . ", 270 | " . .... . ", 271 | " . ...... . ", 272 | " . ...... . ", 273 | " . .... . ", 274 | " . .. . ", 275 | " . . ", 276 | " .......... ", 277 | " "}; 278 | 279 | const char * const xpm_menu_inv[] = { 280 | "12 12 2 1", 281 | " c white", 282 | ". c black", 283 | " ", 284 | " .......... ", 285 | " .......... ", 286 | " .. ...... ", 287 | " .. .... ", 288 | " .. .. ", 289 | " .. .. ", 290 | " .. .... ", 291 | " .. ...... ", 292 | " .......... ", 293 | " .......... ", 294 | " "}; 295 | 296 | const char * const xpm_menuback[] = { 297 | "12 12 2 1", 298 | " c white", 299 | ". c black", 300 | " ", 301 | " .......... ", 302 | " . . ", 303 | " . .. . ", 304 | " . .... . ", 305 | " . ...... . ", 306 | " . ...... . ", 307 | " . .... . ", 308 | " . .. . ", 309 | " . . ", 310 | " .......... ", 311 | " "}; 312 | 313 | const char * const xpm_void[] = { 314 | "12 12 2 1", 315 | " c white", 316 | ". c black", 317 | " ", 318 | " ", 319 | " ", 320 | " ", 321 | " ", 322 | " ", 323 | " ", 324 | " ", 325 | " ", 326 | " ", 327 | " ", 328 | " "}; 329 | -------------------------------------------------------------------------------- /scripts/kconfig/images.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* 3 | * Copyright (C) 2002 Roman Zippel 4 | */ 5 | 6 | #ifndef IMAGES_H 7 | #define IMAGES_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | extern const char * const xpm_load[]; 14 | extern const char * const xpm_save[]; 15 | extern const char * const xpm_back[]; 16 | extern const char * const xpm_tree_view[]; 17 | extern const char * const xpm_single_view[]; 18 | extern const char * const xpm_split_view[]; 19 | extern const char * const xpm_symbol_no[]; 20 | extern const char * const xpm_symbol_mod[]; 21 | extern const char * const xpm_symbol_yes[]; 22 | extern const char * const xpm_choice_no[]; 23 | extern const char * const xpm_choice_yes[]; 24 | extern const char * const xpm_menu[]; 25 | extern const char * const xpm_menu_inv[]; 26 | extern const char * const xpm_menuback[]; 27 | extern const char * const xpm_void[]; 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif /* IMAGES_H */ 34 | -------------------------------------------------------------------------------- /scripts/kconfig/internal.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0-only */ 2 | #ifndef INTERNAL_H 3 | #define INTERNAL_H 4 | 5 | struct menu; 6 | 7 | extern struct menu *current_menu, *current_entry; 8 | 9 | #endif /* INTERNAL_H */ 10 | -------------------------------------------------------------------------------- /scripts/kconfig/list.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | #ifndef LIST_H 3 | #define LIST_H 4 | 5 | /* 6 | * Copied from include/linux/... 7 | */ 8 | 9 | #undef offsetof 10 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 11 | 12 | /** 13 | * container_of - cast a member of a structure out to the containing structure 14 | * @ptr: the pointer to the member. 15 | * @type: the type of the container struct this is embedded in. 16 | * @member: the name of the member within the struct. 17 | * 18 | */ 19 | #define container_of(ptr, type, member) ({ \ 20 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 21 | (type *)( (char *)__mptr - offsetof(type,member) );}) 22 | 23 | 24 | struct list_head { 25 | struct list_head *next, *prev; 26 | }; 27 | 28 | 29 | #define LIST_HEAD_INIT(name) { &(name), &(name) } 30 | 31 | #define LIST_HEAD(name) \ 32 | struct list_head name = LIST_HEAD_INIT(name) 33 | 34 | /** 35 | * list_entry - get the struct for this entry 36 | * @ptr: the &struct list_head pointer. 37 | * @type: the type of the struct this is embedded in. 38 | * @member: the name of the list_head within the struct. 39 | */ 40 | #define list_entry(ptr, type, member) \ 41 | container_of(ptr, type, member) 42 | 43 | /** 44 | * list_for_each_entry - iterate over list of given type 45 | * @pos: the type * to use as a loop cursor. 46 | * @head: the head for your list. 47 | * @member: the name of the list_head within the struct. 48 | */ 49 | #define list_for_each_entry(pos, head, member) \ 50 | for (pos = list_entry((head)->next, typeof(*pos), member); \ 51 | &pos->member != (head); \ 52 | pos = list_entry(pos->member.next, typeof(*pos), member)) 53 | 54 | /** 55 | * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry 56 | * @pos: the type * to use as a loop cursor. 57 | * @n: another type * to use as temporary storage 58 | * @head: the head for your list. 59 | * @member: the name of the list_head within the struct. 60 | */ 61 | #define list_for_each_entry_safe(pos, n, head, member) \ 62 | for (pos = list_entry((head)->next, typeof(*pos), member), \ 63 | n = list_entry(pos->member.next, typeof(*pos), member); \ 64 | &pos->member != (head); \ 65 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) 66 | 67 | /** 68 | * list_empty - tests whether a list is empty 69 | * @head: the list to test. 70 | */ 71 | static inline int list_empty(const struct list_head *head) 72 | { 73 | return head->next == head; 74 | } 75 | 76 | /* 77 | * Insert a new entry between two known consecutive entries. 78 | * 79 | * This is only for internal list manipulation where we know 80 | * the prev/next entries already! 81 | */ 82 | static inline void __list_add(struct list_head *_new, 83 | struct list_head *prev, 84 | struct list_head *next) 85 | { 86 | next->prev = _new; 87 | _new->next = next; 88 | _new->prev = prev; 89 | prev->next = _new; 90 | } 91 | 92 | /** 93 | * list_add_tail - add a new entry 94 | * @new: new entry to be added 95 | * @head: list head to add it before 96 | * 97 | * Insert a new entry before the specified head. 98 | * This is useful for implementing queues. 99 | */ 100 | static inline void list_add_tail(struct list_head *_new, struct list_head *head) 101 | { 102 | __list_add(_new, head->prev, head); 103 | } 104 | 105 | /* 106 | * Delete a list entry by making the prev/next entries 107 | * point to each other. 108 | * 109 | * This is only for internal list manipulation where we know 110 | * the prev/next entries already! 111 | */ 112 | static inline void __list_del(struct list_head *prev, struct list_head *next) 113 | { 114 | next->prev = prev; 115 | prev->next = next; 116 | } 117 | 118 | #define LIST_POISON1 ((void *) 0x00100100) 119 | #define LIST_POISON2 ((void *) 0x00200200) 120 | /** 121 | * list_del - deletes entry from list. 122 | * @entry: the element to delete from the list. 123 | * Note: list_empty() on entry does not return true after this, the entry is 124 | * in an undefined state. 125 | */ 126 | static inline void list_del(struct list_head *entry) 127 | { 128 | __list_del(entry->prev, entry->next); 129 | entry->next = (struct list_head*)LIST_POISON1; 130 | entry->prev = (struct list_head*)LIST_POISON2; 131 | } 132 | #endif 133 | -------------------------------------------------------------------------------- /scripts/kconfig/lkc.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* 3 | * Copyright (C) 2002 Roman Zippel 4 | */ 5 | 6 | #ifndef LKC_H 7 | #define LKC_H 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "expr.h" 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #include "lkc_proto.h" 20 | 21 | #define SRCTREE "srctree" 22 | 23 | #ifndef CONFIG_ 24 | #define CONFIG_ "CONFIG_" 25 | #endif 26 | static inline const char *CONFIG_prefix(void) 27 | { 28 | return getenv( "CONFIG_" ) ?: CONFIG_; 29 | } 30 | #undef CONFIG_ 31 | #define CONFIG_ CONFIG_prefix() 32 | 33 | extern int yylineno; 34 | void zconfdump(FILE *out); 35 | void zconf_starthelp(void); 36 | FILE *zconf_fopen(const char *name); 37 | void zconf_initscan(const char *name); 38 | void zconf_nextfile(const char *name); 39 | int zconf_lineno(void); 40 | const char *zconf_curname(void); 41 | 42 | /* confdata.c */ 43 | const char *conf_get_configname(void); 44 | void set_all_choice_values(struct symbol *csym); 45 | 46 | /* confdata.c and expr.c */ 47 | static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) 48 | { 49 | assert(len != 0); 50 | 51 | if (fwrite(str, len, count, out) != count) 52 | fprintf(stderr, "Error in writing or end of file.\n"); 53 | } 54 | 55 | /* util.c */ 56 | struct file *file_lookup(const char *name); 57 | void *xmalloc(size_t size); 58 | void *xcalloc(size_t nmemb, size_t size); 59 | void *xrealloc(void *p, size_t size); 60 | char *xstrdup(const char *s); 61 | char *xstrndup(const char *s, size_t n); 62 | 63 | /* lexer.l */ 64 | int yylex(void); 65 | 66 | struct gstr { 67 | size_t len; 68 | char *s; 69 | /* 70 | * when max_width is not zero long lines in string s (if any) get 71 | * wrapped not to exceed the max_width value 72 | */ 73 | int max_width; 74 | }; 75 | struct gstr str_new(void); 76 | void str_free(struct gstr *gs); 77 | void str_append(struct gstr *gs, const char *s); 78 | void str_printf(struct gstr *gs, const char *fmt, ...); 79 | char *str_get(struct gstr *gs); 80 | 81 | /* menu.c */ 82 | void _menu_init(void); 83 | void menu_warn(struct menu *menu, const char *fmt, ...); 84 | struct menu *menu_add_menu(void); 85 | void menu_end_menu(void); 86 | void menu_add_entry(struct symbol *sym); 87 | void menu_add_dep(struct expr *dep); 88 | void menu_add_visibility(struct expr *dep); 89 | struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); 90 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); 91 | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); 92 | void menu_finalize(struct menu *parent); 93 | void menu_set_type(int type); 94 | 95 | extern struct menu rootmenu; 96 | 97 | bool menu_is_empty(struct menu *menu); 98 | bool menu_is_visible(struct menu *menu); 99 | bool menu_has_prompt(struct menu *menu); 100 | const char *menu_get_prompt(struct menu *menu); 101 | struct menu *menu_get_parent_menu(struct menu *menu); 102 | bool menu_has_help(struct menu *menu); 103 | const char *menu_get_help(struct menu *menu); 104 | struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head); 105 | void menu_get_ext_help(struct menu *menu, struct gstr *help); 106 | 107 | /* symbol.c */ 108 | void sym_clear_all_valid(void); 109 | struct symbol *sym_choice_default(struct symbol *sym); 110 | struct property *sym_get_range_prop(struct symbol *sym); 111 | const char *sym_get_string_default(struct symbol *sym); 112 | struct symbol *sym_check_deps(struct symbol *sym); 113 | struct symbol *prop_get_symbol(struct property *prop); 114 | 115 | static inline tristate sym_get_tristate_value(struct symbol *sym) 116 | { 117 | return sym->curr.tri; 118 | } 119 | 120 | 121 | static inline struct symbol *sym_get_choice_value(struct symbol *sym) 122 | { 123 | return (struct symbol *)sym->curr.val; 124 | } 125 | 126 | static inline bool sym_is_choice(struct symbol *sym) 127 | { 128 | return sym->flags & SYMBOL_CHOICE ? true : false; 129 | } 130 | 131 | static inline bool sym_is_choice_value(struct symbol *sym) 132 | { 133 | return sym->flags & SYMBOL_CHOICEVAL ? true : false; 134 | } 135 | 136 | static inline bool sym_is_optional(struct symbol *sym) 137 | { 138 | return sym->flags & SYMBOL_OPTIONAL ? true : false; 139 | } 140 | 141 | static inline bool sym_has_value(struct symbol *sym) 142 | { 143 | return sym->flags & SYMBOL_DEF_USER ? true : false; 144 | } 145 | 146 | #ifdef __cplusplus 147 | } 148 | #endif 149 | 150 | #endif /* LKC_H */ 151 | -------------------------------------------------------------------------------- /scripts/kconfig/lkc_proto.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | #include 3 | 4 | /* confdata.c */ 5 | void conf_parse(const char *name); 6 | int conf_read(const char *name); 7 | int conf_read_simple(const char *name, int); 8 | int conf_write_defconfig(const char *name); 9 | int conf_write(const char *name); 10 | int conf_write_autoconf(int overwrite); 11 | void conf_set_changed(bool val); 12 | bool conf_get_changed(void); 13 | void conf_set_changed_callback(void (*fn)(void)); 14 | void conf_set_message_callback(void (*fn)(const char *s)); 15 | 16 | /* symbol.c */ 17 | extern struct symbol * symbol_hash[SYMBOL_HASHSIZE]; 18 | 19 | struct symbol * sym_lookup(const char *name, int flags); 20 | struct symbol * sym_find(const char *name); 21 | void print_symbol_for_listconfig(struct symbol *sym); 22 | struct symbol ** sym_re_search(const char *pattern); 23 | const char * sym_type_name(enum symbol_type type); 24 | void sym_calc_value(struct symbol *sym); 25 | enum symbol_type sym_get_type(struct symbol *sym); 26 | bool sym_tristate_within_range(struct symbol *sym,tristate tri); 27 | bool sym_set_tristate_value(struct symbol *sym,tristate tri); 28 | tristate sym_toggle_tristate_value(struct symbol *sym); 29 | bool sym_string_valid(struct symbol *sym, const char *newval); 30 | bool sym_string_within_range(struct symbol *sym, const char *str); 31 | bool sym_set_string_value(struct symbol *sym, const char *newval); 32 | bool sym_is_changeable(struct symbol *sym); 33 | struct property * sym_get_choice_prop(struct symbol *sym); 34 | const char * sym_get_string_value(struct symbol *sym); 35 | 36 | const char * prop_get_type_name(enum prop_type type); 37 | 38 | /* preprocess.c */ 39 | enum variable_flavor { 40 | VAR_SIMPLE, 41 | VAR_RECURSIVE, 42 | VAR_APPEND, 43 | }; 44 | void env_write_dep(FILE *f, const char *auto_conf_name); 45 | void variable_add(const char *name, const char *value, 46 | enum variable_flavor flavor); 47 | void variable_all_del(void); 48 | char *expand_dollar(const char **str); 49 | char *expand_one_token(const char **str); 50 | 51 | /* expr.c */ 52 | void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken); 53 | -------------------------------------------------------------------------------- /scripts/kconfig/lxdialog/BIG.FAT.WARNING: -------------------------------------------------------------------------------- 1 | This is NOT the official version of dialog. This version has been 2 | significantly modified from the original. It is for use by the Linux 3 | kernel configuration script. Please do not bother Savio Lam with 4 | questions about this program. 5 | -------------------------------------------------------------------------------- /scripts/kconfig/lxdialog/dialog.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0+ */ 2 | /* 3 | * dialog.h -- common declarations for all dialog modules 4 | * 5 | * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #ifdef __sun__ 17 | #define CURS_MACROS 18 | #endif 19 | #include 20 | 21 | /* 22 | * Colors in ncurses 1.9.9e do not work properly since foreground and 23 | * background colors are OR'd rather than separately masked. This version 24 | * of dialog was hacked to work with ncurses 1.9.9e, making it incompatible 25 | * with standard curses. The simplest fix (to make this work with standard 26 | * curses) uses the wbkgdset() function, not used in the original hack. 27 | * Turn it off if we're building with 1.9.9e, since it just confuses things. 28 | */ 29 | #if defined(NCURSES_VERSION) && defined(_NEED_WRAP) && !defined(GCC_PRINTFLIKE) 30 | #define OLD_NCURSES 1 31 | #undef wbkgdset 32 | #define wbkgdset(w,p) /*nothing */ 33 | #else 34 | #define OLD_NCURSES 0 35 | #endif 36 | 37 | #define TR(params) _tracef params 38 | 39 | #define KEY_ESC 27 40 | #define TAB 9 41 | #define MAX_LEN 2048 42 | #define BUF_SIZE (10*1024) 43 | #define MIN(x,y) (x < y ? x : y) 44 | #define MAX(x,y) (x > y ? x : y) 45 | 46 | #ifndef ACS_ULCORNER 47 | #define ACS_ULCORNER '+' 48 | #endif 49 | #ifndef ACS_LLCORNER 50 | #define ACS_LLCORNER '+' 51 | #endif 52 | #ifndef ACS_URCORNER 53 | #define ACS_URCORNER '+' 54 | #endif 55 | #ifndef ACS_LRCORNER 56 | #define ACS_LRCORNER '+' 57 | #endif 58 | #ifndef ACS_HLINE 59 | #define ACS_HLINE '-' 60 | #endif 61 | #ifndef ACS_VLINE 62 | #define ACS_VLINE '|' 63 | #endif 64 | #ifndef ACS_LTEE 65 | #define ACS_LTEE '+' 66 | #endif 67 | #ifndef ACS_RTEE 68 | #define ACS_RTEE '+' 69 | #endif 70 | #ifndef ACS_UARROW 71 | #define ACS_UARROW '^' 72 | #endif 73 | #ifndef ACS_DARROW 74 | #define ACS_DARROW 'v' 75 | #endif 76 | 77 | /* error return codes */ 78 | #define ERRDISPLAYTOOSMALL (KEY_MAX + 1) 79 | 80 | /* 81 | * Color definitions 82 | */ 83 | struct dialog_color { 84 | chtype atr; /* Color attribute */ 85 | int fg; /* foreground */ 86 | int bg; /* background */ 87 | int hl; /* highlight this item */ 88 | }; 89 | 90 | struct subtitle_list { 91 | struct subtitle_list *next; 92 | const char *text; 93 | }; 94 | 95 | struct dialog_info { 96 | const char *backtitle; 97 | struct subtitle_list *subtitles; 98 | struct dialog_color screen; 99 | struct dialog_color shadow; 100 | struct dialog_color dialog; 101 | struct dialog_color title; 102 | struct dialog_color border; 103 | struct dialog_color button_active; 104 | struct dialog_color button_inactive; 105 | struct dialog_color button_key_active; 106 | struct dialog_color button_key_inactive; 107 | struct dialog_color button_label_active; 108 | struct dialog_color button_label_inactive; 109 | struct dialog_color inputbox; 110 | struct dialog_color inputbox_border; 111 | struct dialog_color searchbox; 112 | struct dialog_color searchbox_title; 113 | struct dialog_color searchbox_border; 114 | struct dialog_color position_indicator; 115 | struct dialog_color menubox; 116 | struct dialog_color menubox_border; 117 | struct dialog_color item; 118 | struct dialog_color item_selected; 119 | struct dialog_color tag; 120 | struct dialog_color tag_selected; 121 | struct dialog_color tag_key; 122 | struct dialog_color tag_key_selected; 123 | struct dialog_color check; 124 | struct dialog_color check_selected; 125 | struct dialog_color uarrow; 126 | struct dialog_color darrow; 127 | }; 128 | 129 | /* 130 | * Global variables 131 | */ 132 | extern struct dialog_info dlg; 133 | extern char dialog_input_result[]; 134 | extern int saved_x, saved_y; /* Needed in signal handler in mconf.c */ 135 | 136 | /* 137 | * Function prototypes 138 | */ 139 | 140 | /* item list as used by checklist and menubox */ 141 | void item_reset(void); 142 | void item_make(const char *fmt, ...); 143 | void item_add_str(const char *fmt, ...); 144 | void item_set_tag(char tag); 145 | void item_set_data(void *p); 146 | void item_set_selected(int val); 147 | int item_activate_selected(void); 148 | void *item_data(void); 149 | char item_tag(void); 150 | 151 | /* item list manipulation for lxdialog use */ 152 | #define MAXITEMSTR 200 153 | struct dialog_item { 154 | char str[MAXITEMSTR]; /* prompt displayed */ 155 | char tag; 156 | void *data; /* pointer to menu item - used by menubox+checklist */ 157 | int selected; /* Set to 1 by dialog_*() function if selected. */ 158 | }; 159 | 160 | /* list of lialog_items */ 161 | struct dialog_list { 162 | struct dialog_item node; 163 | struct dialog_list *next; 164 | }; 165 | 166 | extern struct dialog_list *item_cur; 167 | extern struct dialog_list item_nil; 168 | extern struct dialog_list *item_head; 169 | 170 | int item_count(void); 171 | void item_set(int n); 172 | int item_n(void); 173 | const char *item_str(void); 174 | int item_is_selected(void); 175 | int item_is_tag(char tag); 176 | #define item_foreach() \ 177 | for (item_cur = item_head ? item_head: item_cur; \ 178 | item_cur && (item_cur != &item_nil); item_cur = item_cur->next) 179 | 180 | /* generic key handlers */ 181 | int on_key_esc(WINDOW *win); 182 | int on_key_resize(void); 183 | 184 | /* minimum (re)size values */ 185 | #define CHECKLIST_HEIGTH_MIN 6 /* For dialog_checklist() */ 186 | #define CHECKLIST_WIDTH_MIN 6 187 | #define INPUTBOX_HEIGTH_MIN 2 /* For dialog_inputbox() */ 188 | #define INPUTBOX_WIDTH_MIN 2 189 | #define MENUBOX_HEIGTH_MIN 15 /* For dialog_menu() */ 190 | #define MENUBOX_WIDTH_MIN 65 191 | #define TEXTBOX_HEIGTH_MIN 8 /* For dialog_textbox() */ 192 | #define TEXTBOX_WIDTH_MIN 8 193 | #define YESNO_HEIGTH_MIN 4 /* For dialog_yesno() */ 194 | #define YESNO_WIDTH_MIN 4 195 | #define WINDOW_HEIGTH_MIN 19 /* For init_dialog() */ 196 | #define WINDOW_WIDTH_MIN 80 197 | 198 | int init_dialog(const char *backtitle); 199 | void set_dialog_backtitle(const char *backtitle); 200 | void set_dialog_subtitles(struct subtitle_list *subtitles); 201 | void end_dialog(int x, int y); 202 | void attr_clear(WINDOW * win, int height, int width, chtype attr); 203 | void dialog_clear(void); 204 | void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); 205 | void print_button(WINDOW * win, const char *label, int y, int x, int selected); 206 | void print_title(WINDOW *dialog, const char *title, int width); 207 | void draw_box(WINDOW * win, int y, int x, int height, int width, chtype box, 208 | chtype border); 209 | void draw_shadow(WINDOW * win, int y, int x, int height, int width); 210 | 211 | int first_alpha(const char *string, const char *exempt); 212 | int dialog_yesno(const char *title, const char *prompt, int height, int width); 213 | int dialog_msgbox(const char *title, const char *prompt, int height, 214 | int width, int pause); 215 | 216 | 217 | typedef void (*update_text_fn)(char *buf, size_t start, size_t end, void 218 | *_data); 219 | int dialog_textbox(const char *title, char *tbuf, int initial_height, 220 | int initial_width, int *keys, int *_vscroll, int *_hscroll, 221 | update_text_fn update_text, void *data); 222 | int dialog_menu(const char *title, const char *prompt, 223 | const void *selected, int *s_scroll); 224 | int dialog_checklist(const char *title, const char *prompt, int height, 225 | int width, int list_height); 226 | int dialog_inputbox(const char *title, const char *prompt, int height, 227 | int width, const char *init); 228 | 229 | /* 230 | * This is the base for fictitious keys, which activate 231 | * the buttons. 232 | * 233 | * Mouse-generated keys are the following: 234 | * -- the first 32 are used as numbers, in addition to '0'-'9' 235 | * -- the lowercase are used to signal mouse-enter events (M_EVENT + 'o') 236 | * -- uppercase chars are used to invoke the button (M_EVENT + 'O') 237 | */ 238 | #define M_EVENT (KEY_MAX+1) 239 | -------------------------------------------------------------------------------- /scripts/kconfig/lxdialog/inputbox.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0+ 2 | /* 3 | * inputbox.c -- implements the input box 4 | * 5 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) 6 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) 7 | */ 8 | 9 | #include "dialog.h" 10 | 11 | char dialog_input_result[MAX_LEN + 1]; 12 | 13 | /* 14 | * Print the termination buttons 15 | */ 16 | static void print_buttons(WINDOW * dialog, int height, int width, int selected) 17 | { 18 | int x = width / 2 - 11; 19 | int y = height - 2; 20 | 21 | print_button(dialog, " Ok ", y, x, selected == 0); 22 | print_button(dialog, " Help ", y, x + 14, selected == 1); 23 | 24 | wmove(dialog, y, x + 1 + 14 * selected); 25 | wrefresh(dialog); 26 | } 27 | 28 | /* 29 | * Display a dialog box for inputing a string 30 | */ 31 | int dialog_inputbox(const char *title, const char *prompt, int height, int width, 32 | const char *init) 33 | { 34 | int i, x, y, box_y, box_x, box_width; 35 | int input_x = 0, key = 0, button = -1; 36 | int show_x, len, pos; 37 | char *instr = dialog_input_result; 38 | WINDOW *dialog; 39 | 40 | if (!init) 41 | instr[0] = '\0'; 42 | else 43 | strcpy(instr, init); 44 | 45 | do_resize: 46 | if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGTH_MIN)) 47 | return -ERRDISPLAYTOOSMALL; 48 | if (getmaxx(stdscr) <= (width - INPUTBOX_WIDTH_MIN)) 49 | return -ERRDISPLAYTOOSMALL; 50 | 51 | /* center dialog box on screen */ 52 | x = (getmaxx(stdscr) - width) / 2; 53 | y = (getmaxy(stdscr) - height) / 2; 54 | 55 | draw_shadow(stdscr, y, x, height, width); 56 | 57 | dialog = newwin(height, width, y, x); 58 | keypad(dialog, TRUE); 59 | 60 | draw_box(dialog, 0, 0, height, width, 61 | dlg.dialog.atr, dlg.border.atr); 62 | wattrset(dialog, dlg.border.atr); 63 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); 64 | for (i = 0; i < width - 2; i++) 65 | waddch(dialog, ACS_HLINE); 66 | wattrset(dialog, dlg.dialog.atr); 67 | waddch(dialog, ACS_RTEE); 68 | 69 | print_title(dialog, title, width); 70 | 71 | wattrset(dialog, dlg.dialog.atr); 72 | print_autowrap(dialog, prompt, width - 2, 1, 3); 73 | 74 | /* Draw the input field box */ 75 | box_width = width - 6; 76 | getyx(dialog, y, x); 77 | box_y = y + 2; 78 | box_x = (width - box_width) / 2; 79 | draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, 80 | dlg.dialog.atr, dlg.border.atr); 81 | 82 | print_buttons(dialog, height, width, 0); 83 | 84 | /* Set up the initial value */ 85 | wmove(dialog, box_y, box_x); 86 | wattrset(dialog, dlg.inputbox.atr); 87 | 88 | len = strlen(instr); 89 | pos = len; 90 | 91 | if (len >= box_width) { 92 | show_x = len - box_width + 1; 93 | input_x = box_width - 1; 94 | for (i = 0; i < box_width - 1; i++) 95 | waddch(dialog, instr[show_x + i]); 96 | } else { 97 | show_x = 0; 98 | input_x = len; 99 | waddstr(dialog, instr); 100 | } 101 | 102 | wmove(dialog, box_y, box_x + input_x); 103 | 104 | wrefresh(dialog); 105 | 106 | while (key != KEY_ESC) { 107 | key = wgetch(dialog); 108 | 109 | if (button == -1) { /* Input box selected */ 110 | switch (key) { 111 | case TAB: 112 | case KEY_UP: 113 | case KEY_DOWN: 114 | break; 115 | case KEY_BACKSPACE: 116 | case 8: /* ^H */ 117 | case 127: /* ^? */ 118 | if (pos) { 119 | wattrset(dialog, dlg.inputbox.atr); 120 | if (input_x == 0) { 121 | show_x--; 122 | } else 123 | input_x--; 124 | 125 | if (pos < len) { 126 | for (i = pos - 1; i < len; i++) { 127 | instr[i] = instr[i+1]; 128 | } 129 | } 130 | 131 | pos--; 132 | len--; 133 | instr[len] = '\0'; 134 | wmove(dialog, box_y, box_x); 135 | for (i = 0; i < box_width; i++) { 136 | if (!instr[show_x + i]) { 137 | waddch(dialog, ' '); 138 | break; 139 | } 140 | waddch(dialog, instr[show_x + i]); 141 | } 142 | wmove(dialog, box_y, input_x + box_x); 143 | wrefresh(dialog); 144 | } 145 | continue; 146 | case KEY_LEFT: 147 | if (pos > 0) { 148 | if (input_x > 0) { 149 | wmove(dialog, box_y, --input_x + box_x); 150 | } else if (input_x == 0) { 151 | show_x--; 152 | wmove(dialog, box_y, box_x); 153 | for (i = 0; i < box_width; i++) { 154 | if (!instr[show_x + i]) { 155 | waddch(dialog, ' '); 156 | break; 157 | } 158 | waddch(dialog, instr[show_x + i]); 159 | } 160 | wmove(dialog, box_y, box_x); 161 | } 162 | pos--; 163 | } 164 | continue; 165 | case KEY_RIGHT: 166 | if (pos < len) { 167 | if (input_x < box_width - 1) { 168 | wmove(dialog, box_y, ++input_x + box_x); 169 | } else if (input_x == box_width - 1) { 170 | show_x++; 171 | wmove(dialog, box_y, box_x); 172 | for (i = 0; i < box_width; i++) { 173 | if (!instr[show_x + i]) { 174 | waddch(dialog, ' '); 175 | break; 176 | } 177 | waddch(dialog, instr[show_x + i]); 178 | } 179 | wmove(dialog, box_y, input_x + box_x); 180 | } 181 | pos++; 182 | } 183 | continue; 184 | default: 185 | if (key < 0x100 && isprint(key)) { 186 | if (len < MAX_LEN) { 187 | wattrset(dialog, dlg.inputbox.atr); 188 | if (pos < len) { 189 | for (i = len; i > pos; i--) 190 | instr[i] = instr[i-1]; 191 | instr[pos] = key; 192 | } else { 193 | instr[len] = key; 194 | } 195 | pos++; 196 | len++; 197 | instr[len] = '\0'; 198 | 199 | if (input_x == box_width - 1) { 200 | show_x++; 201 | } else { 202 | input_x++; 203 | } 204 | 205 | wmove(dialog, box_y, box_x); 206 | for (i = 0; i < box_width; i++) { 207 | if (!instr[show_x + i]) { 208 | waddch(dialog, ' '); 209 | break; 210 | } 211 | waddch(dialog, instr[show_x + i]); 212 | } 213 | wmove(dialog, box_y, input_x + box_x); 214 | wrefresh(dialog); 215 | } else 216 | flash(); /* Alarm user about overflow */ 217 | continue; 218 | } 219 | } 220 | } 221 | switch (key) { 222 | case 'O': 223 | case 'o': 224 | delwin(dialog); 225 | return 0; 226 | case 'H': 227 | case 'h': 228 | delwin(dialog); 229 | return 1; 230 | case KEY_UP: 231 | case KEY_LEFT: 232 | switch (button) { 233 | case -1: 234 | button = 1; /* Indicates "Help" button is selected */ 235 | print_buttons(dialog, height, width, 1); 236 | break; 237 | case 0: 238 | button = -1; /* Indicates input box is selected */ 239 | print_buttons(dialog, height, width, 0); 240 | wmove(dialog, box_y, box_x + input_x); 241 | wrefresh(dialog); 242 | break; 243 | case 1: 244 | button = 0; /* Indicates "OK" button is selected */ 245 | print_buttons(dialog, height, width, 0); 246 | break; 247 | } 248 | break; 249 | case TAB: 250 | case KEY_DOWN: 251 | case KEY_RIGHT: 252 | switch (button) { 253 | case -1: 254 | button = 0; /* Indicates "OK" button is selected */ 255 | print_buttons(dialog, height, width, 0); 256 | break; 257 | case 0: 258 | button = 1; /* Indicates "Help" button is selected */ 259 | print_buttons(dialog, height, width, 1); 260 | break; 261 | case 1: 262 | button = -1; /* Indicates input box is selected */ 263 | print_buttons(dialog, height, width, 0); 264 | wmove(dialog, box_y, box_x + input_x); 265 | wrefresh(dialog); 266 | break; 267 | } 268 | break; 269 | case ' ': 270 | case '\n': 271 | delwin(dialog); 272 | return (button == -1 ? 0 : button); 273 | case 'X': 274 | case 'x': 275 | key = KEY_ESC; 276 | break; 277 | case KEY_ESC: 278 | key = on_key_esc(dialog); 279 | break; 280 | case KEY_RESIZE: 281 | delwin(dialog); 282 | on_key_resize(); 283 | goto do_resize; 284 | } 285 | } 286 | 287 | delwin(dialog); 288 | return KEY_ESC; /* ESC pressed */ 289 | } 290 | -------------------------------------------------------------------------------- /scripts/kconfig/lxdialog/yesno.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0+ 2 | /* 3 | * yesno.c -- implements the yes/no box 4 | * 5 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) 6 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) 7 | */ 8 | 9 | #include "dialog.h" 10 | 11 | /* 12 | * Display termination buttons 13 | */ 14 | static void print_buttons(WINDOW * dialog, int height, int width, int selected) 15 | { 16 | int x = width / 2 - 10; 17 | int y = height - 2; 18 | 19 | print_button(dialog, " Yes ", y, x, selected == 0); 20 | print_button(dialog, " No ", y, x + 13, selected == 1); 21 | 22 | wmove(dialog, y, x + 1 + 13 * selected); 23 | wrefresh(dialog); 24 | } 25 | 26 | /* 27 | * Display a dialog box with two buttons - Yes and No 28 | */ 29 | int dialog_yesno(const char *title, const char *prompt, int height, int width) 30 | { 31 | int i, x, y, key = 0, button = 0; 32 | WINDOW *dialog; 33 | 34 | do_resize: 35 | if (getmaxy(stdscr) < (height + YESNO_HEIGTH_MIN)) 36 | return -ERRDISPLAYTOOSMALL; 37 | if (getmaxx(stdscr) < (width + YESNO_WIDTH_MIN)) 38 | return -ERRDISPLAYTOOSMALL; 39 | 40 | /* center dialog box on screen */ 41 | x = (getmaxx(stdscr) - width) / 2; 42 | y = (getmaxy(stdscr) - height) / 2; 43 | 44 | draw_shadow(stdscr, y, x, height, width); 45 | 46 | dialog = newwin(height, width, y, x); 47 | keypad(dialog, TRUE); 48 | 49 | draw_box(dialog, 0, 0, height, width, 50 | dlg.dialog.atr, dlg.border.atr); 51 | wattrset(dialog, dlg.border.atr); 52 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); 53 | for (i = 0; i < width - 2; i++) 54 | waddch(dialog, ACS_HLINE); 55 | wattrset(dialog, dlg.dialog.atr); 56 | waddch(dialog, ACS_RTEE); 57 | 58 | print_title(dialog, title, width); 59 | 60 | wattrset(dialog, dlg.dialog.atr); 61 | print_autowrap(dialog, prompt, width - 2, 1, 3); 62 | 63 | print_buttons(dialog, height, width, 0); 64 | 65 | while (key != KEY_ESC) { 66 | key = wgetch(dialog); 67 | switch (key) { 68 | case 'Y': 69 | case 'y': 70 | delwin(dialog); 71 | return 0; 72 | case 'N': 73 | case 'n': 74 | delwin(dialog); 75 | return 1; 76 | 77 | case TAB: 78 | case KEY_LEFT: 79 | case KEY_RIGHT: 80 | button = ((key == KEY_LEFT ? --button : ++button) < 0) ? 1 : (button > 1 ? 0 : button); 81 | 82 | print_buttons(dialog, height, width, button); 83 | wrefresh(dialog); 84 | break; 85 | case ' ': 86 | case '\n': 87 | delwin(dialog); 88 | return button; 89 | case KEY_ESC: 90 | key = on_key_esc(dialog); 91 | break; 92 | case KEY_RESIZE: 93 | delwin(dialog); 94 | on_key_resize(); 95 | goto do_resize; 96 | } 97 | } 98 | 99 | delwin(dialog); 100 | return key; /* ESC pressed */ 101 | } 102 | -------------------------------------------------------------------------------- /scripts/kconfig/mconf-cfg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SPDX-License-Identifier: GPL-2.0 3 | 4 | cflags=$1 5 | libs=$2 6 | 7 | PKG="ncursesw" 8 | PKG2="ncurses" 9 | 10 | if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then 11 | if ${HOSTPKG_CONFIG} --exists $PKG; then 12 | ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} 13 | ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs} 14 | exit 0 15 | fi 16 | 17 | if ${HOSTPKG_CONFIG} --exists ${PKG2}; then 18 | ${HOSTPKG_CONFIG} --cflags ${PKG2} > ${cflags} 19 | ${HOSTPKG_CONFIG} --libs ${PKG2} > ${libs} 20 | exit 0 21 | fi 22 | fi 23 | 24 | # Check the default paths in case pkg-config is not installed. 25 | # (Even if it is installed, some distributions such as openSUSE cannot 26 | # find ncurses by pkg-config.) 27 | if [ -f /usr/include/ncursesw/ncurses.h ]; then 28 | echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags} 29 | echo -lncursesw > ${libs} 30 | exit 0 31 | fi 32 | 33 | if [ -f /usr/include/ncurses/ncurses.h ]; then 34 | echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags} 35 | echo -lncurses > ${libs} 36 | exit 0 37 | fi 38 | 39 | # As a final fallback before giving up, check if $HOSTCC knows of a default 40 | # ncurses installation (e.g. from a vendor-specific sysroot). 41 | if echo '#include ' | ${HOSTCC} -E - >/dev/null 2>&1; then 42 | echo -D_GNU_SOURCE > ${cflags} 43 | echo -lncurses > ${libs} 44 | exit 0 45 | fi 46 | 47 | echo >&2 "*" 48 | echo >&2 "* Unable to find the ncurses package." 49 | echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev" 50 | echo >&2 "* depending on your distribution)." 51 | echo >&2 "*" 52 | echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the" 53 | echo >&2 "* ncurses installed in a non-default location." 54 | echo >&2 "*" 55 | exit 1 56 | -------------------------------------------------------------------------------- /scripts/kconfig/merge_config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SPDX-License-Identifier: GPL-2.0 3 | # 4 | # merge_config.sh - Takes a list of config fragment values, and merges 5 | # them one by one. Provides warnings on overridden values, and specified 6 | # values that did not make it to the resulting .config file (due to missed 7 | # dependencies or config symbol removal). 8 | # 9 | # Portions reused from kconf_check and generate_cfg: 10 | # http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/kconf_check 11 | # http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/generate_cfg 12 | # 13 | # Copyright (c) 2009-2010 Wind River Systems, Inc. 14 | # Copyright 2011 Linaro 15 | 16 | set -e 17 | 18 | clean_up() { 19 | rm -f $TMP_FILE 20 | rm -f $MERGE_FILE 21 | } 22 | 23 | usage() { 24 | echo "Usage: $0 [OPTIONS] [CONFIG [...]]" 25 | echo " -h display this help text" 26 | echo " -m only merge the fragments, do not execute the make command" 27 | echo " -n use allnoconfig instead of alldefconfig" 28 | echo " -r list redundant entries when merging fragments" 29 | echo " -y make builtin have precedence over modules" 30 | echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead." 31 | echo " -s strict mode. Fail if the fragment redefines any value." 32 | echo 33 | echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable." 34 | } 35 | 36 | RUNMAKE=true 37 | ALLTARGET=alldefconfig 38 | WARNREDUN=false 39 | BUILTIN=false 40 | OUTPUT=. 41 | STRICT=false 42 | CONFIG_PREFIX=${CONFIG_-CONFIG_} 43 | 44 | while true; do 45 | case $1 in 46 | "-n") 47 | ALLTARGET=allnoconfig 48 | shift 49 | continue 50 | ;; 51 | "-m") 52 | RUNMAKE=false 53 | shift 54 | continue 55 | ;; 56 | "-h") 57 | usage 58 | exit 59 | ;; 60 | "-r") 61 | WARNREDUN=true 62 | shift 63 | continue 64 | ;; 65 | "-y") 66 | BUILTIN=true 67 | shift 68 | continue 69 | ;; 70 | "-O") 71 | if [ -d $2 ];then 72 | OUTPUT=$(echo $2 | sed 's/\/*$//') 73 | else 74 | echo "output directory $2 does not exist" 1>&2 75 | exit 1 76 | fi 77 | shift 2 78 | continue 79 | ;; 80 | "-s") 81 | STRICT=true 82 | shift 83 | continue 84 | ;; 85 | *) 86 | break 87 | ;; 88 | esac 89 | done 90 | 91 | if [ "$#" -lt 1 ] ; then 92 | usage 93 | exit 94 | fi 95 | 96 | if [ -z "$KCONFIG_CONFIG" ]; then 97 | if [ "$OUTPUT" != . ]; then 98 | KCONFIG_CONFIG=$(readlink -m -- "$OUTPUT/.config") 99 | else 100 | KCONFIG_CONFIG=.config 101 | fi 102 | fi 103 | 104 | INITFILE=$1 105 | shift; 106 | 107 | if [ ! -r "$INITFILE" ]; then 108 | echo "The base file '$INITFILE' does not exist. Exit." >&2 109 | exit 1 110 | fi 111 | 112 | MERGE_LIST=$* 113 | SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p" 114 | SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p" 115 | 116 | TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) 117 | MERGE_FILE=$(mktemp ./.merge_tmp.config.XXXXXXXXXX) 118 | 119 | echo "Using $INITFILE as base" 120 | 121 | trap clean_up EXIT 122 | 123 | cat $INITFILE > $TMP_FILE 124 | 125 | # Merge files, printing warnings on overridden values 126 | for ORIG_MERGE_FILE in $MERGE_LIST ; do 127 | echo "Merging $ORIG_MERGE_FILE" 128 | if [ ! -r "$ORIG_MERGE_FILE" ]; then 129 | echo "The merge file '$ORIG_MERGE_FILE' does not exist. Exit." >&2 130 | exit 1 131 | fi 132 | cat $ORIG_MERGE_FILE > $MERGE_FILE 133 | CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE) 134 | 135 | for CFG in $CFG_LIST ; do 136 | grep -q -w $CFG $TMP_FILE || continue 137 | PREV_VAL=$(grep -w $CFG $TMP_FILE) 138 | NEW_VAL=$(grep -w $CFG $MERGE_FILE) 139 | BUILTIN_FLAG=false 140 | if [ "$BUILTIN" = "true" ] && [ "${NEW_VAL#CONFIG_*=}" = "m" ] && [ "${PREV_VAL#CONFIG_*=}" = "y" ]; then 141 | echo Previous value: $PREV_VAL 142 | echo New value: $NEW_VAL 143 | echo -y passed, will not demote y to m 144 | echo 145 | BUILTIN_FLAG=true 146 | elif [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then 147 | echo Value of $CFG is redefined by fragment $ORIG_MERGE_FILE: 148 | echo Previous value: $PREV_VAL 149 | echo New value: $NEW_VAL 150 | echo 151 | if [ "$STRICT" = "true" ]; then 152 | STRICT_MODE_VIOLATED=true 153 | fi 154 | elif [ "$WARNREDUN" = "true" ]; then 155 | echo Value of $CFG is redundant by fragment $ORIG_MERGE_FILE: 156 | fi 157 | if [ "$BUILTIN_FLAG" = "false" ]; then 158 | sed -i "/$CFG[ =]/d" $TMP_FILE 159 | else 160 | sed -i "/$CFG[ =]/d" $MERGE_FILE 161 | fi 162 | done 163 | cat $MERGE_FILE >> $TMP_FILE 164 | done 165 | 166 | if [ "$STRICT_MODE_VIOLATED" = "true" ]; then 167 | echo "The fragment redefined a value and strict mode had been passed." 168 | exit 1 169 | fi 170 | 171 | if [ "$RUNMAKE" = "false" ]; then 172 | cp -T -- "$TMP_FILE" "$KCONFIG_CONFIG" 173 | echo "#" 174 | echo "# merged configuration written to $KCONFIG_CONFIG (needs make)" 175 | echo "#" 176 | exit 177 | fi 178 | 179 | # If we have an output dir, setup the O= argument, otherwise leave 180 | # it blank, since O=. will create an unnecessary ./source softlink 181 | OUTPUT_ARG="" 182 | if [ "$OUTPUT" != "." ] ; then 183 | OUTPUT_ARG="O=$OUTPUT" 184 | fi 185 | 186 | 187 | # Use the merged file as the starting point for: 188 | # alldefconfig: Fills in any missing symbols with Kconfig default 189 | # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set 190 | make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET 191 | 192 | 193 | # Check all specified config values took (might have missed-dependency issues) 194 | for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do 195 | 196 | REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) 197 | ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG" || true) 198 | if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then 199 | echo "Value requested for $CFG not in final .config" 200 | echo "Requested value: $REQUESTED_VAL" 201 | echo "Actual value: $ACTUAL_VAL" 202 | echo "" 203 | fi 204 | done 205 | -------------------------------------------------------------------------------- /scripts/kconfig/nconf-cfg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SPDX-License-Identifier: GPL-2.0 3 | 4 | cflags=$1 5 | libs=$2 6 | 7 | PKG="ncursesw menuw panelw" 8 | PKG2="ncurses menu panel" 9 | 10 | if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then 11 | if ${HOSTPKG_CONFIG} --exists $PKG; then 12 | ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} 13 | ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs} 14 | exit 0 15 | fi 16 | 17 | if ${HOSTPKG_CONFIG} --exists $PKG2; then 18 | ${HOSTPKG_CONFIG} --cflags ${PKG2} > ${cflags} 19 | ${HOSTPKG_CONFIG} --libs ${PKG2} > ${libs} 20 | exit 0 21 | fi 22 | fi 23 | 24 | # Check the default paths in case pkg-config is not installed. 25 | # (Even if it is installed, some distributions such as openSUSE cannot 26 | # find ncurses by pkg-config.) 27 | if [ -f /usr/include/ncursesw/ncurses.h ]; then 28 | echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags} 29 | echo -lncursesw -lmenuw -lpanelw > ${libs} 30 | exit 0 31 | fi 32 | 33 | if [ -f /usr/include/ncurses/ncurses.h ]; then 34 | echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags} 35 | echo -lncurses -lmenu -lpanel > ${libs} 36 | exit 0 37 | fi 38 | 39 | if [ -f /usr/include/ncurses.h ]; then 40 | echo -D_GNU_SOURCE > ${cflags} 41 | echo -lncurses -lmenu -lpanel > ${libs} 42 | exit 0 43 | fi 44 | 45 | echo >&2 "*" 46 | echo >&2 "* Unable to find the ncurses package." 47 | echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev" 48 | echo >&2 "* depending on your distribution)." 49 | echo >&2 "*" 50 | echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the" 51 | echo >&2 "* ncurses installed in a non-default location." 52 | echo >&2 "*" 53 | exit 1 54 | -------------------------------------------------------------------------------- /scripts/kconfig/nconf.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* 3 | * Copyright (C) 2008 Nir Tzachar 4 | * 5 | * Derived from menuconfig. 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #define max(a, b) ({\ 26 | typeof(a) _a = a;\ 27 | typeof(b) _b = b;\ 28 | _a > _b ? _a : _b; }) 29 | 30 | #define min(a, b) ({\ 31 | typeof(a) _a = a;\ 32 | typeof(b) _b = b;\ 33 | _a < _b ? _a : _b; }) 34 | 35 | extern int attr_normal; 36 | extern int attr_main_heading; 37 | extern int attr_main_menu_box; 38 | extern int attr_main_menu_fore; 39 | extern int attr_main_menu_back; 40 | extern int attr_main_menu_grey; 41 | extern int attr_main_menu_heading; 42 | extern int attr_scrollwin_text; 43 | extern int attr_scrollwin_heading; 44 | extern int attr_scrollwin_box; 45 | extern int attr_dialog_text; 46 | extern int attr_dialog_menu_fore; 47 | extern int attr_dialog_menu_back; 48 | extern int attr_dialog_box; 49 | extern int attr_input_box; 50 | extern int attr_input_heading; 51 | extern int attr_input_text; 52 | extern int attr_input_field; 53 | extern int attr_function_text; 54 | extern int attr_function_highlight; 55 | 56 | typedef enum { 57 | F_HELP = 1, 58 | F_SYMBOL = 2, 59 | F_INSTS = 3, 60 | F_CONF = 4, 61 | F_BACK = 5, 62 | F_SAVE = 6, 63 | F_LOAD = 7, 64 | F_SEARCH = 8, 65 | F_EXIT = 9, 66 | } function_key; 67 | 68 | void set_colors(void); 69 | 70 | /* this changes the windows attributes !!! */ 71 | void print_in_middle(WINDOW *win, int y, int width, const char *str, int attrs); 72 | int get_line_length(const char *line); 73 | int get_line_no(const char *text); 74 | const char *get_line(const char *text, int line_no); 75 | void fill_window(WINDOW *win, const char *text); 76 | int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...); 77 | int dialog_inputbox(WINDOW *main_window, 78 | const char *title, const char *prompt, 79 | const char *init, char **resultp, int *result_len); 80 | void refresh_all_windows(WINDOW *main_window); 81 | void show_scroll_win(WINDOW *main_window, 82 | const char *title, 83 | const char *text); 84 | -------------------------------------------------------------------------------- /scripts/kconfig/qconf-cfg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # SPDX-License-Identifier: GPL-2.0 3 | 4 | cflags=$1 5 | libs=$2 6 | bin=$3 7 | 8 | PKG="Qt5Core Qt5Gui Qt5Widgets" 9 | 10 | if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then 11 | echo >&2 "*" 12 | echo >&2 "* 'make xconfig' requires '${HOSTPKG_CONFIG}'. Please install it." 13 | echo >&2 "*" 14 | exit 1 15 | fi 16 | 17 | if ${HOSTPKG_CONFIG} --exists $PKG; then 18 | ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} 19 | ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs} 20 | ${HOSTPKG_CONFIG} --variable=host_bins Qt5Core > ${bin} 21 | exit 0 22 | fi 23 | 24 | echo >&2 "*" 25 | echo >&2 "* Could not find Qt5 via ${HOSTPKG_CONFIG}." 26 | echo >&2 "* Please install Qt5 and make sure it's in PKG_CONFIG_PATH" 27 | echo >&2 "* You need $PKG" 28 | echo >&2 "*" 29 | exit 1 30 | -------------------------------------------------------------------------------- /scripts/kconfig/qconf.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: GPL-2.0 */ 2 | /* 3 | * Copyright (C) 2002 Roman Zippel 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "expr.h" 19 | 20 | class ConfigList; 21 | class ConfigItem; 22 | class ConfigMainWindow; 23 | 24 | class ConfigSettings : public QSettings { 25 | public: 26 | ConfigSettings(); 27 | QList readSizes(const QString& key, bool *ok); 28 | bool writeSizes(const QString& key, const QList& value); 29 | }; 30 | 31 | enum colIdx { 32 | promptColIdx, nameColIdx, dataColIdx 33 | }; 34 | enum listMode { 35 | singleMode, menuMode, symbolMode, fullMode, listMode 36 | }; 37 | enum optionMode { 38 | normalOpt = 0, allOpt, promptOpt 39 | }; 40 | 41 | class ConfigList : public QTreeWidget { 42 | Q_OBJECT 43 | typedef class QTreeWidget Parent; 44 | public: 45 | ConfigList(QWidget *parent, const char *name = 0); 46 | ~ConfigList(); 47 | void reinit(void); 48 | ConfigItem* findConfigItem(struct menu *); 49 | void setSelected(QTreeWidgetItem *item, bool enable) { 50 | for (int i = 0; i < selectedItems().size(); i++) 51 | selectedItems().at(i)->setSelected(false); 52 | 53 | item->setSelected(enable); 54 | } 55 | 56 | protected: 57 | void keyPressEvent(QKeyEvent *e); 58 | void mousePressEvent(QMouseEvent *e); 59 | void mouseReleaseEvent(QMouseEvent *e); 60 | void mouseMoveEvent(QMouseEvent *e); 61 | void mouseDoubleClickEvent(QMouseEvent *e); 62 | void focusInEvent(QFocusEvent *e); 63 | void contextMenuEvent(QContextMenuEvent *e); 64 | 65 | public slots: 66 | void setRootMenu(struct menu *menu); 67 | 68 | void updateList(); 69 | void setValue(ConfigItem* item, tristate val); 70 | void changeValue(ConfigItem* item); 71 | void updateSelection(void); 72 | void saveSettings(void); 73 | void setOptionMode(QAction *action); 74 | void setShowName(bool on); 75 | 76 | signals: 77 | void menuChanged(struct menu *menu); 78 | void menuSelected(struct menu *menu); 79 | void itemSelected(struct menu *menu); 80 | void parentSelected(void); 81 | void gotFocus(struct menu *); 82 | void showNameChanged(bool on); 83 | 84 | public: 85 | void updateListAll(void) 86 | { 87 | updateAll = true; 88 | updateList(); 89 | updateAll = false; 90 | } 91 | void setAllOpen(bool open); 92 | void setParentMenu(void); 93 | 94 | bool menuSkip(struct menu *); 95 | 96 | void updateMenuList(ConfigItem *parent, struct menu*); 97 | void updateMenuList(struct menu *menu); 98 | 99 | bool updateAll; 100 | 101 | bool showName; 102 | enum listMode mode; 103 | enum optionMode optMode; 104 | struct menu *rootEntry; 105 | QPalette disabledColorGroup; 106 | QPalette inactivedColorGroup; 107 | QMenu* headerPopup; 108 | 109 | static QList allLists; 110 | static void updateListForAll(); 111 | static void updateListAllForAll(); 112 | 113 | static QAction *showNormalAction, *showAllAction, *showPromptAction; 114 | }; 115 | 116 | class ConfigItem : public QTreeWidgetItem { 117 | typedef class QTreeWidgetItem Parent; 118 | public: 119 | ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v) 120 | : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) 121 | { 122 | init(); 123 | } 124 | ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) 125 | : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) 126 | { 127 | init(); 128 | } 129 | ConfigItem(ConfigList *parent, ConfigItem *after, bool v) 130 | : Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true) 131 | { 132 | init(); 133 | } 134 | ~ConfigItem(void); 135 | void init(void); 136 | void updateMenu(void); 137 | void testUpdateMenu(bool v); 138 | ConfigList* listView() const 139 | { 140 | return (ConfigList*)Parent::treeWidget(); 141 | } 142 | ConfigItem* firstChild() const 143 | { 144 | return (ConfigItem *)Parent::child(0); 145 | } 146 | ConfigItem* nextSibling() 147 | { 148 | ConfigItem *ret = NULL; 149 | ConfigItem *_parent = (ConfigItem *)parent(); 150 | 151 | if(_parent) { 152 | ret = (ConfigItem *)_parent->child(_parent->indexOfChild(this)+1); 153 | } else { 154 | QTreeWidget *_treeWidget = treeWidget(); 155 | ret = (ConfigItem *)_treeWidget->topLevelItem(_treeWidget->indexOfTopLevelItem(this)+1); 156 | } 157 | 158 | return ret; 159 | } 160 | // TODO: Implement paintCell 161 | 162 | ConfigItem* nextItem; 163 | struct menu *menu; 164 | bool visible; 165 | bool goParent; 166 | 167 | static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon; 168 | static QIcon choiceYesIcon, choiceNoIcon; 169 | static QIcon menuIcon, menubackIcon; 170 | }; 171 | 172 | class ConfigItemDelegate : public QStyledItemDelegate 173 | { 174 | private: 175 | struct menu *menu; 176 | public: 177 | ConfigItemDelegate(QObject *parent = nullptr) 178 | : QStyledItemDelegate(parent) {} 179 | QWidget *createEditor(QWidget *parent, 180 | const QStyleOptionViewItem &option, 181 | const QModelIndex &index) const override; 182 | void setModelData(QWidget *editor, QAbstractItemModel *model, 183 | const QModelIndex &index) const override; 184 | }; 185 | 186 | class ConfigInfoView : public QTextBrowser { 187 | Q_OBJECT 188 | typedef class QTextBrowser Parent; 189 | QMenu *contextMenu; 190 | public: 191 | ConfigInfoView(QWidget* parent, const char *name = 0); 192 | bool showDebug(void) const { return _showDebug; } 193 | 194 | public slots: 195 | void setInfo(struct menu *menu); 196 | void saveSettings(void); 197 | void setShowDebug(bool); 198 | void clicked (const QUrl &url); 199 | 200 | signals: 201 | void showDebugChanged(bool); 202 | void menuSelected(struct menu *); 203 | 204 | protected: 205 | void symbolInfo(void); 206 | void menuInfo(void); 207 | QString debug_info(struct symbol *sym); 208 | static QString print_filter(const QString &str); 209 | static void expr_print_help(void *data, struct symbol *sym, const char *str); 210 | void contextMenuEvent(QContextMenuEvent *event); 211 | 212 | struct symbol *sym; 213 | struct menu *_menu; 214 | bool _showDebug; 215 | }; 216 | 217 | class ConfigSearchWindow : public QDialog { 218 | Q_OBJECT 219 | typedef class QDialog Parent; 220 | public: 221 | ConfigSearchWindow(ConfigMainWindow *parent); 222 | 223 | public slots: 224 | void saveSettings(void); 225 | void search(void); 226 | 227 | protected: 228 | QLineEdit* editField; 229 | QPushButton* searchButton; 230 | QSplitter* split; 231 | ConfigList *list; 232 | ConfigInfoView* info; 233 | 234 | struct symbol **result; 235 | }; 236 | 237 | class ConfigMainWindow : public QMainWindow { 238 | Q_OBJECT 239 | 240 | char *configname; 241 | static QAction *saveAction; 242 | static void conf_changed(void); 243 | public: 244 | ConfigMainWindow(void); 245 | public slots: 246 | void changeMenu(struct menu *); 247 | void changeItens(struct menu *); 248 | void setMenuLink(struct menu *); 249 | void listFocusChanged(void); 250 | void goBack(void); 251 | void loadConfig(void); 252 | bool saveConfig(void); 253 | void saveConfigAs(void); 254 | void searchConfig(void); 255 | void showSingleView(void); 256 | void showSplitView(void); 257 | void showFullView(void); 258 | void showIntro(void); 259 | void showAbout(void); 260 | void saveSettings(void); 261 | 262 | protected: 263 | void closeEvent(QCloseEvent *e); 264 | 265 | ConfigSearchWindow *searchWindow; 266 | ConfigList *menuList; 267 | ConfigList *configList; 268 | ConfigInfoView *helpText; 269 | QAction *backAction; 270 | QAction *singleViewAction; 271 | QAction *splitViewAction; 272 | QAction *fullViewAction; 273 | QSplitter *split1; 274 | QSplitter *split2; 275 | }; 276 | -------------------------------------------------------------------------------- /scripts/kconfig/util.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0 2 | /* 3 | * Copyright (C) 2002-2005 Roman Zippel 4 | * Copyright (C) 2002-2005 Sam Ravnborg 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include "lkc.h" 11 | 12 | /* file already present in list? If not add it */ 13 | struct file *file_lookup(const char *name) 14 | { 15 | struct file *file; 16 | 17 | for (file = file_list; file; file = file->next) { 18 | if (!strcmp(name, file->name)) { 19 | return file; 20 | } 21 | } 22 | 23 | file = xmalloc(sizeof(*file)); 24 | memset(file, 0, sizeof(*file)); 25 | file->name = xstrdup(name); 26 | file->next = file_list; 27 | file_list = file; 28 | return file; 29 | } 30 | 31 | /* Allocate initial growable string */ 32 | struct gstr str_new(void) 33 | { 34 | struct gstr gs; 35 | gs.s = xmalloc(sizeof(char) * 64); 36 | gs.len = 64; 37 | gs.max_width = 0; 38 | strcpy(gs.s, "\0"); 39 | return gs; 40 | } 41 | 42 | /* Free storage for growable string */ 43 | void str_free(struct gstr *gs) 44 | { 45 | if (gs->s) 46 | free(gs->s); 47 | gs->s = NULL; 48 | gs->len = 0; 49 | } 50 | 51 | /* Append to growable string */ 52 | void str_append(struct gstr *gs, const char *s) 53 | { 54 | size_t l; 55 | if (s) { 56 | l = strlen(gs->s) + strlen(s) + 1; 57 | if (l > gs->len) { 58 | gs->s = xrealloc(gs->s, l); 59 | gs->len = l; 60 | } 61 | strcat(gs->s, s); 62 | } 63 | } 64 | 65 | /* Append printf formatted string to growable string */ 66 | void str_printf(struct gstr *gs, const char *fmt, ...) 67 | { 68 | va_list ap; 69 | char s[10000]; /* big enough... */ 70 | va_start(ap, fmt); 71 | vsnprintf(s, sizeof(s), fmt, ap); 72 | str_append(gs, s); 73 | va_end(ap); 74 | } 75 | 76 | /* Retrieve value of growable string */ 77 | char *str_get(struct gstr *gs) 78 | { 79 | return gs->s; 80 | } 81 | 82 | void *xmalloc(size_t size) 83 | { 84 | void *p = malloc(size); 85 | if (p) 86 | return p; 87 | fprintf(stderr, "Out of memory.\n"); 88 | exit(1); 89 | } 90 | 91 | void *xcalloc(size_t nmemb, size_t size) 92 | { 93 | void *p = calloc(nmemb, size); 94 | if (p) 95 | return p; 96 | fprintf(stderr, "Out of memory.\n"); 97 | exit(1); 98 | } 99 | 100 | void *xrealloc(void *p, size_t size) 101 | { 102 | p = realloc(p, size); 103 | if (p) 104 | return p; 105 | fprintf(stderr, "Out of memory.\n"); 106 | exit(1); 107 | } 108 | 109 | char *xstrdup(const char *s) 110 | { 111 | char *p; 112 | 113 | p = strdup(s); 114 | if (p) 115 | return p; 116 | fprintf(stderr, "Out of memory.\n"); 117 | exit(1); 118 | } 119 | 120 | char *xstrndup(const char *s, size_t n) 121 | { 122 | char *p; 123 | 124 | p = strndup(s, n); 125 | if (p) 126 | return p; 127 | fprintf(stderr, "Out of memory.\n"); 128 | exit(1); 129 | } 130 | -------------------------------------------------------------------------------- /scripts/menu/blackpill.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcu/kconfig/e17a6a6981f110676aa16e821e1a1e8d7659ee59/scripts/menu/blackpill.jpeg -------------------------------------------------------------------------------- /scripts/menu/compiler/ChoiceCDebugLevel: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | choice C_DEBUG_LEVEL 6 | prompt "C Debug Level" 7 | default C_DEBUG_LEVEL_3 8 | help 9 | -g Debug information depend on OS (stabs, COFF, XCOFF or DWARF) 10 | -g0 No debug information 11 | -g1 Minimal debug information 12 | -g3 Maximum debug information 13 | 14 | config C_DEBUG_LEVEL_DEPEND_ON_OS 15 | bool "-g Dep on OS" 16 | 17 | config C_DEBUG_LEVEL_0 18 | bool "-g0 No" 19 | 20 | config C_DEBUG_LEVEL_1 21 | bool "-g1 Min" 22 | 23 | config C_DEBUG_LEVEL_3 24 | bool "-g3 Max" 25 | 26 | endchoice 27 | 28 | config C_DEBUG_LEVEL 29 | string 30 | default "-g" if C_DEBUG_LEVEL_DEPEND_ON_OS 31 | default "-g0" if C_DEBUG_LEVEL_0 32 | default "-g1" if C_DEBUG_LEVEL_1 33 | default "-g3" if C_DEBUG_LEVEL_3 34 | 35 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/ChoiceCLanguageStandard: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | choice C_LANGUAGE_STANDARD 6 | prompt "C Language Standard" 7 | default STD_C11 8 | 9 | config STD_C90 10 | bool "c90" 11 | 12 | config STD_GNU90 13 | bool "gnu90" 14 | 15 | config STD_C99 16 | bool "c99" 17 | 18 | config STD_GNU99 19 | bool "gnu99" 20 | 21 | config STD_C11 22 | bool "c11" 23 | 24 | config STD_GNU11 25 | bool "gnu11" 26 | 27 | endchoice 28 | 29 | config C_LANGUAGE_STANDARD 30 | string 31 | default "c90" if STD_C90 32 | default "c99" if STD_C99 33 | default "c11" if STD_C11 34 | default "gnu90" if STD_GNU90 35 | default "gnu99" if STD_GNU99 36 | default "gnu11" if STD_GNU11 37 | 38 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/ChoiceCOptimizationLevel: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | choice C_OPTIMIZATION_LEVEL 6 | prompt "C Optimization Level" 7 | default C_OPTIMIZATION_LEVEL_0 8 | help 9 | -Og Standard edit-compile-debug cycle 10 | -O0 Without optimization 11 | -O1 Compiler tries to reduce code size and execution time 12 | -O2 Compiler performs nearly all supported optimizations 13 | -O3 Turn on all optimizations 14 | -Os Optimize for size 15 | 16 | config C_OPTIMIZATION_LEVEL_G 17 | bool "-Og" 18 | 19 | config C_OPTIMIZATION_LEVEL_0 20 | bool "-O0" 21 | 22 | config C_OPTIMIZATION_LEVEL_1 23 | bool "-O1" 24 | 25 | config C_OPTIMIZATION_LEVEL_2 26 | bool "-O2" 27 | 28 | config C_OPTIMIZATION_LEVEL_3 29 | bool "-O3" 30 | 31 | config C_OPTIMIZATION_LEVEL_S 32 | bool "-Os" 33 | 34 | endchoice 35 | 36 | config C_OPTIMIZATION_LEVEL 37 | string 38 | default "-Og" if C_OPTIMIZATION_LEVEL_G 39 | default "-O0" if C_OPTIMIZATION_LEVEL_0 40 | default "-O1" if C_OPTIMIZATION_LEVEL_1 41 | default "-O2" if C_OPTIMIZATION_LEVEL_2 42 | default "-O3" if C_OPTIMIZATION_LEVEL_3 43 | default "-Os" if C_OPTIMIZATION_LEVEL_S 44 | 45 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/FlagCDataSections: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config FLAG_C_DATA_SECTIONS 6 | bool "-fdata-sections" 7 | default y 8 | help 9 | Place data in their own sections 10 | 11 | config C_DATA_SECTIONS 12 | string 13 | default "-fdata-sections" if FLAG_C_DATA_SECTIONS && y 14 | 15 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/FlagCFunctionSections: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config FLAG_C_FUNCTION_SECTIONS 6 | bool "-ffunction-sections" 7 | default y 8 | help 9 | Place functions in their own sections 10 | 11 | config C_FUNCTION_SECTIONS 12 | string 13 | default "-ffunction-sections" if FLAG_C_FUNCTION_SECTIONS && y 14 | 15 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/FlagCStackUsage: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config FLAG_C_STACK_USAGE 6 | bool "-fstack-usage" 7 | default y 8 | help 9 | A unit compiled with -fstack-usage will generate an extra file that 10 | specifies the maximum amount of stack used, on a per-function basis 11 | 12 | config C_STACK_USAGE 13 | string 14 | default "-fstack-usage" if FLAG_C_STACK_USAGE && y 15 | 16 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/FlagCWarnAll: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config FLAG_C_WARNING_ALL 6 | bool "-Wall" 7 | default y 8 | help 9 | This enables all the warnings about constructions that some users consider 10 | questionable, and that are easy to avoid (or modify to prevent the warning), 11 | even in conjunction with macros 12 | 13 | config C_WARNING_ALL 14 | string 15 | default "-Wall" if FLAG_C_WARNING_ALL && y 16 | 17 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/FlagCWarnError: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config FLAG_C_WARNING_ERROR 6 | bool "-Werror" 7 | default n 8 | help 9 | Make all warnings into errors 10 | 11 | config C_WARNING_ERROR 12 | string 13 | default "-Werror" if FLAG_C_WARNING_ERROR && y 14 | 15 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/FlagCWarnExtra: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config FLAG_C_WARNING_EXTRA 6 | bool "-Wextra" 7 | default y 8 | help 9 | This enables some extra warning flags that are not enabled by -Wall 10 | 11 | config C_WARNING_EXTRA 12 | string 13 | default "-Wextra" if FLAG_C_WARNING_EXTRA && y 14 | 15 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/FlagCWarnNoUnusedParameter: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config FLAG_C_WARNING_NO_UNUSED_PARAMETER 6 | bool "-Wno-unused-parameter" 7 | default y 8 | help 9 | Turn off warn whenever a function parameter is unused aside from its 10 | declaration 11 | 12 | config C_WARNING_NO_UNUSED_PARAMETER 13 | string 14 | default "-Wno-unused-parameter" if FLAG_C_WARNING_NO_UNUSED_PARAMETER && y 15 | 16 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/FlagCWarnSwitchDefault: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config FLAG_C_WARNING_SWITCH_DEFAULT 6 | bool "-Wswitch-default" 7 | default n 8 | help 9 | Warn whenever a switch statement does not have a default case 10 | 11 | config C_WARNING_SWITCH_DEFAULT 12 | string 13 | default "-Wswitch-default" if FLAG_C_WARNING_SWITCH_DEFAULT && y 14 | 15 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/FlagCWarnSwitchEnum: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config FLAG_C_WARNING_SWITCH_ENUM 6 | bool "-Wswitch-enum" 7 | default y 8 | help 9 | Warn whenever a switch statement has an index of enumerated type and lacks 10 | a case for one or more of the named codes of that enumeration 11 | 12 | config C_WARNING_SWITCH_ENUM 13 | string 14 | default "-Wswitch-enum" if FLAG_C_WARNING_SWITCH_ENUM && y 15 | 16 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/FlagUsePrintfFloat: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config FLAG_USE_PRINTF_FLOAT 6 | bool "-u_printf_float" 7 | default y 8 | help 9 | Use float with printf from newlib-nano 10 | 11 | config USE_PRINTF_FLOAT 12 | string 13 | default "-u_printf_float" if FLAG_USE_PRINTF_FLOAT && y 14 | 15 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/compiler/FlagUseScanfFloat: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # SPDX-License-Identifier: GPL-3.0-or-later 3 | ############################################################################### 4 | 5 | config FLAG_USE_SCANF_FLOAT 6 | bool "-u_scanf_float" 7 | default n 8 | help 9 | Use float with scanf from newlib-nano 10 | 11 | config USE_SCANF_FLOAT 12 | string 13 | default "-u_scanf_float" if FLAG_USE_SCANF_FLOAT && y 14 | 15 | ############################################################################### -------------------------------------------------------------------------------- /scripts/menu/menuconfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcu/kconfig/e17a6a6981f110676aa16e821e1a1e8d7659ee59/scripts/menu/menuconfig.png --------------------------------------------------------------------------------