give you the answer that why using "PRESERVE8" in startup code
来源:互联网 发布:可变数据喷码机 编辑:程序博客网 时间:2024/06/06 17:32
refer: http://www.keil.com/forum/17485/
http://www.keil.com/support/docs/3268.htm
blow is the detail:
ARMLINK: WARNING: L6306W: '~PRES8' SECTION SHOULD NOT USE 'REQ8'
QUESTION
I have written an interrupt handler in assembly language using the RealView assembler. In this interrupt handler, I am calling another routine that is written in C. When I link my program, I receive the following warning:
Warning: L6306W: '~PRES8' section arm_isr.o(asm_irq) should not use the address of 'REQ8' function (c_func).
What is wrong?
ANSWER
All C code generated by the RealView compiler assumes that stack allocation is aligned on 8-byte boundaries.You must ensure that the assembler interrupt handler has an 8-byte aligned stack by specifying the PRESERVE8 directive at the beginning of your assembly file. For example,
PRESERVE8.. AREA irq_asm, CODE, READONLY
another one
Hello,
I use the NXP LPC 2368 and want to write a function to save the exceptions Data Abort Error, Undefined Instruction Error and Pre-fetch Abort Error in a seriel EEPROM and after reset the CPU.
How can I overwrite the dummy exception handler Undef_Handler, PAbt_Handler and DAbt_Handler with C code?
I found the technical support:
http://www.keil.com/support/docs/3027.htm
If I write the irq-functions there is no warning and no error so far so good. But if I test the irq the PC stuck always in the dummy function in startup and not in my own function!
Somebody have a idea?
If your handler is called ProgramAbortHandler(), then
in your startup file find
PAbt_Addr DCD PAbt_Handler
and replace it with
PAbt_Addr DCD ProgramAbortHandler
Thanks for the tip. But now the Compiler Error:
"system\LPC2300.s(615): error: A1516E: Bad symbol 'ProgramAbortHandler', not defined or external"
comes.
Here my Code:
Startup-File
; Exception Vectors; Mapped to Address 0.; Absolute addressing mode must be used.; Dummy Handlers are implemented as infinite loops which can be modified.Vectors LDR PC, Reset_Addr LDR PC, Undef_Addr LDR PC, SWI_Addr LDR PC, PAbt_Addr LDR PC, DAbt_Addr NOP ; Reserved Vector; LDR PC, IRQ_Addr LDR PC, [PC, #-0x0120] ; Vector from VicVectAddr LDR PC, FIQ_AddrReset_Addr DCD Reset_HandlerUndef_Addr DCD Undef_HandlerSWI_Addr DCD SWI_HandlerPAbt_Addr DCD ProgramAbortHandlerDAbt_Addr DCD DAbt_Handler DCD 0 ; Reserved AddressIRQ_Addr DCD IRQ_HandlerFIQ_Addr DCD FIQ_Handler IMPORT SWI_HandlerUndef_Handler B Undef_Handler;SWI_Handler B SWI_Handler;Don't need the dummy PAbt handler;PAbt_Handler B PAbt_HandlerDAbt_Handler B DAbt_HandlerIRQ_Handler B IRQ_HandlerFIQ_Handler B FIQ_Handler
File irq.c
void ProgramAbortHandler(void) __irq{ // For Test while(1);}
I think I have to declare the function because it is defined in another file. How can I do this in Assembler? Thanks
Add the following line to the startup before referencing your function:
IMPORT ProgramAbortHandler
Just add
IMPORT IntSPI_isr
at the beginning of your startup file and i think that would be it :)
I write too slowly :)
And the answer above is better than mine, because I used the name of my own handler :D
Thank you very much for the help. The startup assembler is very hard to understand for me. The solution above works! But now I get a warning (after the linking process):
Warning: L6306W: '~PRES8' section lpc2300.o(RESET) should not use the address of 'REQ8' function ProgramAbortHandler. In the technical Support I read this: http://www.keil.com/support/docs/3268.htm
So what I did was PRESERVE8 put in the first line of my start up code. But after i get a compiler error:
error: A1355U: A Label was found which was in no AREA
Now the Joke of the Day: The label is the PRESERVE8 comand! First I think I wrote wrong. But I copy and paste it of the technical support document!
So the solution of the technical support is not the best way. Anybody know why there is a linker-warning and how I can solve it?
Like all directives in asm, the PRESERVE8 needs to have some whitespace before it. If it starts in column 1 then it's a label and not a directive.
Hello,
thank you very much for the fast help. After I insert a space before the asm PRESERVE8 everything works fine! I am sorry for my lack of knowledge.
So I wrote now Exception Handlers for the PAbt, DAbt and Undef Instructions.
I use the RTX OS so I additinal check for the stack overflow and wrote my own os_stk_overflow function.
Somebody know further exceptions so I can handle? If no so I thank again very much for the good help.
- give you the answer that why using "PRESERVE8" in startup code
- Ten sentences that will give you courage
- T-CODE that exists in the SAP
- Why Is the Network in Ubuntu That Slow!!
- Error Code : 1064 You have an error in your SQL syntax; check the manual that corresponds to your My
- what you like most in the city,why?
- Why are the letters in the English "alphabet" in the order that they are?
- Why in the code “456”+1, output is “56”
- The proof is in the code. That is all.
- An issue that you may encounter in the future
- What does the Container give you?
- That's why(you go away)!
- that's why you go away
- that's why you go away(song)
- That's why you go away
- 91.View the Exhibit to examine the error that occurred during the database startup. You opened an RM
- why you crashed in objc_msgSend()
- 创建存储过程错误(已解决):Error Code : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ver
- 判断上传文件是否是图片格式
- Python安装模块出错(ImportError: No module named setuptools)解决方法
- Linux内核中CPU主频和电压调整 (二)
- 计算机视觉与模式识别研究组--上海交大
- FCKeditor上传路径从绝对路径改成相对路径的方法 .
- give you the answer that why using "PRESERVE8" in startup code
- 电阻技术触摸屏的校正算法及应用编程设计(转)
- 在smarty中加入自定义的常量格式的方法 .
- 函数名、变量前后的_(一个下划线)、__(两个下划线)分别有什么用
- 名企招聘经典面试编程题集锦[第41-50题]
- 第二周C++上机报告(有序的结构体数组)
- 在Struts2中的Aware接口
- Hibernate中Clob字段的使用
- 判断一个数是否为素数