[LPC1778] uClinux 2.6.xx port

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
TP1
Posts: 4
Joined: Tue May 22, 2018 11:36 am

[LPC1778] uClinux 2.6.xx port

Post by TP1 » Tue May 22, 2018 2:42 pm

Hi everyone,

I'm currently evaluating custom NXP LPC1778 board (Cortex M3 120MHz, 32MB SDRAM) for our next project.
I've successfully ported U-boot, uClinux kernel 2.6.33 and some of my existing POSIX code and everything works great. I've used Emcraft 1778BSP as reference. The toolchain is arm-uclinuxeabi-gcc.

My next step is to port MicroPython. I'm using Unix port as starting point. I'm trying to make Unix micropython-minimal build.

Currently my build fails with message:
arm-uclinuxeabi-strip: micropython_minimal: File format not recognized

Does anyone have any idea what would cause this error?

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

Re: [LPC1778] uClinux 2.6.xx port

Post by dhylands » Tue May 22, 2018 7:46 pm

strip requires an ELF file. You can use the 'file' command under linux to determine the type of a file. My guess is that you're looking at a binary data file and not the .elf file.

TP1
Posts: 4
Joined: Tue May 22, 2018 11:36 am

Re: [LPC1778] uClinux 2.6.xx port

Post by TP1 » Wed May 23, 2018 8:57 am

Hi,
I't looks like I need to learn a bit more about makefile and build process.

I've compared build output files from my other app with MicroPython output and it looks almost the same.
After running make on my other app I get two files (app.gdb and app)

>> file app.gdb
ELF-32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped

>> file app
BFLT executable - version 4 ram

MicroPython build failed on strip command but .gdb file is created

>> file micropython_minimal.gdb
ELF-32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped

Is .gdb file strip input file?

'readelf -h' output is similar (only difference in size fields)

Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x5
Start of program headers: 52 (bytes into file)
Start of section headers: 1652156 (bytes into file)
Flags: 0x5000002, has entry point, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 3
Size of section headers: 40 (bytes)
Number of section headers: 28
Section header string table index: 25

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

Re: [LPC1778] uClinux 2.6.xx port

Post by dhylands » Wed May 23, 2018 2:45 pm

Yeah. It looks like the micropython_minimal.gdb file is the one you want to strip.

TP1
Posts: 4
Joined: Tue May 22, 2018 11:36 am

Re: [LPC1778] uClinux 2.6.xx port

Post by TP1 » Thu May 24, 2018 10:42 pm

I haven't had any success compiling and running MicroPython.
I tried two different approaches:

1) I tried manually running strip command. After that, I played with ld, ld.real and elf2flt commands to produce valid BFLAT executable.
Stripping was easy, but I had problems with 'Input file contains no relocation info' errors.

2) I went back to makefile, found that I can generate BFLAT executable if I skip strip step. I tried running on uclinux but SEGV error pops out.

TP1
Posts: 4
Joined: Tue May 22, 2018 11:36 am

Re: [LPC1778] uClinux 2.6.xx port

Post by TP1 » Mon May 28, 2018 7:55 am

Python is up and running.

After I made some changes to CFLAGS and LDFLAFS I got "Invalid ISA state" error.
I've linked micropython with wrong library.

Post Reply