Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation and Programming guide step by step #2

Open
myfreescalewebpage opened this issue Jul 3, 2019 · 38 comments
Open

Generation and Programming guide step by step #2

myfreescalewebpage opened this issue Jul 3, 2019 · 38 comments

Comments

@myfreescalewebpage
Copy link

Hello,

I'm iMX6ULL with NAND module user and I try to generate and load my SOM with Yocto and uuu tools. Actually I'm totally lost because of no help, and it seems I need some files which are not generated by yocto when building the image with your meta.

Please, can you provide a complete step by step programming guide that indicate how to generate and load the system, particularly for the case of NAND modules ?

I have made several testing and currently it seems only the sumo branch is able to build for NAND device according to the machine definition. However, the config file 'somlabs_visionsom_6ull_nand_config' indicated does not exist, your meta is not consistent.

I can help to make some testing if you have only a draft today. Please tell me how I can help on this.

Regards,
Joel

@voloviq
Copy link

voloviq commented Jul 3, 2019 via email

@myfreescalewebpage
Copy link
Author

Hello Michal,

Thanks for your quick answer.
Yeah I want to use it for my personal usage too but currently I'm evaluating this solution for my work.
It does not matter which branch at the moment, I'm not attached to thud, sumo is great.

I have seen your page http://www.emsyslabs.com/somlabs-nand-programming/ already, but when you reach the end, how do you continue the programming of the SOM ? I mean kernel, dtb, rootfs... all in the NAND.

Thanks again,
Joel

@myfreescalewebpage
Copy link
Author

myfreescalewebpage commented Jul 10, 2019

Hello @voloviq

I made some progress, I have patched some part of the meta to generate "core-image-minimal" and "fsl-image-mfgtool-initramfs" images. I have u-boot, kernel, dtb, initramfs, rootfs.

I'm currently trying to burn the system with "imx_usb_loader" and "utp_com", I'm not sure what to do to flash the NAND. I try to follow this tutorial: https://community.nxp.com/thread/441563
I also had a look to uuu, there is an example script provided that I'm using. It starts but then wait definitively...

Have you already played with that ?

Thanks to share your experience,
Joel

@voloviq
Copy link

voloviq commented Jul 11, 2019 via email

@myfreescalewebpage
Copy link
Author

myfreescalewebpage commented Jul 11, 2019

Hello Michal,

I think I create a few configuration file separately for sdcard, nand and emmc

Probably one machine per configuration ? That should be great !

Also please, separate everything that is not necessary to build a very minimal image that is working. I think to the distro, to QT and some lab images, etc. Just put them in a new layer "meta-somlabs-extended" for example.

Do You have some progress about NAND programming?

Yes and no. I have just found https://wiki.somlabs.com/index.php/How_to_write_image_to_VisionSOM-6ULL_NAND_memory_using_UUU_tool_on_Linux and https://wiki.somlabs.com/index.php/How_to_write_image_to_VisionSOM-6ULL_NAND_memory_using_UUU_tool_on_Windows, where a specific version of uuu is provided (without the sources which is probably not respecting the licence!!!) but it fails. The page have honestly some errors, but I managed to start flashing. Here are some logs:

On the host Linux computer (ubuntu 16.04):

host

  • vsom-6ull-fb.bin is from somlabs, given with uuu specific version (also tried but yocto version, its also very bad)
  • _rootfs.ubi and _u-boot-dtb.imx are from my yocto build

At the same time on the target:

target

We can see several errors:

  • "NAND: MXS NAND: clock is disabled!"
  • "Card did not respond to voltage select!"
  • "** Bad device mmc 0 **"
  • "Error: could not access storage."
  • "Device nand0 not found!"

Seems the software does not found the NAND I don't know why... (does the uuu tool expect the correct NAND model ?)

If you want to have a look too, that's welcome, maybe the eyes of somebody else will see something else :)

I wonder also : how SomLabs have flashed the NAND in factory ? That can be a solution but there is no information.

Joel, still on going...

EDIT: sometimes NAND is detected according to u-boot logs but this terminates with the same error

@voloviq
Copy link

voloviq commented Jul 11, 2019

I think You have a uboot without NAND support. Please try to use my uboot 2018.09. It is not perfect but NAND is supported and found. Uboot is available from https://github.com/SoMLabs/somlabs-uboot-imx/tree/2018.09 branch 2018.09.

@voloviq
Copy link

voloviq commented Jul 11, 2019

Yes, SomLabs have some procedure but it is very difficult and needs to run rootfs from RAM or USB flash drive. I had the opportunity to test it but sometimes works sometimes don't. If you want this procedure please ask the manufacturer.

@myfreescalewebpage
Copy link
Author

I just finally succeeded with u-boot provided in the uuu toturial !

U-Boot 2018.03-00022-g23f402fe9c-dirty (May 27 2019 - 23:52:18 +0200)

CPU:   Freescale i.MX6ULL rev1.1 792 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 49C
Reset cause: POR
Model: SoMLabs VisionSOM-6ULL
Board: SomLabs VisionSOM-6ULL
DRAM:  512 MiB
board_fix_fdt(): boot device: 14, fdt@8789ed8c
fdt_enable_by_ofname(): enabling node [/soc/gpmi-nand@01806000] @00001080...result: 0
SomLabs VisionSOM-6ULL - configuring NAND interface...
NAND:  512 MiB
MMC:
No panel detected: default to SL-TFT7-TP
Display: SL-TFT7-TP (800x480)
Video: 800x480x24
Error: no valid bmp image at 80000000
In:    serial
Out:   serial
Err:   serial
board_late_init()
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  0
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: volume 0 ("rootfs") re-sized from 26 to 1988 LEBs
ubi0: attached mtd1 (name "mtd=2", size 508 MiB)
ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes
ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 4096
ubi0: VID header offset: 4096 (aligned 4096), data offset: 8192
ubi0: good PEBs: 2028, bad PEBs: 4, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 927845223
ubi0: available PEBs: 0, total reserved PEBs: 2028, PEBs reserved for bad PEB handling: 36
Loading file '/boot/somlabs-visionsom-6ull-nand.dtb' to addr 0x83000000...
** File not found /boot/somlabs-visionsom-6ull-nand.dtb **
Loading file '/boot/boot.scr' to addr 0x80800000...
** File not found /boot/boot.scr **
Loading file '/boot/zImage' to addr 0x80800000...
** File not found /boot/zImage **

My generated rootfs has no kernel/dtb/boot.scr so this is something to be corrected.

I will try again with the u-boot branch 2018.09 and tell you.

Joel

@myfreescalewebpage
Copy link
Author

myfreescalewebpage commented Jul 11, 2019

Result : with 2018.09 the loading does only step 1/9, and then block.

Working loading:

U-Boot 2018.03-00022-g23f402fe9c-dirty (May 27 2019 - 23:52:18 +0200)

CPU:   Freescale i.MX6ULL rev1.1 792 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 51C
Reset cause: POR
Model: SoMLabs VisionSOM-6ULL
Board: SomLabs VisionSOM-6ULL
DRAM:  512 MiB
board_fix_fdt(): boot device: 0, fdt@8789ed8c
fdt_enable_by_ofname(): enabling node [/soc/aips-bus@02100000/qspi@021e0000] @0000641C...result: 0
fdt_enable_by_ofname(): enabling node [/soc/aips-bus@02100000/usdhc@02194000] @00005950...result: 0
NAND:  MXS NAND: clock is disabled!
0 MiB
MMC:   FSL_SDHC: 0
No panel detected: default to SL-TFT7-TP
Display: SL-TFT7-TP (800x480)
Video: 800x480x24
Card did not respond to voltage select!
** Bad device mmc 0 **
Error: could not access storage.
In:    serial
Out:   serial
Err:   serial
board_late_init()
Fastboot: Normal
Boot from USB for uuu
Hit any key to stop autoboot:  0
Device nand0 not found!
Starting download of 687104 bytes
.....
downloading of 687104 bytes finished
imxkobs: Image header:
    header: 402000D1
 boot_data: 877FF420
  dcd_addr: 877FF42C
      self: 877FF400
       csf: 00000000
 boot_data@ 80800020
     start: 877FF000
    length: 000A8000
mtd: boot partition size too small
        search_area_size_in_bytes * 2 > boot partition size
        0xcb3fe038 * 2 > 0x300000
imxkobs - imx-kobs tool

Usage:
imxkobs fwaddr bootsize [search_exponent] [nand_timing]


U-Boot 2018.03-00022-g23f402fe9c-dirty (May 27 2019 - 23:52:18 +0200)

CPU:   Freescale i.MX6ULL rev1.1 792 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 49C
Reset cause: POR
Model: SoMLabs VisionSOM-6ULL
Board: SomLabs VisionSOM-6ULL
DRAM:  512 MiB
board_fix_fdt(): boot device: 14, fdt@8789ed8c
fdt_enable_by_ofname(): enabling node [/soc/gpmi-nand@01806000] @00001080...result: 0
SomLabs VisionSOM-6ULL - configuring NAND interface...
NAND:  512 MiB
MMC:
No panel detected: default to SL-TFT7-TP
Display: SL-TFT7-TP (800x480)
Video: 800x480x24
Error: no valid bmp image at 80000000
In:    serial
Out:   serial
Err:   serial
board_late_init()
Fastboot: Normal
Boot from USB for uuu
Hit any key to stop autoboot:  0
Starting download of 687104 bytes
.....
downloading of 687104 bytes finished
imxkobs: Image header:
    header: 402000D1
 boot_data: 877FF420
  dcd_addr: 877FF42C
      self: 877FF400
       csf: 00000000
 boot_data@ 80800020
     start: 877FF000
    length: 000A8000
do_imxkobs(): max_boot_stream_size_in_bytes = 1048576, boot_stream_size_in_bytes = 688128, boot_stream_size_in_pages = 168
do_imxkobs(): fw#1 0x00100000 - 0x00200000 (0x001a8000)
do_imxkobs(): fw#2 0x00200000 - 0x00300000 (0x002a8000)
do_imxkobs(): fcb checksum: FFFFFA7E
do_imxkobs(): erasing boot area...
do_imxkobs(): writing firmware image copy 1...
do_imxkobs(): writing firmware image copy 2...
do_imxkobs(): writing DBBT header...
do_imxkobs(): writing DBBT data...
do_imxkobs(): writing FCB...
  writing fcb[0] @ 00000000
  writing fcb[1] @ 00080000
do_imxkobs(): done
Starting download of 7340032 bytes
........................................................
downloading of 7340032 bytes finished

NAND erase.part: device 0 offset 0x400000, size 0x1fc00000
Skipping bad block at  0x1ff00000
Skipping bad block at  0x1ff40000
Skipping bad block at  0x1ff80000
Skipping bad block at  0x1ffc0000

OK

NAND write: device 0 offset 0x400000, size 0x700000
 7340032 bytes written: OK
resetting ...

2018.09 build with yocto:

U-Boot 2018.09+fslc+gae57ffc (Jul 03 2019 - 05:59:12 +0000)

CPU:   Freescale i.MX6ULL rev1.1 792 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 48C
Reset cause: POR
Model: SomLabs i.MX6 ULL Visionsom
Board: SomLabs visionsom 6ull
DRAM:  512 MiB
NAND:  512 MiB
Loading Environment from NAND... *** Warning - bad CRC, using default environment

Video: 800x480x24
In:    serial
Out:   serial
Err:   serial
Net:   FEC0 [PRIME]
Warning: FEC0 (eth0) using random MAC address - 4e:71:07:ae:b3:0f

=> 

Do you know the 2018.03 version which is used in somlabs uuu tutorial ?

@voloviq
Copy link

voloviq commented Jul 12, 2019

No, I don't use version 2018.03 of UBoot. So based on Your above description I guess that You succeed with programming NAND in UBoot environment?

@myfreescalewebpage
Copy link
Author

This 2018.03 version seems to work well. Sometimes the NAND is not detected, but it succeed to flash the NAND with the uuu version provided by somlabs.
I would like to finish (need to complete the kernel image) and then I can provide you my meta layer and the command to flash the board.

@myfreescalewebpage
Copy link
Author

That now loaded and working !!! I have:

sudo ./uuu -b vsom_6ull_nand_flasher  vsom-6ull-fb.bin _rootfs.ubi

The board must be started in "SERIAL" mode to allow programming over USB (not the USB port of the serial console, but the USB port on the iMX itself).

I'm facing an issue at the boot before getting the prompt:

Configuring network interfaces... Micrel KSZ8081 or KSZ8091 2188000.ethernet-1:01: attached PHY driver [Micrel KSZ8081 or KSZ8091] (mii_bus:phy_addr=2188000.ethernet-1:01, irq=-1)
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

And then the system is blocked, it does not continue. Maybe you are aware and have a solution if you already know this ? The linux version is linux-imx 4.9.88.

One remark: the rootfs contains the 6 dtb. That's not very convenient and it will be cleaner if 6 machines are defined in the conf. It is possible to have one inc file to include in the machine to declare all the common elements, and then to specify each of them (dtb, u-boot config) in the machine itself.

Then one question more general: I understood you are not from SomLabs, but you contribute to these repositories on github. Are you the owner of the SomLabs account on github ? Do you know where the https://github.com/SoMLabs/somlabs-uboot-imx comes from ? Is it really working ?

@myfreescalewebpage
Copy link
Author

Just read this issue SoMLabs/somlabs-uboot-imx#3, it's the same problem I have with the u-boot generated with yocto.

@myfreescalewebpage
Copy link
Author

Hi @voloviq
I will be in vacation for two weeks but then I will finish this job.
Regards,
Joel

@voloviq
Copy link

voloviq commented Jul 13, 2019

No problem, we go back to it later.
Regards

@myfreescalewebpage
Copy link
Author

Okay, starting again some testing...
With thud (which is using linux-fslc), I have problem on startup with UBI FS. The kernel tries to initializes in an infinite loop.
Coming back to sumo version which is using linux-imx, was quite working for me here, will try to solve the remaining issues on it.

@myfreescalewebpage
Copy link
Author

myfreescalewebpage commented Jul 25, 2019

@voloviq and @QB4-dev I have now something that is working with my 6ULL-NAND module. I have attached the state of the meta to this message: meta-somlabs.zip

Several notes:

  • You can see that the content of the meta is very reduced. There is the machine, u-boot, a fix for eth interfaces and device trees added to the kernel. The Murata firmware should be added and the machine should be clean up (at least 6 machines should be defined and probably 12 to cover with/without wifi+bt). By the way, my point of view is that dependencies like QT, distro, etc etc are not expected here. We just want a BSP meta layer to get the hardware running, the other stuff should be an other layer, an applicative layer meta-somlabs-extented or another. I would like this, but @voloviq what is your opinion and your philosophy here for the meta-somlabs repo ?
  • My attached meta depends of meta-freescale, meta-openembeeded and poky, sumo version. It should also easily compatible with newer version by adding yocto releases to the layer.conf file.
  • Building is done by cloning the repos and then "bitbake core-image-minimal". The proper machine should be added to local.conf.
  • Flashing is done throw USB with somlabs tools at http://ftp.somlabs.com/Tools/somlabs-visionsom-flasher.zip with the following command line: sudo ./uuu -b vsom_6ull_nand_flasher vsom-6ull-fb.bin core-image-minimal-visionsom6ull.ubi The board should be started in Serial mode then restarted in Internal mode to start from the NAND. The console is available on the eval board to follow the loading and then to access linux console. Login is root with no password.

Some things I have not understood:

  • How to generate a proper u-boot binary. I'm using the version provided by somlabs in the wiki (download link above). I'm afraid that somlabs do not provide the sources of this... as it doesn't provide the sources of the uuu binary they provide too. If you have any idea....

  • At the first boot, the kernel prints some "alloc_contig_range: [8c060, 8c064) PFNs busy" lines in the console at the beginning. Don't know what it is but not checked yet.

  • Unable to load the module with Windows uuu.exe binary due to drivers issues on my computer. Not sure they are available for Win7 but that's not my priority, I only need Linux at this time.

Not tested:

  • WiFi and Bluetooth

Joel

EDIT: For the 6ULL versions, 8 machines should be define to correspond to the 8 references available from somlabs (https://www.mouser.fr/_/?Keyword=somlabs+sls16&FS=True). 6UL version seems not available at all, isn't it ?

@myfreescalewebpage
Copy link
Author

myfreescalewebpage commented Jul 28, 2019

@voloviq ping :) If you can answer to my previous question about the direction where you go it's fine! Else I will propose my own -minimal- somlabs meta layer on my github. If you have some ideas for u-boot it's great too!

@QB4-dev
Copy link

QB4-dev commented Jul 28, 2019

You can see that the content of the meta is very reduced. There is the machine, u-boot, a fix for eth interfaces and device trees added to the kernel. The Murata firmware should be added and the machine should be clean up (at least 6 machines should be defined and probably 12 to cover with/without wifi+bt).

Totally agree with you Joel, meta-somlabs layer should be only base for custom projects.
Device tree also should be minimal - suited to hardware on PCB only(boot medium(SD/NAND/EMMC description + WiFi/BT). This should be done like Toradex does:

toradex-devicetree

This device tree descriptions in current meta-somlabs are made only for this board
https://somlabs.com/product/visioncb-6ull-std/
Better way will be inherit generic somlabs board .dtsi file, and add carrier board peripherals in target .dts file like visionCB-6ULL-STD-nand-wifi.dts

By the way, my point of view is that dependencies like QT, distro, etc etc are not expected here. We just want a BSP meta layer to get the hardware running, the other stuff should be an other layer, an applicative layer meta-somlabs-extented or another. I would like this, but @voloviq what is your opinion and your philosophy here for the meta-somlabs repo ?

Also agree. Currently our company is finishing first project with somlabs board, because of this mix in meta-somlabs I made my own layer with recipes that I needed copied from meta-somlabs.
Now when We will start another project, the best way will be to have single layer for hardware with different device-trees for our different custom boards. Currently it is impossible because there is no generic device-tree file for visionsom6ull.

It would be great to get minimal meta-somlabs layer with your philosophy which may be added to every project based on Somlabs boards

@myfreescalewebpage
Copy link
Author

@QB4-dev thanks, we share the same vision!

@voloviq
Copy link

voloviq commented Jul 29, 2019

Sorry Guys
unfortunately, I have extremely no time. When I find some time I try to reply to you.

PS. Please ask the manufacturer to give you access to this git.

Best Regards
Michal

@myfreescalewebpage
Copy link
Author

myfreescalewebpage commented Jul 29, 2019

Thanks @voloviq for your message, no worries, check when you have more time !

Joel

EDIT: message to somlabs done to understand where are the sources of u-boot that are working. Waiting the answer.

@myfreescalewebpage
Copy link
Author

@QB4-dev I'm working on a simplified dtsi common to all config, but if you have also one you want to share, that's very nice. We can share on this to have the right content.
Joel

@arekkaras
Copy link

Hello all,

if you are still looking for somlabs u-boot sources - it's on github:
https://github.com/SoMLabs/somlabs-uboot-imx
This is based on official NXP u-boot version, with changes made to support somlabs boards.

Regards
Arek

@myfreescalewebpage
Copy link
Author

Hello Arek,

Thanks, I know that. Can you detail which commit is to be used for NAND module version ? That's the main problem today.

Joel

@arekkaras
Copy link

arekkaras commented Aug 18, 2019

Please use branch : imx_v2018.03_4.14.98_2.0.0_ga

Regards
Arek

@myfreescalewebpage
Copy link
Author

Thanks. This branch does not properly exists on https://github.com/SoMLabs/somlabs-uboot-imx
Is it "somlabs-imx_v2018.03_4.14.98_2.0.0_ga" ?
Joel

@arekkaras
Copy link

Thanks. This branch does not properly exists on https://github.com/SoMLabs/somlabs-uboot-imx
Is it "somlabs-imx_v2018.03_4.14.98_2.0.0_ga" ?
Joel

Hello Jeol,
yes, indeed it is "somlabs-imx_v2018.03_4.14.98_2.0.0_ga" branch.

Regards
Arek

@myfreescalewebpage
Copy link
Author

myfreescalewebpage commented Aug 22, 2019

This branch has two defconfig:

  • somlabs_visionsom_6ull_defconfig
  • somlabs_visionsom_6ull_fastboot_defconfig

Are they compatible with all the targets ? (eMMC/SD/NAND) ?

Joel

@myfreescalewebpage
Copy link
Author

Just tried:

  • to build with "somlabs_visionsom_6ull_defconfig", I get a u-boot binary of size 601088 Bytes, while vsom-6ull-fb.bin is 687104 Bytes....
  • loading with uuu does not start at all, it blocks at the end of step 1
    I'm using NAND 512MB module with WiFi.

@arekkaras
Copy link

arekkaras commented Aug 22, 2019 via email

@arekkaras
Copy link

arekkaras commented Aug 22, 2019 via email

@myfreescalewebpage
Copy link
Author

Yes, both. One with fastboot in name is used to build binary used by uuu to
flash board. Normaly you don't need to build it by your own if you use uuu
from somlabs.

I try to rebuild ALL the binaries. I would like to not use the binary from somlabs.

Other configuration is default bootloader used in normal boot.

How is ti flashed on the target ? Actually I flash with sudo ./uuu vsom_6ull_nand_flasher vsom-6ull-fb.bin rootfs.ubi

I understand "vsom-6ull-fb.bin" should be build with "somlabs_visionsom_6ull_fastboot_defconfig", right ? seems logic, actuazly I have log "Unknown command 'fastboot'" in the terminal.

Yes I'm in serial mode, flashing throw USB (no Ethernet).

@myfreescalewebpage
Copy link
Author

Okay new status ! Just build with "somlabs_visionsom_6ull_fastboot_defconfig", I have now a binary which is working !!!! I succeed to load my image in the nand with the uuu version provided n the somlabs ftp, and with my own "vsom-6ull-fb.bin"

During the flashing, this is my u-boot version which is used (build date is displayed) and during the normal boot, this is the same ! HAPPY ! :D

@myfreescalewebpage
Copy link
Author

myfreescalewebpage commented Aug 24, 2019

Thanks so much to @arekkaras I have something really nice now! I'm working on linux-imx recipes now because freescale recipes do not support fragments... trying to implement something.
Also, I have not response about the meta-somlabs philosophy about the dependencies of QT, etc. So I will probably create my own meta-somlabs on my github account, with build and programming step by step guide.

https://community.nxp.com/message/1190622
https://community.nxp.com/thread/376369

@myfreescalewebpage
Copy link
Author

Hello guys
My work is now available at https://github.com/myfreescalewebpage/meta-somlabs
If you have a look or if you try it, let me known !
Joel

@QB4-dev
Copy link

QB4-dev commented Sep 2, 2019

@myfreescalewebpage Man, you are awesome! I will test your layer soon. Thank you very much

@myfreescalewebpage
Copy link
Author

@QB4-dev thanks :) Still making stuff on it but the current version is fully functional actually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants