Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
244 Views

Problem with converting files

Hi! I need to create double buffer in my NIOS II project. I did it as follow:

static const uint32_t image_width = 768;
static const uint32_t image_height = 576;
typedef uint32_t gui_frame_t[image_width * image_height];
gui_frame_t __attribute__ ((section (".video_buffer"))) gui_frames[2];

This buffer have to locate in the DDR memory. I created a new linker section for that with following settings:

BSP_Editor_Linker_Script.png

Also I added NOLOAD directive for this section to the linker.x file.

.video_buffer (NOLOAD) :
{
	PROVIDE (_alt_partition_video_buffer_start = ABSOLUTE(.));
	*(.video_buffer .video_buffer.*)
	. = ALIGN(4);
	PROVIDE (_alt_partition_video_buffer_end = ABSOLUTE(.));
} > ddr2_controller_top

After compiling the project I got an elf file of a fairly large size.

elf_size.png

I got more detailed information about elf file section using readelf utility.

readelf_S.png

I was planning to use memcpy-based boot copier to load NIOS II application to DDR memory. I tried to convert elf file to ihex file using following bash script.

#! /bin/sh
# $1 - Path to *.sof
# $2 - Path to *.elf
sof2flash --input $1 --output hw.flash --epcq128 --verbose
elf2flash --input $2 --output sw.flash --epcs -A hw.flash --verbose
nios2-elf-objcopy -I srec -O ihex sw.flash sw.hex

I was confused by the size of hex file.

ls_ahl.png

 

Then I tried to convert my .sof and .hex file to .jic, I got a problem. The problem was that size of files in EPCQ128A exeeded memory capacity.

 

problem.png

The image below describes settings for files conversion

Converting_programming_file.png

 How to avoid space allocation in hex file for .video_buffer section? Why for the section .bss is not allocated additional space in the hex file?

 

0 Kudos
6 Replies
Highlighted
Employee
177 Views

Hello, sorry for the late response


We are trying to debug your issue but we need some files.


Can you share with us your Sopcinfo and your Qsys? To do more debug on this.


Thanks.


0 Kudos
Highlighted
Employee
173 Views

Hello RSher11,

 

I'm looking into your issue.

 

You can try these next steps and tell me what's happen?

 

1) add a new region called .video_buffer and assign it to the emif linker region / memory device name (they have already done this)

2) in the lower section of the window: Linker Memory Regions, click Add and give the name of the new region video_buffer with a memory device name set to emif

3) adjust the size of the original emif (I reduced it in half) and set the video buffer depth to half of what I had available

4) after building the bsp, and writing a simple hello_world program to intialize the video buffer and print it out, my elf size is approx 6KB

Isaac_V_Intel_0-1595879919592.png

 

 

Best regards.

 

0 Kudos
Highlighted
Beginner
145 Views

Hello, Isaac_V_Intel,

Sorry for the late response. I tried to create small test project on your recommendation. It worked. But when I tried to use your solution in my working project I got that issue again.

I attached some additional information about program size for my test and working project respectively.

Info: (my_project.elf) 3548 KBytes program size (code + initialized data).
Info:                  65436 KBytes free for stack + heap.
Info: (my_project.elf) 13386 KBytes program size (code + initialized data).
Info:                  63801 KBytes free for stack + heap.
0 Kudos
Highlighted
Employee
107 Views

Hello,


One question how did you declare your video buffer?


0 Kudos
Highlighted
Employee
85 Views

Hello, did you find the solution or you still have the issue?


Regards.


0 Kudos
Highlighted
Beginner
64 Views

Hello,

I described video buffer creation process in my first post in this thread.

And I still have the issue and I try to solve it. I have one decision to allocate video buffer in the heap using malloc() without any additional sections.

 

 

0 Kudos