Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12745 Diskussionen

how can i tell the IDE to carry code to TCM

Altera_Forum
Geehrter Beitragender II
5.249Aufrufe

i write a program with assembly instruction,i want this program can be excuted in tightly coupled memory,but when i debug ,this code is not in the TCM,my TCM name is “onchipmemory",my program is follow: 

 

start: nop 

call test_code 

br start 

 

.section .onchipmemory 

test_code: 

addi sp,sp,-4 

stw ra,0(sp) 

 

movi r2,0x99 

movi r3,0xaa 

mul r2,r2,r3 

 

ldw ra,o(sp) 

addi sp,sp,4 

ret
0 Kudos
24 Antworten
Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

:mad: No one can answer this question?

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

Did you try.section onchipmemory instead? Or have a look at the linker script, to find out what name it gave to your section.

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

thank you,i am glad to try it again

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

i tried in different way,but still can't seen the objectcode carried to the TCM,if anyone know how to do this with assembly instruction please tell me,thank you very much!

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

I have delayed this issue two weeks, please help me, thank you!:mad:

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

what does your linker script look like? In what section is your code put by the linker?

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

i can't see and edit the linker file,the file is created by the IDE automatically,can you tell me how to see and edit the linker file? thank you!

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

If you are using the IDE, it is in your system library > Debug > system_description > generated.x

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

TO_BE_DONE

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

From what I can read in the linker script, you don't have any section called onchip_memory. You have instruction_onchipmemory (address 0x08000000) and onchip_memory2_0 (address 0x04000000). 

One of those should be your TCM memory. Use its name as section name, without the . in front, and see if it works.
Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

the instruction_onchipmemory (address 0x08000000) is sure my TCM, the IDE also crectly compilated my instructions and asign the code address at the TCM zone, but when i debug the IDE din't exicute the download action to the TCM,it only download the program to de extern sram. if i use the instruction_onchipmemory as the section name without dot front of it ,the IDE would asign a increct address to the TCM section.

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

the IDE can crectly compilated and download the program to the SRAM and TCM if the program is writen by C, or the section of TCM code is writen by c but called by the assembly main function, but when i develope my program with pure assembly instruction the IDE can't exicute the download action to the TCM,i don't know why and how to solve the problem.

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

That's odd... As long as the object file generated from your assembly source code is included in the project and linked with the rest there shouldn't be any difference between an assembly function and a C function... 

I expect that you used a dual port memory with one port connected to the TCM interface and the other on the data master? Do they have both the same address? Did you try to switch the two ports? IIRC I had some trouble when the TCM interface was connected to the s2 port on the on-chip memory. Connecting it to s1 worked better. Something to do with how the BSP tools parse the ptf file, I guess.
Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

I recreated a hardware project to test the TCM,i wrote the program with pure assembly instruction and encount a new problem:when the IDE complete dowloading the code to SRAM and TCM ,I found that the instruction code is not be download to the TCM successfully,the data in the TCM zone is not be changed at all! is it the problem of IDE? is it the problem of my hardware project? is it the problem of my simple assembly instruction program? if anyone know what the problem is ,please tell me,thanks! 

 

in my hardware project my TCM's name is instruction_onchipmemory,the folowing is my testing assembly instruction program: 

 

.global main 

.type main, @function 

main: addi sp, sp,-12 

stw ra, 8(sp) 

stw fp, 4(sp) 

mov fp, sp 

loop: call tcm_test 

br loop 

 

//the folowing instruction will be executed in tightly coupled memory  

// the tightly coupled memory's name is instruction_onchipmemory  

 

.section .instruction_onchipmemory 

 

tcm_test: addi sp, sp,-4 

stw ra, 0(sp) 

movi r2,0x123 

movi r3,0x345 

mul r2,r2,r3 

mov r4,r2 

ldw ra,0(sp) 

addi sp,sp,4  

ret
Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

Could you show us your SOPC system with all the connections?

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

How to connections sent to you? I sent you the picture on the connect, or files? By e-mail sent to you or in the forum reply? 

 

thanks
Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

You can take a screenshot of SOPC Builder and attach it to your reply on the forum

Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

http://b26.photo.store.qq.com/http_imgload.cgi?/rurl4_b=1fd7dc8eb6dd34c3d4238916da522f6bc30e4987fd979528f0f7ffcf67199886be7db29724814d6ce0d317840f65a5a333c354cef75385f4881485ffa03c8f7ae324742b17668c7f99b47ac63567f0d281c0da3d&a=26&b=26  

 

it's my partion of connections in sopc builder . Now, the problem is that the c code can work well with tcm, but the program with assembly instruction can not work.
Altera_Forum
Geehrter Beitragender II
1.974Aufrufe

:p pdf file sent to you . thanks

Altera_Forum
Geehrter Beitragender II
1.895Aufrufe

The SOPC system looks good, and as far as I can tell the call assembly instruction uses a 28-bit address, so it should be able to jump to the TCM. I can find any reason for your problem... 

 

It could be something with the way the compiler/linker processes assembly files. 

What if you try to put a C function in the TCM, but use an asm() block inside?
Antworten