- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi
i am i am new to NIOS. I want to insert an asm code in C prog... In microcontroller prog..... i use# pragma... this command is not working in NIOS IDE. plz tell me in what way i can insert myLink Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by sriram_k@Mar 20 2007, 08:24 AM hi
i am i am new to nios. i want to insert an asm code in c prog...
in microcontroller prog..... i use# pragma...
this command is not working in nios ide. plz tell me in what way i can insert my
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=22362)
--- quote end ---
--- Quote End --- Have a try on the inline asm, which basically enable users to write assembly instructions directly. For example:
asm ("stw r0, 16(sp)");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by arrive+mar 20 2007, 04:13 pm--><div class='quotetop'>quote (arrive @ mar 20 2007, 04:13 pm)</div>
--- quote start ---
<!--quotebegin-sriram_k@Mar 20 2007, 08:24 AM hi
i am i am new to nios. i want to insert an asm code in c prog...
in microcontroller prog..... i use# pragma...
this command is not working in nios ide. plz tell me in what way i can insert my
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=22362)
--- quote end ---
--- Quote End --- Have a try on the inline asm, which basically enable users to write assembly instructions directly. For example:
asm ("stw r0, 16(sp)");
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=22365)</div> [/b] --- Quote End --- Just a small example: __asm__ __volatile__("mov r2, %0 \n\t" "mov r3, %1 \n\t" "ldw r4, 0(r2) \n\t" "stw r4, 312(r3) \n\t" : // No output needed ! :"r"(var_a),"r"(var_b) // Input :"r2","r3","r4" // used registers ); Have a look at http://homepage.fudan.edu.cn/%7eeuler/gcc_asm/inline-1.html (http://homepage.fudan.edu.cn/%7eeuler/gcc_asm/inline-1.html) Christian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
TO_BE_DONE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- originally posted by sriram_k+mar 21 2007, 12:13 pm--><div class='quotetop'>quote (sriram_k @ mar 21 2007, 12:13 pm)</div>
--- quote start ---
--- quote start ---
originally posted by christian_80@mar 21 2007, 03:45 am
--- quote start ---
originally posted by arrive@mar 20 2007, 04:13 pm
<!--quotebegin-sriram_k@Mar 20 2007, 08:24 AM hi
i am i am new to nios. i want to insert an asm code in c prog...
in microcontroller prog..... i use# pragma...
this command is not working in nios ide. plz tell me in what way i can insert my
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=22362)
--- quote end ---
--- Quote End --- Have a try on the inline asm, which basically enable users to write assembly instructions directly. For example:
asm ("stw r0, 16(sp)");
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=22365)</div> [/b] --- Quote End --- Just a small example: __asm__ __volatile__("mov r2, %0 \n\t" "mov r3, %1 \n\t" "ldw r4, 0(r2) \n\t" "stw r4, 312(r3) \n\t" : // No output needed ! :"r"(var_a),"r"(var_b) // Input :"r2","r3","r4" // used registers ); Have a look at http://homepage.fudan.edu.cn/%7eeuler/gcc_asm/inline-1.html (http://homepage.fudan.edu.cn/%7eeuler/gcc_asm/inline-1.html) Christian <div align='right'><{post_snapback}> (index.php?act=findpost&pid=22369)</div> [/b] --- Quote End --- thanks christian... its working fine.. also i found the link posted in group is very useful.. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif till now i was simulating the code in simulator only.... i had DE2 board... could u plz.. send me any link regarding the syntax in C code for nios processor to handle the I/O ports and all.... <div align='right'><{post_snapback}> (index.php?act=findpost&pid=22388)</div> [/b] --- Quote End --- Many information can be found in the Nios2 Software Developer Guide on altera.com A simple 32bit IO Component can be accessed by: IORD_32DIRECT(PERIPHERAL_NAME_BASE(defined in the SOPC Builder),OFFSET,VALUE) IRWR_32DIRECT(PERIPHERAL_NAME_BASE,VALUE) Christian
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page