A Hempl-like hack to emulate GNU/Linux on Cortex-M

classic Classic list List threaded Threaded
3 messages Options
raman raman
Reply | Threaded
Open this post in threaded view
|

A Hempl-like hack to emulate GNU/Linux on Cortex-M


Dear eLua community, greetings!

I trust you are all doing well. I am now writing to you about another
hack that works because of eLua's language and target agnostic
software interface. Hempl [1], eLua's PicoLisp incarnation was simple
to write because of exactly the same philosophy.

I worked with 2 students to get Dmitry Grinberg's uARM ARMv5 emulator
[2] (modified of course) working on the Infineon XMC4500-E144x1024
(comes with an 8MB external SDRAM interface). From there, we were able
to get the PXA-255 build of Ubuntu GNU/Linux running on the Cortex-M4
- like Dmitry's work for one of the 8-bit micro-controllers from
Atmel.

We started off with Hempl (which was derived from eLua) and removed
all PicoLisp specific elements from it. We then inserted `uarm' as a
command (instead of `lua' in eLua's case OR `picolisp' in Hempl's
case) in the eLua shell and cross-compiled *regular* desktop `uARM'
for the XMC4500. Parts of the desktop uARM code which used termios/
signal handling routines had to be removed.

The XMC4500 has an external bus unit. Once, we had all the code in
place, all we had to do was to tell the memory allocator about the 8MB
external SDRAM. (some configuration for eLua's MEM_START_ADDRESS and
MEM_END_ADDRESS). malloc was then able to allocate in both the
internal SRAM banks and also within the realm of the external SDRAM.

The FATFS sub-system was then able to pick up a PXA-255 Jaunty
Jakalope from /mmc and run the build. It takes about 13 minutes to
boot into GNU bash. :) The MCU was configured to run at its default
clock of 120MHz. The code for now runs as an Infineon DAVE project.
Mounika is maintaining the source code [3].

It started off as a proof-of-concept but this might add more credence
to Dado's and Bogdan's idea (from a discussion many years ago in the
mailing list) of splitting eLua into two parts - a part with the Lua
extensions for MCUs and another part with eLua's language-agnostic
platform interface.

Many thanks eLua! Good day!

R

P.S. I initially tried this on the Mizar32. It comes with a gracious
32MB external SDRAM. I ran into some memory alignment issues which I
couldn't fix without a debugger.

References:
[1]: https://github.com/simplemachines-italy/hempl
[2]: http://dmitry.gr/index.php?r=05.Projects&proj=07.%20Linux%20on%208bit
[3]: https://github.com/mounikamunipalli/uarm_xmc
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: A Hempl-like hack to emulate GNU/Linux on Cortex-M

That sounds awesome! However, this thread is worthless without pics! Or, better yet, videos!
raman raman
Reply | Threaded
Open this post in threaded view
|

Re: A Hempl-like hack to emulate GNU/Linux on Cortex-M


Dear Bogdan, greetings!

> That sounds awesome!

:) Sure Bogdan. The students and I had a lot of fun with the code.

> However, this thread is worthless without pics! Or, better yet,
> videos!

Certainly; Mounika took a few snaps for her school work. I am
attaching them now. :)

R

P.S. I was thinking: How would it be if I connected the Mizar32's
Propeller extension board with the XMC4500 and route all serial
communication to a VGA screen. I badly want to do it! :)