Skip to content

Commit 86abca6

Browse files
committed
Initial commit
1 parent 2c36e68 commit 86abca6

6,962 files changed

Lines changed: 1798878 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/c_cpp_properties.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "STM32F4",
5+
"includePath": [
6+
"${workspaceFolder}/config",
7+
"${workspaceFolder}/app/inc",
8+
"${workspaceFolder}/platform/hal/Inc",
9+
"${workspaceFolder}/platform/cmsis/CMSIS/Include",
10+
"${workspaceFolder}/platform/cmsis/CMSIS/Device/ST/STM32F4xx/Include",
11+
"${workspaceFolder}/**"
12+
],
13+
"defines": [
14+
"USE_HAL_DRIVER",
15+
"STM32F411xE"
16+
],
17+
"compilerPath": "/home/mike/bin/arm-gnu-toolchain-14.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc",
18+
"intelliSenseMode": "linux-gcc-arm",
19+
"cStandard": "c11"
20+
}
21+
],
22+
"version": 4
23+
}

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
TARGET = firmware
2+
3+
include config/chip.mk
4+
5+
CC = arm-none-eabi-gcc
6+
OBJCOPY = arm-none-eabi-objcopy
7+
8+
# Параметры ядра
9+
CPU = -mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16
10+
11+
CFLAGS = $(CPU) -O2 -Wall
12+
CFLAGS += -Iapp/inc
13+
CFLAGS += -Iconfig
14+
CFLAGS += -Iplatform/hal/Inc
15+
CFLAGS += -Iplatform/cmsis/CMSIS/Include
16+
CFLAGS += -Iplatform/cmsis/CMSIS/Device/ST/STM32F4xx/Include
17+
CFLAGS += -DUSE_HAL_DRIVER $(DEFS)
18+
19+
LDFLAGS = -T platform/linker/$(LDSCRIPT) -nostartfiles --specs=nosys.specs --specs=nano.specs
20+
21+
SRC = \
22+
app/src/main.c \
23+
config/clock.c \
24+
platform/startup/$(STARTUP) \
25+
platform/cmsis/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c \
26+
platform/hal/Src/stm32f4xx_hal.c \
27+
platform/hal/Src/stm32f4xx_hal_gpio.c \
28+
platform/hal/Src/stm32f4xx_hal_rcc.c \
29+
platform/hal/Src/stm32f4xx_hal_cortex.c
30+
31+
all: $(TARGET).elf
32+
33+
$(TARGET).elf:
34+
mkdir -p build
35+
$(CC) $(CFLAGS) $(SRC) $(LDFLAGS) -o build/$@
36+
$(OBJCOPY) -O ihex build/$(TARGET).elf build/$(TARGET).hex
37+
$(OBJCOPY) -O binary build/$(TARGET).elf build/$(TARGET).bin
38+
39+
clean:
40+
rm -rf build/*

app/inc/main.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#pragma once
2+
3+
#include <stdint.h>
4+
#include <stdbool.h>
5+
6+
#include "stm32f4xx_hal.h"
7+
8+
/* Прототип clock-функции */
9+
void SystemClock_Config(void);

app/src/main.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include "stm32f4xx_hal.h"
2+
#include "main.h"
3+
4+
int main(void)
5+
{
6+
/* Инициализация HAL:
7+
- SysTick
8+
- NVIC
9+
- внутренние структуры */
10+
HAL_Init();
11+
12+
/* Настройка системной частоты */
13+
SystemClock_Config();
14+
15+
/* Включаем тактирование GPIOA */
16+
__HAL_RCC_GPIOA_CLK_ENABLE();
17+
18+
GPIO_InitTypeDef gpio = {0};
19+
20+
gpio.Pin = GPIO_PIN_5; /* PA5 (LED на Nucleo) */
21+
gpio.Mode = GPIO_MODE_OUTPUT_PP;
22+
gpio.Pull = GPIO_NOPULL;
23+
gpio.Speed = GPIO_SPEED_FREQ_LOW;
24+
25+
HAL_GPIO_Init(GPIOA, &gpio);
26+
27+
while (1)
28+
{
29+
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
30+
HAL_Delay(500);
31+
}
32+
}
33+
34+
void _init(void) {}

build/firmware.bin

6 KB
Binary file not shown.

build/firmware.elf

32.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)