Discussion Forum

Handling multiple L15 warning in single Overlay

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
R R
Posted
17-Feb-2011 11:37 GMT
Toolset
C51
New! Handling multiple L15 warning in single Overlay

Hi,

I have multiple L15 link warning (MULTIPLE CALL TO SEGMENT).

Referred to:

http://www.keil.com/support/docs/805.htm and fixed one. But how do i fix the rest.

When I use the OVERLAY command in a linker control file, or directly under BL51 Misc, I am not able to add more than one. I tried comma, semi-colon etc but nothing works.

How do I use the command - OVERLAY (sfname ! *), for multiple functions that I need to remove from overlay.

Thanks

Regards,
R

Read-Only
Author
erik malund
Posted
17-Feb-2011 13:47 GMT
Toolset
C51
New! assembler files?

if so, you can do it inside multiple souce files
why not use optimize 2

Erik

Read-Only
Author
R R
Posted
18-Feb-2011 08:14 GMT
Toolset
C51
New! RE: assembler files?

Hi,

Thanks for the reply.

I am referring to C codes. I get multiple warnings like below:

***WARNING L15: MULTIPLE CALL TO SEGMENT
SEGMENT: ?PR?_WRITE_GMVLX1_REG?D_GMVLX1
CALLER1: ?PR?VSYNC_INTERRUPT?MAIN
CALLER2: ?C_C51STARTUP

***WARNING L15: MULTIPLE CALL TO SEGMENT
SEGMENT: ?PR?_SPI_SEND_WORD?D_SPI
CALLER1: ?PR?VSYNC_INTERRUPT?MAIN
CALLER2: ?C_C51STARTUP

***WARNING L15: MULTIPLE CALL TO SEGMENT
SEGMENT: ?PR?SPI_RECEIVE_WORD?D_SPI
CALLER1: ?PR?VSYNC_INTERRUPT?MAIN
CALLER2: ?C_C51STARTUP

So I need to overlay all the 3 functions (all called in background potentially by radio interrupt)

It is very clear to me when you say "inside multiple source files". Can you explain further.

Also I need to use Optimize 8 to achieve my size target.

Thanks
R

Read-Only
Author
Andrew Neil
Posted
18-Feb-2011 08:57 GMT
Toolset
C51
New! Cure the root cause instead of the symptoms?

In C51, calling functions from both main (or "startup", as the Linker sees it) & interrupts is best avoided.

Do you really need to do this?

Read-Only
Author
Per Westermark
Posted
18-Feb-2011 09:14 GMT
Toolset
C51
New! RE: Cure the root cause instead of the symptoms?

Overlays and interrupts are not something you would like.

Just as calling a function both from main() and from an ISR.

All functions called from an ISR really should be available at all times. And you can make duplicate copies of functions that you really do need to call from an ISR. So one do_xx() and one do_xx_from_isr(). Then you can have the do_xx_from_isr() together with the ISR make use of a separate register bank. And the compiler/linker will not have to try to figure out how any local variables upgraded into constantly reused global variables will be accessed by the ISR.

Read-Only
Author
erik malund
Posted
18-Feb-2011 13:42 GMT
Toolset
C51
New! possible, yes ... but

Calling functions (marked reentrant) from both main and its children and an ISR is possible, yes ... but I guess that doing so is asking for something that will take an awful lot of thought to believe safe as well as, most likely, causing a "dumb little nagging very rarely occurring bug".

I have had experiences with the result of this (done by others) and have thus established a "personal rule": "functions may under no circumstances be called from main and ISR".

Erik

Read-Only
Author
Per Westermark
Posted
18-Feb-2011 14:01 GMT
Toolset
C51
New! RE: possible, yes ... but

With assembler code, the coder can see all code and know what happens.

With C code and the C compiler needing helper functions and playing around with auto variables upgraded to global variables, it really isn't obvious what happens when having an 8051 function shared between ISR and main loop. So best to avoid it.

Read-Only
Author
erik malund
Posted
18-Feb-2011 14:28 GMT
Toolset
C51
New! see - yes, know - no

With assembler code, the coder can see all code and know what happens.
actually one of the cases I mentioned above was written in asssembler.

Erik

Next Thread | Thread List | Previous Thread Start a Thread | Settings