Forum Discussion
how can i tell the IDE to carry code to TCM
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 ret24 Replies
- Altera_Forum
Honored Contributor
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
Honored Contributor
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
Honored Contributor
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
Honored Contributor
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
Honored Contributor
Could you show us your SOPC system with all the connections?
- Altera_Forum
Honored Contributor
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
Honored Contributor
You can take a screenshot of SOPC Builder and attach it to your reply on the forum
- Altera_Forum
Honored Contributor
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
Honored Contributor
- Altera_Forum
Honored Contributor
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?