This shows you the differences between two versions of the page.
ass:laboratoare:01:tasks:03 [2023/07/17 23:37] florin.stancu |
ass:laboratoare:01:tasks:03 [2025/05/16 13:00] (current) radu.mantu |
||
---|---|---|---|
Line 13: | Line 13: | ||
The Universal Update Utility (UUU) is an image deployment tool created by NXP for it's i.MX architecture. For more information about its usage, scripting interface and supported protocols, check out the [[https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors/140261/1/UUU.pdf|documentation]]. | The Universal Update Utility (UUU) is an image deployment tool created by NXP for it's i.MX architecture. For more information about its usage, scripting interface and supported protocols, check out the [[https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors/140261/1/UUU.pdf|documentation]]. | ||
- | Grab the source code from [[https://github.com/nxp-imx/mfgtools.git|here]] and compile ***uuu***. The project uses the **cmake** build system for the sake of portability. If you haven't encountered it yet, follow these setup steps: | + | Grab the source code from [[https://github.com/nxp-imx/mfgtools.git|here]] and compile **uuu**. The project uses the **cmake** build system for the sake of portability. If you haven't encountered it yet, follow these setup steps: |
<code bash> | <code bash> | ||
Line 46: | Line 46: | ||
</code> | </code> | ||
- | About now you should see lots of debug messages via **picocom** (or whatever serial console tool you prefer). If the last log line is ''Run fastboot ...'', send it a //Ctrl + C// and you should get the ''u-boot%%=>%%'' prompt. | + | About now you should see some debug messages in your serial console tool. |
+ | |||
+ | Unfortunately (as per Murphy's law), notice we have some boot errors (: **don't worry, this is expected**! | ||
<note> | <note> | ||
Line 52: | Line 54: | ||
</note> | </note> | ||
- | === Interacting with U-Boot === | + | == Step 8. Troubleshooting == |
+ | |||
+ | You should get this error: <code> | ||
+ | Trying to boot from USB SDP | ||
+ | alloc space exhausted | ||
+ | failed to initialize gadget | ||
+ | couldn't find an available UDC | ||
+ | g_dnl_register: failed!, error: -19 | ||
+ | SDP dnl register failed: -19 | ||
+ | </code> | ||
+ | |||
+ | The proper debugging procedure is to find the location of the exact error message inside u-boot's source code. | ||
+ | |||
+ | It seems that the [[https://github.com/TechNexion/u-boot-tn-imx/blob/6e5acadb0e01131b24d4508a7af01021efeca7d5/common/malloc_simple.c#L30|malloc()]] call fails due to memory exhaustion. Recall that BL2 (U-Boot SPL) runs entirely from the internal SRAM of the chip, which is just ''128K''! But we also saw some messages about 2GB of DRAM becoming initialized, but we still need to properly tell our bootloader to use them! | ||
+ | |||
+ | Thus, go back to **Step 4** (//Modifying U-Boot configuration//) and do some more configuration changes! But first, we must find out which options control the malloc pools. You can do that by [[https://github.com/TechNexion/u-boot-tn-imx/blob/6e5acadb0e01131b24d4508a7af01021efeca7d5/include/system-constants.h#L25|reading the source code here]] and [[https://github.com/TechNexion/u-boot-tn-imx/blob/6e5acadb0e01131b24d4508a7af01021efeca7d5/common/spl/spl.c#L755|here]]. | ||
+ | |||
+ | Use menuconfig to search for the following options: | ||
+ | * SYS_SPL_MALLOC -- must enable additional malloc pools; | ||
+ | * SPL_MALLOC_ADDR -- enter a physical address inside the board's DRAM memory (reminder: DDR starts from ''0x40000000''); | ||
+ | * SPL_MALLOC_SIZE -- make it bigger, e.g. ''1MB'' (in hex!); | ||
+ | |||
+ | <spoiler Click to see them><code> | ||
+ | CONFIG_SYS_SPL_MALLOC=y | ||
+ | CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y | ||
+ | CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000 | ||
+ | CONFIG_SYS_SPL_MALLOC_SIZE=0x100000 | ||
+ | CONFIG_USB_GADGET_MANUFACTURER="ASS" | ||
+ | CONFIG_USB_GADGET_VENDOR_NUM=0x1fc9 | ||
+ | CONFIG_USB_GADGET_PRODUCT_NUM=0x012b | ||
+ | CONFIG_USB_FUNCTION_SDP=y | ||
+ | </code></spoiler> | ||
+ | |||
+ | You may enter them inside a simple text file (e.g.: ''ass-extra.config''; don't forget the ''CONFIG_*'' prefix) and use the following script to mergem them inside the main ''.config'': <code sh> | ||
+ | # note: run this inside u-boot's source directory | ||
+ | scripts/kconfig/merge_config.sh ".config" "ass-extra.config" | ||
+ | </code> | ||
+ | |||
+ | Return after re-building the entire firmware image (i.e. ''flash.bin'' -- including the ''mkimage'' step -- hope you've scripted it in a Makefile!). | ||
+ | |||
+ | Finally, when everything is in working condition, you should see a ''Run fastboot ...'' message, press //Ctrl + C// and you should get the ''u-boot%%=>%%'' prompt. | ||
+ | |||
+ | == Step 9. Time to play! == | ||
You might be wondering: but we don't have an OS installed yet... is this all we can do now? | You might be wondering: but we don't have an OS installed yet... is this all we can do now? | ||
Don't worry, we'll now get to see why ''u-boot'' is the most popular choice for embedded devices (here's another fact: most Android phones also use it)! | Don't worry, we'll now get to see why ''u-boot'' is the most popular choice for embedded devices (here's another fact: most Android phones also use it)! | ||
- | |||
- | == Step 8. Time to play! == | ||
Now that we finally have access to the interactive shell (we've stopped at **BL33**), try to run ''bdinfo'' for some generic board information. Run ''help'' to see what other commands are available to you, and ''help <command>'' for detailed information of said command. Note that this may not be an exhaustive list of commands; some may not have been compiled into the final binary, depending on your ''.config''. | Now that we finally have access to the interactive shell (we've stopped at **BL33**), try to run ''bdinfo'' for some generic board information. Run ''help'' to see what other commands are available to you, and ''help <command>'' for detailed information of said command. Note that this may not be an exhaustive list of commands; some may not have been compiled into the final binary, depending on your ''.config''. | ||
Line 67: | Line 109: | ||
* Print the available eMMC devices, as well as their partition tables (if any are available). | * Print the available eMMC devices, as well as their partition tables (if any are available). | ||
* Perform a memory test on the first GB of DRAM. Note that U-Boot relocates itself toward the end of the DRAM bank during its initialization phase (check ''bdinfo'' for the exact address). Stay away from that region unless you want to overwrite **BL33** itself with your test pattern. | * Perform a memory test on the first GB of DRAM. Note that U-Boot relocates itself toward the end of the DRAM bank during its initialization phase (check ''bdinfo'' for the exact address). Stay away from that region unless you want to overwrite **BL33** itself with your test pattern. | ||
+ | |||