Part Number: AM2612-Q1
Other Parts Discussed in Thread: UNIFLASH
Hi expert,
Please provide steps to flash AM261 using UniFlash CLI tool.
Provide commands for relevant operations as well
Download the uniflash_windows setup from the uniFlash tool.
Run one_time_setup.bat - Installs the XDS110 / ICDI USB drivers.
Extract the zip file and save it at a location in your pc.

All commands are run from the package folder:
cd <your-path>\uniflash_windows
Set the two image paths once (Command Prompt / cmd.exe):
set SBL=<sdk-instllation-path>/examples/drivers/boot/sbl_ospi_multicore_elf/am261x-lp/r5fss0-0_nortos/ti-arm-clang/sbl_ospi_multicore_elf.release.tiimage
set APP=<sdk-instllation-path>/examples/hello_world/am261x-lp/r5fss0-0_nortos/ti-arm-clang/hello_world.release.mcelf
Full erase:
.\dslite-Cortex_R5_0.bat --mode flash -c user_files/configs/AM261x.ccxml -e -s "EraseActionChoice=Erase entire flash" -b EraseAll
Erase selected blocks (e.g. blocks 0,1 and 3):
.\dslite-Cortex_R5_0.bat --mode flash -c user_files/configs/AM261x.ccxml -e -s "EraseActionChoice=Erase specific flash blocks" -s "StandaloneEraseSpecificText=0-1,3" -b EraseBlocks
Flash only (no verify):
.\dslite-Cortex_R5_0.bat --mode flash -c user_files/configs/AM261x.ccxml -e -s "VerifyAfterProgramLoad=No verification" -f "%SBL%,0x60000000" "%APP%,0x60081000"
Flash and verify:
.\dslite-Cortex_R5_0.bat --mode flash -c user_files/configs/AM261x.ccxml -e -s "VerifyAfterProgramLoad=Full verification" -f -v "%SBL%,0x60000000" "%APP%,0x60081000"
Full erase, flash and verify in ONE command:
.\dslite-Cortex_R5_0.bat --mode flash -c user_files/configs/AM261x.ccxml -e -s "EraseActionChoice=Erase entire flash" -s "VerifyAfterProgramLoad=Full verification" -b EraseAll -f -v "%SBL%,0x60000000" "%APP%,0x60081000"
Verify only (compare flash against files, no writing):
.\dslite-Cortex_R5_0.bat --mode flash -c user_files/configs/AM261x.ccxml -s "VerifyAfterProgramLoad=Full verification" -v "%SBL%,0x60000000" "%APP%,0x60081000"
Flash XIP File as well
set XIP=<sdk-instllation-path>/examples/hello_world_xip_fss1/am261x-lp/r5fss0-0_nortos/ti-arm-clang/hello_world_xip_fss1.release.mcelf_xip
.\dslite-Cortex_R5_0.bat --mode flash -c user_files/configs/AM261x.ccxml -e -s "VerifyAfterProgramLoad=Full verification" -f "%SBL%,0x60000000" "%APP%,0x60081000" "%XIP%,0xE0000000"
NOTE: XIP files are flashed at the address 0xE000_0000 address, this is not an actual memory map address, this is actually a placeholder address for the uniflash tool to know that the file is a mcelf_xip file
To verify XIP segment, we can first take the dump of load segments from the mcelf_xip file, save it as a .bin file and use it to compare the contents written in flash.
1. First flash all the files, SBL, APP and APP_XIP
.\dslite-Cortex_R5_0.bat --mode flash -c user_files/configs/AM261x.ccxml -e -f "%SBL%,0x60000000" "%APP%,0x60081000" "%XIP%,0xE0000000"
2. Convert load segment of the mcelf_xip image into bin
python .\extract_xip.py "%XIP%" .\
3. Verify all the files
set SBL=<sdk-instllation-path>/examples/drivers/boot/sbl_ospi_multicore_elf/am261x-lp/r5fss0-0_nortos/ti-arm-clang/sbl_ospi_multicore_elf.release.tiimage
set XIP=<sdk-instllation-path>/examples/hello_world_xip_fss1/am261x-lp/r5fss0-0_nortos/ti-arm-clang/hello_world_xip_fss1.release.mcelf_xip
set APP=<sdk-instllation-path>/examples/hello_world_xip_fss1/am261x-lp/r5fss0-0_nortos/ti-arm-clang/hello_world_xip_fss1.release.mcelf
set XIP_SEG=C:\Users\Aswin\Downloads\uniflash_windows\xip_seg1_0x60100000.bin
.\dslite-Cortex_R5_0.bat --mode flash -c user_files/configs/AM261x.ccxml -e -s "VerifyAfterProgramLoad=Full verification" -v "%SBL%,0x60000000" "%APP%,0x60081000" "%XIP_SEG%,0x60100000"
import struct, sys
src, outdir = sys.argv[1], sys.argv[2]
d = open(src, 'rb').read()
assert d[:4] == b'\x7fELF' and d[4] == 1, "not ELF32"
phoff, = struct.unpack_from('<I', d, 0x1C)
phentsize, phnum = struct.unpack_from('<HH', d, 0x2A)
for i in range(phnum):
p_type, p_off, p_vaddr, p_paddr, p_filesz, p_memsz, _, _ = struct.unpack_from('<8I', d, phoff + i * phentsize)
if p_type != 1: # PT_LOAD
continue
flash_off = p_paddr & 0x0FFFFFFF # same rule as SDK bootloader_uniflash_mcelf.c
out = f"{outdir}/xip_seg{i}_0x{0x60000000 + flash_off:08X}.bin"
open(out, 'wb').write(d[p_off:p_off + p_filesz])
print(f"seg{i}: paddr=0x{p_paddr:08X} size=0x{p_filesz:X} flash_off=0x{flash_off:X} jtag_addr=0x{0x60000000+flash_off:08X} block={flash_off//0x10000}..{(flash_off+p_filesz-1)//0x10000} -> {out}")
The python file is a custom developed python file to extract the load segments from mcelf_xip file and save it as a bin file.