Keil Logo

BL51: Error L107 (Address Space Overflow)with inline ASM


Information in this article applies to:

  • BL51 All Versions

QUESTION

I want to use inline assembly code in a large C module. When I add a single line of assembly code and set the Generate Assembler SRC File and Assemble SRC File options for the C module, I receive the following linker error message:

*** ERROR L107: ADDRESS SPACE OVERFLOW
    SPACE:   XDATA
    SEGMENT: ?XD?MY_FUNCTION?MAIN
    LENGTH:  0018H

The inline assembly should only increase my code size by 2 bytes and shouldn't affect XDATA at all. Why do I get this error?

ANSWER

Your XDATA variables are not overlaying. When you use assembly source files, the linker requires at least one C source file in your project that is directly compiled into an object file to enable data overlaying. This can be an empty C source file.

The preferred way to do this is to move the functions that require inline assembly to a separate C module, then create an assembly SRC file from that. The C module that contains no inline code satisfies the C module requirement and separating the inline functions into an "inline" module helps document what you've done.

MORE INFORMATION

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.