Preliminary pyboard port to NXP MCUs ---- how to add to micropython repository

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
RockySong
Posts: 4
Joined: Mon Oct 02, 2017 1:55 am

Preliminary pyboard port to NXP MCUs ---- how to add to micropython repository

Post by RockySong » Mon Oct 02, 2017 2:00 am

Dear micropython experts,

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

I preliminarily ported pyboard to LPC54608 using SDK by cloning the "STMHAL" (now STM32) port, I've added basic modules including USB VCP and MSC, LED, I also created a KEIL project (using ARM CC toolchain) for easy learning and debugging.

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, currently my code is put to https://bitbucket.org/RockySong/mpy_lpx546

Hope to get your comments on how to migrate the code to micropython git hub,I‘ve read contribution guidlines however I don't get clear method

Best regards
Rocky Song

Dave_Abq
Posts: 6
Joined: Wed Jul 19, 2017 10:42 pm

Re: Preliminary pyboard port to NXP MCUs ---- how to add to micropython repository

Post by Dave_Abq » Wed Oct 04, 2017 12:01 am

Rocky Song
I am interested in your project and would like to help, I am also a beginner. I have cloned your bitbucket repository to GitHub at

https://github.com/dave-abq/mpy_lpx546

Let me know if it looks satisfactory.

Give me a way to contact you via direct email, and I can arrange to add you to a team on this repository. I would like to work with you to get your files into the format for a pull request to the main Micropython repository, but I am also new to that process.

Dave

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: Preliminary pyboard port to NXP MCUs ---- how to add to micropython repository

Post by stijn » Wed Oct 04, 2017 10:36 am

This might not be very easy becasue there's no link to github anymore because you just copied all files, then started working in Bitbucket. To make things worse this was before the recent change where all ports are moved to the port directory. But it should be doable:
- figure out from which commit in the official github repository you copied the files
- fork the repo on github, clone it into new directory
- copy everything you currently have into that directory, overwriting files as needed
- build to make sure that works, else adjsut code
- make one or more commits in which you add the port
- rebase your latest commit on top of latest master
- solve conflicts if any
- move your directory into the ports/ directory
- fix build, commit
- rebase/squash commits if needed
- push, create pull request

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Preliminary pyboard port to NXP MCUs ---- how to add to micropython repository

Post by pythoncoder » Wed Oct 04, 2017 3:05 pm

I thought programming was difficult until I discovered Git :shock:
Peter Hinch
Index to my micropython libraries.

Dave_Abq
Posts: 6
Joined: Wed Jul 19, 2017 10:42 pm

Re: Preliminary pyboard port to NXP MCUs ---- how to add to micropython repository

Post by Dave_Abq » Wed Oct 04, 2017 6:35 pm

Rocky
I worked for a while with my colleague here, and we agree with stijn. He outlines a good path to bring your code into mainstream Micropython.

From what we were able to tell, your Bitbucket original commit differed substantially from any versions of the main GitHub Micropython repository that we compared to... and we went back a quite a few commits from 14 August 2017 and earlier, just before your 15 August original commit on Bitbucket. Do you have access to the original fork from Github that your work comes from?

Painful as it sounds, if you do not have that access, one path might be to start from a recent Micropython clone and redo your NPX-specific changes in the new context.

Would you like me to clone the latest, or some other (earlier), Github repository, into a Bitbucket Repository? I could be a bit of a bridge for you, if that helps with any of your access challenges. You could work in Bitbucket until the time comes to merge into the Micropython repository.

I look forward to your progress and perhaps collaborating with you on this. Please do contact me for offline discussion if that is helpful.
Dave

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: Preliminary pyboard port to NXP MCUs ---- how to add to micropython repository

Post by stijn » Wed Oct 04, 2017 6:59 pm

Yes but after you push through with the initial learning curve it's a joy to work with. Well and after that there's still more learning curve (reflog etc.) but I even never went there as I never seem to need those features.

RockySong
Posts: 4
Joined: Mon Oct 02, 2017 1:55 am

Re: Preliminary pyboard port to NXP MCUs ---- how to add to micropython repository

Post by RockySong » Fri Oct 06, 2017 1:10 pm

Hi Dave,

Many thanks for your interest! My working mail is "rocky.song@nxp.com", my WeChat ID is "RockyJoyin", I do hope to work in a team! Should you meet errors in building under KEIL please let me know.
I started my porting on micropython release v1.9.1, and cloned many files from the STMHAL port.
During creating KEIL project for ARMCCv5, I changed some code of mpy that is bound to GCC (most of which are inline asm, header, and compiler extensions), so they can build under KEIL, it could be a reason why it does not like any mpy revision.

My next close plan is implementing/refractoring modules for UART, I2C, SPI for LPC546xx with NXP SDK, hopely to be done within Oct. Meanwhile, I'll adjust makefile to ensure it builds under GCC (currently I only ensure make can pass the generated header stage:)).
Besides LPC546xx, I also plan to do serious mpy enablement on the new NXP i.MX RT1050 crossover processor, which is a dramatic powerful 600MHz Cortex-M7 with many resources, and has <3USD @ 10kpcs, I hope to let mpy to finally become a serious platform for MCU application development.

@stijn,
Many thanks fo your guidelines, it does not look like trival work and I plan to do that after I complete UART, I2C and SPI modules than do the migration seriously, it will be grateful if you or someone else can help me on migration.

I'm in public holiday until Oct. 8 with some family affairs occupying me, I'll update soon.

Best regards
Rocky Song

Post Reply