Standalone version for ARM-CortexM7

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
ylg
Posts: 3
Joined: Tue Feb 14, 2017 1:17 pm

Standalone version for ARM-CortexM7

Post by ylg » Tue Feb 14, 2017 1:28 pm

Hi, i've recently started to work on a STM32F746G discovery board (with Cortex-M7)

I ran the make file in the /micropython/stmhal/ fodler, and as it instructed, it outputs firmware files in the directory build-STM32F7DISC:
- firmware.hex
- firmware.dfu

Because i'm running my linux distribution on this board, i just want to run python scripts like this:
python_standalone myscript.py

my question is (and I searched the readme files and didn't find any info on this) how can i use micropython without having to replace the firmware on the board, and just copy the standalone binary?
I saw that the unix version (/micropython/unix/) does support this and outputs micropython binary, but i wasn't able to compile it with the STM32F746G 's cross compiler.


Thanks.
Yuval.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Standalone version for ARM-CortexM7

Post by dhylands » Tue Feb 14, 2017 5:14 pm

If you build MicroPython using the BOARD=STM32F7DISC then it's going to build a standalone image, where it assumes that its the only SW on the board.

I suspect that you're running uclinux and not really linux. We don't currently have any targets for uclinux. Just regular linux (in which case you'd use the unix build, not the stmhal build).

ylg
Posts: 3
Joined: Tue Feb 14, 2017 1:17 pm

Re: Standalone version for ARM-CortexM7

Post by ylg » Wed Feb 15, 2017 9:48 am

Thanks for the clear answer,
First I want to apologize that i posted in the wrong forum, after viewing more of the site i realized that i should been posted it in 'Other Boards' forum.

Now i understand that the unix build is what i need.
You are right that i'n running uclinux, as I said, iv'e tried to compile it with my board's toolchain arm-uclinuxeabi-gcc with no luck.
I assume that most of the failures was due to old gcc version of my toolchain.
I found this post from a guy that managed to do what i want so I tried the same with the micro-python version that he tried on (v1.1.1):
viewtopic.php?t=270

At first it hasn't gone well as he described, i did some optimization in the code in places where my compiler failed (due to gcc bugs) and modified the Makefile, at last iv'e managed to compile and run it on my board :D .

Thanks
Yuval

SpotlightKid
Posts: 463
Joined: Wed Apr 08, 2015 5:19 am

Re: Standalone version for ARM-CortexM7

Post by SpotlightKid » Sun Feb 19, 2017 2:11 pm

Sounds useful for others as well. Do you have a forked repo with your changes? Will you try to compile the latest version as well?

ylg
Posts: 3
Joined: Tue Feb 14, 2017 1:17 pm

Re: Standalone version for ARM-CortexM7

Post by ylg » Thu Feb 23, 2017 3:05 pm

Of course i will fork the repo as soon as i will make the code stable.

I'm still struggling with few issues that prevent me from working with the version:
When I'm executing the interpreter it works fine but when i try to interpret a given file i got this error:

Code: Select all

/home/root # ./micropython /home/root/testpy.py
./micropython: can't open file '/home/root/testpy.py': [Errno 0] Success
for some reason it can't open the file (it has execution permissions).
I hope this is not because of the non-MMU ucLinux property that it can't map memory to a file or something like that,
is anyone has an idea why i see this error?

I also managed to compile the latest micropython version for my platform, but it fails to execute with the following error that i assume has something to do with the lack of MMU in the system:

Code: Select all

/home/root # ./micropython_latest 
micropython_lat: page allocation failure. order:9, mode:0xd0
Backtrace: invalid frame pointer 0x00000040
Mem-info:
Normal per-cpu:
CPU    0: hi:    0, btch:   1 usd:   0
active_anon:0 inactive_anon:0 isolated_anon:0
 active_file:0 inactive_file:0 isolated_file:0
 unevictable:187 dirty:0 writeback:0 unstable:0
 free:540 slab_reclaimable:29 slab_unreclaimable:286
 mapped:0 shmem:0 pagetables:0 bounce:0
Normal free:2160kB min:360kB low:448kB high:540kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:748kB isolated(anon):0kB isolated(file):0ko
lowmem_reserve[]: 0 0
Normal: 16*4kB 8*8kB 9*16kB 7*32kB 2*64kB 0*128kB 0*256kB 1*512kB 1*1024kB 0*2048kB 0*4096kB 0*8192kB = 2160kB
187 total pagecache pages
2048 pages of RAM
555 free pages
573 reserved pages
315 slab pages
138 pages shared
0 pages swap cached
Allocation of length 1052672 from process 38 (micropython_lat) failed
Normal per-cpu:
CPU    0: hi:    0, btch:   1 usd:   0
active_anon:0 inactive_anon:0 isolated_anon:0
 active_file:0 inactive_file:0 isolated_file:0
 unevictable:187 dirty:0 writeback:0 unstable:0
 free:540 slab_reclaimable:29 slab_unreclaimable:286
 mapped:0 shmem:0 pagetables:0 bounce:0
Normal free:2160kB min:360kB low:448kB high:540kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:748kB isolated(anon):0kB isolated(file):0ko
lowmem_reserve[]: 0 0
Normal: 16*4kB 8*8kB 9*16kB 7*32kB 2*64kB 0*128kB 0*256kB 1*512kB 1*1024kB 0*2048kB 0*4096kB 0*8192kB = 2160kB
187 total pagecache pages
SEGV

Post Reply