cancel
Showing results for 
Search instead for 
Did you mean: 

uCLinux on STM32F429I-DISCO

tmkaran
Associate II
Posted on November 13, 2013 at 10:54

Hi everybody,

I was very happy to see uCLinux port for Cortex-M4 and my favorite MCU STM32. This well done job was achieved by emcraft. So I wonder that is it possible to run uCLinux on my new toy STM32F429I-DISCO? I have started for it and some u-boot and kernel patching I finished my first job. You must known that code execution from SDRAM on STM32F4 much slower than from FLASH (~6x times slower). So in fact this core is not suitable code execution from SDRAM. But maybe you don't have any chance so you can accept this penalty. 

Than I modified the kernel to load romfs from flash, simple frame buffer driver, u-boot patching for SDRAM and LCD init functions. You can try and decide for yourself. This is boot-up and simple framebuffer demo video. 

http://youtu.be/avbnkhvZrVo

Emcraft original source git is https://github.com/EmcraftSystems (not including STM32F429I-DISCO board drivers)

Sample image attached to the post. This image contains u-boot, kernel and romfs. 

The serial console is USART3 and PC10->MCU TX, PC11->MCU RX. Don't forget that this interface has TTL levels.

#usart #stm32-uclinux-u-boot #usb-driver-p19-stm324f
65 REPLIES 65
tmkaran
Associate II
Posted on December 07, 2013 at 16:06

Hi guys,

uCLinux, u-boot source and romfs binary is ready on

https://github.com/robutest

. Needed toolchain can be downloaded from emraft web site. Don't forget that u-boot must be flashed on 0x08000000, kernel must be flashed 0x08020000 and romfs must be flashed 0x08120000 address. If you want change these address, some jobs are waiting for you.

Henry Dang
Associate II
Posted on December 09, 2013 at 07:13

Hi TMK,

When compilling u-boot source I got the follwing error:

u-boot/stm32429-disco/include/config.h:4: fatal error: configs/stm32429-disco.h: No such file or directory

There is no stm32429-disco .h config file in the source tree.

tmkaran
Associate II
Posted on December 09, 2013 at 07:38

Opps! Sorry guys. Some files was missing. I updated the repository. Please check it again.

Henry Dang
Associate II
Posted on December 16, 2013 at 10:51

Hi TMK,

Would you pls show me how to build the romfs file system ? Is it possible to use buildroot tool for STM32F4-DISCO ?

Thank you very much.

magore
Associate II
Posted on December 17, 2013 at 01:14

I was able to compile everything

I can flash u-boot and uclinux however when I do the romfs I get this error

root@bench:/share/embedded/ARM/stm32/STM32F429I-DISCO/uclinux/stm32-bins# st-flash write romfs.bin 0x08120000

2013-12-16T19:07:09 INFO src/stlink-usb.c: -- exit_dfu_mode

2013-12-16T19:07:09 INFO src/stlink-common.c: Loading device parameters....

2013-12-16T19:07:09 INFO src/stlink-common.c: Device connected is: F42x and F43x device, id 0x10036419

2013-12-16T19:07:09 INFO src/stlink-common.c: SRAM size: 0x30000 bytes (192 KiB), Flash: 0x200000 bytes (2048 KiB) in pages of 16384 bytes

2013-12-16T19:07:09 INFO src/stlink-common.c: Attempting to write 346112 (0x54800) bytes to stm32 address: 135397376 (0x8120000)

EraseFlash - Sector:0xd Size:0x20000

Flash page at addr: 0x08120000 erasedEraseFlash - Sector:0xe Size:0x20000

Flash page at addr: 0x08140000 erasedEraseFlash - Sector:0xf Size:0x20000

Flash page at addr: 0x08160000 erased

2013-12-16T19:07:09 INFO src/stlink-common.c: Finished erasing 3 pages of 131072 (0x20000) bytes

2013-12-16T19:07:09 INFO src/stlink-common.c: Starting Flash write for F2/F4

2013-12-16T19:07:09 INFO src/stlink-common.c: Successfully loaded flash loader in sram

size: 32768

size: 32768

size: 32768

size: 32768

size: 32768

size: 32768

size: 32768

size: 32768

size: 32768

size: 32768

size: 18432

2013-12-16T19:07:17 INFO src/stlink-common.c: Starting verification of write complete

2013-12-16T19:07:17 ERROR src/stlink-common.c: Verification of flash failed at offset: 0

stlink_fwrite_flash() == -1

Henry Dang
Associate II
Posted on December 17, 2013 at 03:06

Hi gore.mike

You can try STM32 ST-LINK Utility on Windows. I'm using it and flashed image OK.

magore
Associate II
Posted on December 17, 2013 at 05:39

Hi phuong.dang_minh

  Thanks for the tip about windows - I will try that.

Does the romfs.bin file have to be processed before flashing ?

I already found that I had to process vmlinux with objcopy before I wrote it like this:

    arm-uclinuxeabi-objcopy -O binary vmlinux vmlinux.bin

    echo ST-LINK flash

    st-flash --reset write vmlinux.bin 0x08020000

Henry Dang
Associate II
Posted on December 17, 2013 at 07:08

No, not need to compress the images, here is some image offset which I've done and booted successfully:

u-boot.bin       :  0x08000000

xipuImage.bin  :  0x08020000

romfs.bin         :  0x08120000

After compiling kernel we have xipImage then we generate xipuImage.bin by execute make_uboot_ximage script in the arch/arm/boot directory.

I'm also trying to patch the buildroot for STM32F4 but it still doesn't work.

grzegorz23
Associate II
Posted on December 17, 2013 at 22:19

If I run make_uboot_ximage I see error:

''mkimage: For XIP, the entry point must be the load addr + 64''

What is wrong?

tmkaran
Associate II
Posted on December 18, 2013 at 09:34

Hi uC_KG,

The script just copy 64 bytes 0xFF data to the front of compiled XIP image binary. Then it uses mkimage tool for create u-boot header. for dummy 64 bytes, the script need to be ''tempfile'' that just contains 64 bytes 0xFF. So the other things seem in the file. if ''tempfile'' is not in the boot directory, you can see some error as you know.