⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.txt

📁 ALTERA的NIOS处理器!文件直接可以打开直接选择器件重新编译!
💻 TXT
字号:
readme.txt - How to use the -mflat compiler option and librarys

What is MFLAT?
--------------

The Nios GNU tools and libraries now include an mflat option to 
generate code that works with a flat (non-windowing) register file.

When this option is used, the compiler:

    Saves registers to the stack on function calls, instead of
    issuing the SAVE instrction to advance the CWP.

    Restores registers from the stack on fuction returns,
    instead of issuing the RESTORE instrction to decrement
    the CWP.

How to Use MFLAT?
-----------------

The Makefile in this directory demonstrates how to compile and 
link a 32 bit Nios program using the mflat option and libraries.

The nios sdk library must also be recompiled with the mflat 
option.  This can be done by changing the file:

    *sdk/lib/Makefile

The line:

        CCFlags = -g -c -O2 -mno-zero-extend -m$(M) -I ../inc \

should be replaced with the line:

        CCFlags = -g -c -O2 -mno-zero-extend -m$(M) -I ../inc -mflat\

You should also disable the installation of the CWP manager.  This can
also be done by modifying the excalibur.h and excalibur.s files

For excalibur.s, change:
	.equ __nios_use_cwpmgr__       , 1 ; Handle register window underflows 
To:
	.equ __nios_use_cwpmgr__       , 0 ; Handle register window underflows 

For excalibur.h, change:
	#define __nios_use_cwpmgr__       1 // Handle register window underflows 
To:
	#define __nios_use_cwpmgr__       0 // Handle register window underflows 

Then run "make" in the *sdk/lib directory

Some assembly routines in the nios sdk library use SAVE and RESTORE
instructions.  These routines should be avoided or rewritten to save 
and restore the registers they corrupt to/from the stack.

These include:
    The Nios GDB stub
    The Nios profiler (gprof)
    nr_longjmp
    nr_uart_txcr
    nr_uart_txhex[16,32]
    nr_uart_txstring

The isr manager (nios_isrmanager.s) has been rewritten to work with MFLAT,
and is included in this directory, and should copied to the *sdk/lib
directory and rebuilt with the Makefile there.  

What about interrupts with MFLAT?
---------------------------------

The Nios itself advances the CWP on an interrupt, so appications that use
interrupts will not run in with a truely flat register model.  However,
the nios_isrmanager.s included in this directory saves the required
registers on the stack and restores the CWP to its original location
before calling the user installed ISR, so ISRs which use this manager
will run in a flat register model.

If you do not not choose to use the included isr manager, each interrupt
will advance the CWP, and operate in a new register window.  If nested
interrupts are allowed (by enabling interrupts inside an ISR), it is
possible for the CWP to overflow.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -