Skip to content

Introduce micropython port to LPC Cortex-M series microcontrollers #3333

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

Closed

Conversation

ezequielgarcia
Copy link

@ezequielgarcia ezequielgarcia commented Sep 27, 2017

Micropython for LPC NXP

This patchset adds very basic support for LPC NXP ARM Cortex-M microcontrollers. The port is based on LPCOpen libraries, and so all the peripherals should supported. For now, we don't expose any of them and instead just add the minimal stuff to get micropython console working.

The port is meant to allow support for any LPC chip and any board. It is structured as:
.
├── boards
│   ├── lpc_board_ciaa_edu_4337
│   └── ... more boards
└── chips
   ├── lpc_chip_43xx
   └── lpc_chip_5410x

A second try

This PR is a new try at getting the port merged. A previous try was done at #1732 but it was not merged. @martinribelotta and I have been working on this new attempt, trying to make it generic enough so the code can easily support other boards and other LPC variants.

For now we have only added support the EDU CIAA board. We would like to get the basic support merged, and then we plan to add a few other boards including LPC43xx and LPC5410 (E.g. Pico CIAA and Hitex LPC4350 development kit are planned).

About the CIAA

The CIAA (Open Argentine Industrial Computer) Project is a group initiative between the academic and the industrial sector. The EDU CIAA board is an educational board used in high-schools and universities.

@martinribelotta has developed an IDE for micropython: https://github.com/martinribelotta/uPyIDE, which is fairly popular in the local community.

ezequielgarcia and others added 6 commits September 26, 2017 11:24
LPCOpen library for LPC18xx/43xx v3.01.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
LPCOpen library for LPC5410x v3.03.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Let's make the bloody compiler happy. This commit fixes -Werror errors
throwed by the compiler on LPCOpen library. We want to keep this commit
separate from the initial LPCOpen library drop, to allow this commit to
be cherry-picked and make library bumps easier.

Signed-off-by: Martin Ribelotta <martinribelotta@gmail.com>
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
This commit introduces a new function NVIC_ClearAll, which
will be used by the reset vector handler to clear all the interrupts.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
This commit introduces a new LPCOpen API "Chip_RGU_TriggerResetAll",
which will be used by the reset vector handler to reset
all peripheral blocks.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
First board introduced is EDU CIAA LPC4337 (educational board),
using LPCOpen library for LPC18xx/43xx v3.01.

This first commit should introduce some infrastructure for
other boards to be easily supported. For now, let's just
enable a very simple REPL.

Signed-off-by: Ernesto Gigliotti <ernestogigliotti@gmail.com>
Signed-off-by: Martin Ribelotta <martinribelotta@gmail.com>
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
@RockySong
Copy link

RockySong commented Sep 29, 2017

Hi Ezequielgarcia,

This is Rocky Song from NXP, principal System&Apps engineer of MICR (microcontroller & microprocessor) Business Line, I work in NXP Beijing site, China.

Many thanks for your interests and contribution to micropython on LPC!

I also worked on micropython port to NXP MCU in recent 2 months, and I ported micropy to LPC54608 using SDK by cloning the "STMHAL" (now STM32) port, I've added basic modules including USB, LED, I also created a KEIL project (using ARM CC toolchain), user can develop in the similar mannar as offical pyboard based on STM32F405.

SDK will be the official supporting package for recent and new NXP MCUs, including LPC5411x, LPC546xx, and LPC5410x is coming, as well as Kinetis and i.MX RT parts, and have a consistent API set among all its supported parts, unfortunately, SDK is not available for legacy parts, such as LPC17xx/40xx, LPC18xx/43xx.

If you'd like to work on porting micropython to NXP MCUs, I hope I can work together with you. My first stage plan is porting the functionalities of pyboard to all proper NXP MCUs (in particular, the flash size or parts that has no flash) using SDK for current primary NXP parts and coming parts; later, I plan to add some application level enablement that can leverage NXP MCU's strong points, rather than wrappers of calling peripheral directly.

Because github is slow in my place and I'm not familiar with github, I so far haven't put the code to github, and I'll do it soon. Currently my code is put to https://bitbucket.org/RockySong/mpy_lpx546

Hope to get your comments.

@ezequielgarcia
Copy link
Author

@RockySong Nice! I think you should open a ticket and ask the micropy maintainers for some guidance. Perhaps you could open an issue to track the discussion. In any case, discussion should continue here, as it's not the right place to discuss your port.

@dpgeorge
Copy link
Member

dpgeorge commented Oct 3, 2017

@ezequielgarcia nice to see that you are persisting with getting the LPC supported.

As you might have noticed, recently there was an effort to clean up the ports and reduce their size. In particular the stmhal port was renamed to stm32 and its HAL libraries moved to a git submodule (see lib/stm32lib).

Following along those lines, I wouldn't want to merge 72k lines of code for an LPC port, especially when most of them are external HAL files. So please find a way to separate these out. If you are not currently using them then don't include them in this PR.

Also, why don't you reuse the cmsis files in lib/cmsis?

@martinribelotta
Copy link

@dpgeorge @ezequielgarcia Hi both, I'm working on it
Hi @RockySong I'm interesting in merge your project in the branch of @ezequielgarcia because the last contains structure more near to mainstream. What are the future plans for your work?

tannewt pushed a commit to tannewt/circuitpython that referenced this pull request Aug 27, 2020
Fix all assignments affected by inline makefile comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants