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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

assemble under nios2

Altera_Forum
Honored Contributor II
1,158 Views

Hi all, 

i write a program under nios2 using assemble lanauge, following is the source code 

# include <linux/module.h># include <linux/kernel.h> 

 

void print(void) 

printk("function print\n");  

 

typedef void(*pointer)(void); 

 

ulong code[3]; 

 

void jump(void) 

__asm__("movia r12, print"); 

__asm__("jmp r12"); 

 

int __init init_filter(void) 

jump(); 

 

void __exit exit_filter(void) 

 

module_init(init_filter); 

module_exit(exit_filter); 

 

this can work well, but if i change the function init_filter as bellow, the system will reboot,  

int __init init_filter(void) 

pointer p; 

code[0]=0x03000034; 

code[1]=0x63000004; 

code[2]=0x6000683a; 

 

p = (pointer)code; 

p(); 

 

code[0]~code[2] is the hex value that i get from nios2-elf-objdump according to two assemble sentences. 

 

how should i do? 

thanks a lot
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
412 Views
0 Kudos
Reply