Can you share a screen shot of your Nios II instruction master and data master address map? I'm interested in the "Address Map" tab in platform designer showing the full address map of the connected peripherals to each of the instruction and data masters on the Nios II. I don't quite understand how the BOOT RAM fits into your system here.
Are you configuring your BSP for this application that you're trying to download with the "Allow code at reset" option enabled in the BSP editor? Or are you just trying to compile the program that would load and execute in your RAM at 0x20000?
Can you provide a screen shot of your BSP Linker Script tap that show how the software sections are mapping into your memory regions?
The error that you're getting basically means that the code downloader attempted to write the data from your program into the target memory and then it read it back to verify the contents and the read back does not match what it wrote in originally. This can be caused by various hardware or BSP misconfigurations which is why I'd like to see the screen shots that I requested above.
If you'd like to simply test your hardware configuration, you could create some test images that you can download to the target where you fill a few test files with 8K, 32K, 64K and 128K of data for instance. That could give you confidence that your hardware is configured and working properly and point towards a BSP configuration issue. Or it could identify that your hardware is not operating correctly.
Here's an AI description on how to create a Random ELF file that you could use to load the Nios II memory with nios2-download:
To create a Nios II ELF file with a specific 128KB loadable section filled with random data at address 0x20000, you need to generate the raw random binary data, link it using a custom linker script, and compile it using the Nios II toolchain.
1. Generate the Random Data Binary
First, create a raw binary file containing exactly 128KB of random data.
bash
dd if=/dev/urandom of=random_data.bin bs=1k count=128
Use code with caution.
2. Create the Custom Linker Script
Create a text file named linker.ld. This script defines the target memory address and forces the random data into a loadable section.
linker
MEMORY
{
/* Define the target memory region */
random_mem : ORIGIN = 0x20000, LENGTH = 128K
}
SECTIONS
{
/* Create a loadable section named .random_section */
.random_section :
{
KEEP(*(.data))
} > random_mem
}
Use code with caution.
3. Convert the Binary to an Object File
Use the Nios II binary utility tool to wrap your raw binary into an object file (.o). This flags the data so the linker can recognize it.
bash
nios2-elf-objcopy -I binary -O elf32-nios2 \
--rename-section .data=.random_section \
random_data.bin random_data.o
Use code with caution.
4. Link into the Final ELF File
Link the object file using your custom linker script to output the final ELF executable.
bash
nios2-elf-ld -T linker.ld random_data.o -o random_data.elf
Use code with caution.
5. Verify the ELF File
You can verify that the section was created correctly, has the right size, and is marked as loadable (LOAD).
bash
nios2-elf-objdump -h random_data.elf
Use code with caution.
Look for .random_section in the output. It should show a size of 00020000 (128KB), a VMA/LMA of 00020000, and the flags CONTENTS, ALLOC, LOAD, DATA.