We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
using this assembler function in my c-code, I will get a warning message from the keil µvision compiler (warning: A1581W: added 2 bytes of padding at address 0xe)
__asm void jump_to_application(void) { ; program stack pointer of application LDR R0, =0x10000 LDR SP, [R0] ; extract entry point into application LDR R0, =0x10004 ; jump LDR PC, [R0] }
Which steps do I have to add to solve this warning message?
best regards Lars
Add a NOP, relates to the alignment of the literal pool at the end of the code.
Hey there, quick question regarding NOP. What is it? I'm very new to this so sorry if it's a simplisitc question. I'm getting this error right now but it's for a line with this code: "AREA CUBE_lut, DATA, READWRITE", but it's at the end where I'm calling in some numbers. Any suggestions? It's supposedly indented properly and everything but seems like it's causing this warning.
This warning is telling you that the assembler is doing something that you did not specifically instruct it to do, but is likely going to be very helpful to you. Probably asking the assembler to specifically do what it is doing is the best way to remove the warning. You want to add the ALIGN keyword to the AREA directive. The Assembler aligning your data to a 4 byte boundary. To officially ask it to align to a 4 byte boundary, add the ALIGN=2 to the AREA directive. Often AREA's are aligned to 8-byte boundary with ALIGN=3 and I would suggest you do this unless you specially understand why you would want to make it different.
AREA CUBE_lut, DATA, READWRITE, ALIGN=2
Jimmy said:It's supposedly indented properly
The "padding" mentioned is bytes in the generated code - it has nothing to do with indentation of the source text.
Some Assembler references mentioned here:
https://community.arm.com/developer/tools-software/tools/f/keil-forum/44110/can-i-code-stm32f103rbt6-into-assembly-langauage-rather-than-c-or-c/160087#160087
Thanks for the help it removed the warning.
Thank you for the link