-
Notifications
You must be signed in to change notification settings - Fork 1k
[New variant] STM32MP157_DK #717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I have a question regarding developing Virtual Serial feature. I looked at how USB libraries are compiled since OpenAMP is a middleware library like STM32_USB libraries. As far as I understand it seems that Arduino IDE does not really compile the source files from /system/Middlewares/ST but the source files under /cores/arduino/stm32/usb. Is my understanding correct? Then are files under /system/Middlewares/ST just for references or for placeholders of header files? Should I copy necessary files from /system/Middlewares/OpenAMP to a new directory in /cores/arduino/stm32? |
In fact Arduino compile only source files found in And this allow to update easily the middleware that's why we avoid copy |
Oh I see. That's why some of the compiler -I flags points to the source directory of the middleware. Thanks! |
exactly 😉 |
241510d
to
b7d9ae3
Compare
#605 has been merged. |
@fpistm Thanks, I rebased the branch to offer a less messy code view. |
@kbumsik |
@fpistm diff --git a/src/genpinmap/genpinmap_arduino.py b/src/genpinmap/genpinmap_arduino.py
index 645b1a8d..5fff18ae 100644
--- a/src/genpinmap/genpinmap_arduino.py
+++ b/src/genpinmap/genpinmap_arduino.py
@@ -851,6 +851,9 @@ def clean_all_lists():
def parse_pins():
print(" * Getting pins per Ips...")
pinregex = r"^(P[A-Z][0-9][0-5]?)"
+ # STM32MP1 has additional pin definitions such as ANA1 for ADC
+ if "STM32MP1" in mcu_file:
+ pinregex = r"^(P[A-Z][0-9][0-5]?|ANA[0-9])"
itemlist = xml_mcu.getElementsByTagName("Pin")
for s in itemlist:
m = re.match(pinregex, s.attributes["Name"].value)
@@ -859,7 +862,11 @@ def parse_pins():
m.group(0)[:2] + "_" + m.group(0)[2:]
) # pin formatted P<port>_<number>: PF_O
name = s.attributes["Name"].value.strip() # full name: "PF0 / OSC_IN"
- if s.attributes["Type"].value == "I/O":
+ pin_type = s.attributes["Type"].value
+ if pin_type == "I/O":
+ store_pin(pin, name)
+ elif "STM32MP1" in mcu_file and "ANA" in name and pin_type == "MonoIO":
+ pin = "ANA" + "_" + name[3:] # ANA1 will be ANA_1
store_pin(pin, name)
else:
continue
@@ -890,6 +897,11 @@ def parse_pins():
store_usb(pin, name, sig)
if sig.startswith("SD"):
store_sd(pin, name, sig)
+ if re.match("STM32MP1", mcu_file):
+ # In STM32MP1, SYS_WKUP is renamed as PWR_WKUP
+ if "PWR_" in sig:
+ sig = sig.replace("PWR_", "SYS_")
+ store_sys(pin, name, sig)
# main You can ignore the changeset related PWR_WKUP. |
Thanks @kbumsik |
Some remark about README:
Good work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kbumsik
This is really a great work. 👍
I've some changes to request.
I've a rebased version of your PR with all my fixes:
https://github.com/fpistm/Arduino_Core_STM32/tree/PR-717-Review
@kbumsik If you agreed this should be fine you update this PR with this one. |
@fpistm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fpistm Sure. Done :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Still to made some tests before merge and validate stm32duino/Arduino_Tools#47
Hi @kbumsik
|
Touching pins outside of these range may cause kernel panic in Linux side.
@fpistm Cool, I squashed the fixup commits. Thanks for great reviewing! |
stm32duino/Arduino_Tools#47 merged |
@arnopo FYI |
FYI, STMicro has updated their STM32MP1 Family with models that have faster 800 MHz Cortex-A7 Processors, through the Cortex-M4 core still runs at same 209 MHz speed as previous models. https://blog.st.com/mpu-stm32mp1/ https://newsroom.st.com/media-center/press-item.html/p4236.html |
More STM32MP1 boards (and SoM modules) are now available:STM32MP157A-EV1 Evaluation kit with breakout board and STM32MP115X-EVAL evaluation board https://www.st.com/en/evaluation-tools/stm32mp157a-ev1.html STM32MP157C-EV1 Evaluation kit with breakout board and STM32MP115X-EVAL evaluation board https://www.st.com/en/evaluation-tools/stm32mp157c-ev1.html Seeed Studio ODYSSEY-STM32MP157C SBC based on Seeed Studio SoM-STM32MP157C SoM Emtrion emSBC-Argon https://www.cnx-software.com/2019/07/18/emtrion-emsbc-argon-stm32mp1-dual-cortex-a7-m4-processor/ i2Som PanGu board from I2Som: https://www.cnx-software.com/2019/06/25/pangu-board-stm32mp1-sbc/ MYIR MYD-YA157C development board based on their MYiR MYC-YA157C STM32MP1 CPU Module Avenger96 96Boards CE Extended Board Features an STMicro STM32MP1 SoM https://www.cnx-software.com/2019/02/23/avenger96-96boards-stmicro-stm32mp1-som/ Shiratech Stinger96 board (96Boards board design) Direct Insight / Ka-Ro STM32MP1 QSMP 1570 / 157C SoM module and development kit with thier reference devboard/devkit: |
Depends:
Required by: #766
This PR is to add STM32MP157 discovery boards (both DK1 and DK2).
Since MP1 boards are quite different from other board I explain things to consider to review this PR.
For convenience to test, this PR has commits from #605. You can review commits from 83bc63f.Rebased.Great reference to read: STM32CubeMP1 development guidelines
You can see the variant's README to learn how to use it. Please ask me if you have any questions about the PR, I will modify the commits if needed.
Engineering mode vs Production mode
The M4 coprocessor of STM32MP1 has two operating modes: Engineering mode and Production mode (or normal mode). Engineering mode is for debugging the M4 while disabling the Linux A7 core. In this mode you can use ST-Link to upload and debug the M4, but the M4 doesn't have a flash memory: the firmware will disappear in the next boot. To avoid the confusion to the users I focus on Production mode only and made a necessary tools for Production mode. The new
run_arduino_gen.sh
tool is explained in Arduino-Tools#47.In the Production mode, the core clock configuration is done by the Linux/U-Boot host so we need simply ignore related functions like
SystemClock_Config()
. The newIS_ENGINEERING_BOOT_MODE()
from HAL is used to detect the Production mode.https://github.com/kbumsik/Arduino_Core_STM32/blob/aebcddff59375b4ac53134babc61dd655b028414/variants/STM32MP157_DK/variant.cpp#L147-L149
lock_resources.h
andlock_resources.c
Because GPIO ports are shared with the Linux host, a locking mechanism is needed to avoid race conditions. I copied the source directly from the Cube library: 28898e3
GPIOZ and ANA_1:2
The new GPIOZ and ANA_x pins are added. GPIOZ is not special but I modified port/pin definitions since that name was used to indicate the end of GPIO names. The new ANA_1/ANA_2 pins are something like PADC_TEMP but they are physically exposed pins. We don't need to GPIO control for ANA_1/ANA_2 because they are always directly connected to the ADC channels: 442ca6c
pseudo-EEPROM using RETRAM
The M4 core does not have flash. Instead we can use RETRAM to emulate EEPROM library. It have some important limitations that data is not preserved between reboots. The limitations section of the variant's README and 136cf8f#diff-21d65ef266789f937660e766b5fa188aR49 explains the properties and the limitations of RETRAM.
The complete
HAL_RCCEx_GetPeriphCLKFreq()
STM32MP1xx's
HAL_RCCEx_GetPeriphCLKFreq()
now is able to return almost all ptheripheral's clock frequencies. So I tried to make use of this functions as much as I can instead of manually calculate the clock frequencies.Communication with the main processor
There is no easy way to communicate with the host Linux. The limitations section of the variant's README explains such limitation. I'm working on virtual serial communication using OpenAMP rpmsg framework, but it turns out to be another big change. So I will make a separate PR for virtualIO communication.
This change is