Skip to content

Commit e2f0256

Browse files
committed
Compile mp13x (WIP)
1 parent 565339a commit e2f0256

File tree

23 files changed

+549
-480
lines changed

23 files changed

+549
-480
lines changed

Makefile

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ EXTLIBDIR = third-party
99

1010
ifeq ($(SERIES),stm32mp13x)
1111
LINKSCR := linkscript-mp13x.ld
12+
SERIESDIR := ${SRCDIR}/drivers/mp13x
13+
HALDIR := $(EXTLIBDIR)/STM32MP13x_HAL_Driver
1214
else
1315
LINKSCR := linkscript.ld
16+
SERIESDIR := ${SRCDIR}/drivers/mp15x
17+
HALDIR := $(EXTLIBDIR)/STM32MP1xx_HAL_Driver
1418
endif
1519

1620
SD_DISK_STEM ?= /dev/disk4s
1721

1822
SOURCES = $(SRCDIR)/startup.s \
1923
$(SRCDIR)/main.cc \
20-
$(SRCDIR)/systeminit.c \
2124
$(SRCDIR)/libc_stub.c \
2225
$(SRCDIR)/libcpp_stub.cc \
2326
$(SRCDIR)/print.cc \
@@ -26,7 +29,13 @@ SOURCES = $(SRCDIR)/startup.s \
2629
$(SRCDIR)/uboot-port/lib/crc32.c \
2730
$(SRCDIR)/drivers/norflash/qspi_ll.c \
2831
$(SRCDIR)/drivers/norflash/qspi_norflash_read.c \
29-
$(SRCDIR)/gpt/gpt.cc
32+
$(SRCDIR)/gpt/gpt.cc \
33+
$(SERIESDIR)/systeminit.c \
34+
$(HALDIR)/Src/stm32mp1xx_ll_usart.c \
35+
$(HALDIR)/Src/stm32mp1xx_ll_rcc.c \
36+
$(HALDIR)/Src/stm32mp1xx_hal.c \
37+
$(HALDIR)/Src/stm32mp1xx_ll_sdmmc.c \
38+
$(HALDIR)/Src/stm32mp1xx_hal_sd.c \
3039

3140

3241
INCLUDES = -I. \
@@ -35,48 +44,29 @@ INCLUDES = -I. \
3544
-I$(EXTLIBDIR)/CMSIS/Core_A/Include \
3645
-I$(SRCDIR)/uboot-port/include \
3746
-I$(SRCDIR)/uboot-port/arch/arm/include \
47+
-I$(SERIESDIR) \
48+
-I$(HALDIR)/Inc \
49+
-I$(EXTLIBDIR)/CMSIS/Device/ST/STM32MP1xx/Include
3850

3951
ifeq ($(SERIES),stm32mp13x)
40-
SOURCES += \
41-
$(EXTLIBDIR)/STM32MP13xx_HAL_Driver/Src/stm32mp13xx_ll_usart.c \
42-
$(EXTLIBDIR)/STM32MP13xx_HAL_Driver/Src/stm32mp13xx_ll_rcc.c \
43-
$(EXTLIBDIR)/STM32MP13xx_HAL_Driver/Src/stm32mp13xx_hal.c \
44-
$(EXTLIBDIR)/STM32MP13xx_HAL_Driver/Src/stm32mp13xx_ll_sdmmc.c \
45-
$(EXTLIBDIR)/STM32MP13xx_HAL_Driver/Src/stm32mp13xx_hal_sd.c \
46-
$(EXTLIBDIR)/STM32MP13xx_HAL_Driver/Src/stm32mp13xx_hal_ddr.c
47-
48-
INCLUDES += \
49-
-I$(EXTLIBDIR)/STM32MP13xx_HAL_Driver/Inc \
50-
-I$(EXTLIBDIR)/CMSIS/Device/ST/STM32MP1xx/Include \
51-
-I$(SRCDIR)/drivers/mp13x/
52+
SOURCES += $(HALDIR)/Src/stm32mp13xx_hal_ddr.c
53+
5254
else
53-
SOURCES += \
54-
$(EXTLIBDIR)/STM32MP1xx_HAL_Driver/Src/stm32mp1xx_ll_usart.c \
55-
$(EXTLIBDIR)/STM32MP1xx_HAL_Driver/Src/stm32mp1xx_ll_rcc.c \
56-
$(EXTLIBDIR)/STM32MP1xx_HAL_Driver/Src/stm32mp1xx_hal.c \
57-
$(EXTLIBDIR)/STM32MP1xx_HAL_Driver/Src/stm32mp1xx_ll_sdmmc.c \
58-
$(EXTLIBDIR)/STM32MP1xx_HAL_Driver/Src/stm32mp1xx_hal_sd.c \
59-
$(SRCDIR)/drivers/mp15x/drivers/ddr/stm32mp1_ddr.cc \
60-
$(SRCDIR)/drivers/mp15x/drivers/ddr/stm32mp1_ram.cc
61-
62-
INCLUDES += \
63-
-I$(EXTLIBDIR)/STM32MP1xx_HAL_Driver/Inc \
64-
-I$(EXTLIBDIR)/CMSIS/Device/ST/STM32MP1xx/Include \
65-
-I$(SRCDIR)/drivers/mp15x/
55+
SOURCES += $(SRCDIR)/drivers/mp15x/drivers/ddr/stm32mp1_ddr.cc \
56+
$(SRCDIR)/drivers/mp15x/drivers/ddr/stm32mp1_ram.cc
6657
endif
6758

6859

6960
MCU = -mcpu=cortex-a7 -march=armv7ve -mfpu=neon-vfpv4 -mlittle-endian -mfloat-abi=hard
7061

7162

7263
ARCH_CFLAGS = -DUSE_FULL_LL_DRIVER \
73-
-DSTM32MP1 \
7464
-DCORE_CA7
7565

7666
ifeq ($(SERIES),stm32mp13x)
77-
ARCH_CFLAGS += -DSTM32MP135Dxx
67+
ARCH_CFLAGS += -DSTM32MP135Dxx -DSTM32MP13
7868
else
79-
ARCH_CFLAGS += -DSTM32MP157Cxx
69+
ARCH_CFLAGS += -DSTM32MP157Cxx -DSTM32MP1
8070
endif
8171

8272
ifeq ("$(BOARD_CONF)","OSD32")

src/drivers/i2c.hh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "drivers/i2c_conf.hh"
33
#include "drivers/pinconf.hh"
44
#include "drivers/rcc.hh"
5-
#include "stm32mp1xx.h"
5+
#include "drivers/stm32mpxxx.h"
66
#include <optional>
77
#include <span>
88

@@ -131,10 +131,7 @@ public:
131131
return true;
132132
}
133133

134-
bool is_init()
135-
{
136-
return _is_init;
137-
}
134+
bool is_init() { return _is_init; }
138135

139136
private:
140137
// Writes the register address, without generating a stop

src/drivers/leds.hh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
2+
#include "drivers/stm32mpxxx.h"
23
#include "pinconf.hh"
3-
#include "stm32mp1xx.h"
4-
#include "stm32mp1xx_ll_gpio.h"
54

65
enum class LedActive { Low, High };
76

@@ -19,10 +18,7 @@ public:
1918
constexpr static uint16_t pin_mask = static_cast<uint16_t>(PINMASK);
2019
constexpr static uint32_t pin_num = PinConf::bit_to_num(PINMASK);
2120

22-
Led()
23-
{
24-
PinConf{GPIOx, PINMASK, PinAF::AFNone}.init(PinMode::Output);
25-
}
21+
Led() { PinConf{GPIOx, PINMASK, PinAF::AFNone}.init(PinMode::Output); }
2622

2723
void on()
2824
{

src/drivers/mp13x/drivers/rcc.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
// #include "drivers/rcc_common.hh"
33
#include "drivers/register_access.hh"
4-
#include "stm32mp1xx.h"
4+
#include "drivers/stm32mpxxx.h"
55
#include <cstddef>
66
#include <variant>
77

0 commit comments

Comments
 (0)