EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

RAM function calling FLASH function WARNING, Crossworks

Started by Jan Vanek October 14, 2008
Hi forum,

is there a way to obtain a warning when a function marked to reside in RAM (.fast_run) calls a non-marked function residing in FLASH (which the compiler does not inline)?

Thanks,
Jan


An Engineer's Guide to the LPC2100 Series

> is there a way to obtain a warning when a function marked to reside in RAM
> (.fast_run) calls a non-marked function residing in FLASH (which the
compiler
> does not inline)?

No. Whilst "possible" and I can see your situation, it won't happen in
general.

Perhaps the best you can do, on an LPC, is compile with long calls disabled
because then you get an error if you call from RAM to FLASH or FLASH to RAM.
If you compile a *single* file with long calls enabled, to allow you to get
from FLASH to RAM, and all other files with long calls off will cause an
error using cross-memory-space references because the shorter BL fixup can't
span the distance between flash and RAM.

Hope that helps.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors

Hi Paul,

thanks for reply. My code is mostly in header files (C++) so I can't really enable/disable long calls selectively. But I have experimentally verified I call no FLASH function from my RAM functions (flash programming). I needed it to implement "lcd-backlight" by driving given pin low/high repeatedly in timer. This timer IRQ can't be called when programming the flash, so I manually call "a callback", which must be in RAM. It works OK. If I don't call the callback and I don't disable the IRQ during flash-programming, it doesn't work, the backlight is either 100% off or 100% on. So this time the LPC288x docu is correct, the CPU is really stalled when trying to access the FLASH during programming; and I can verify it works fine.

Also thanks for fast Crossworks startup, I need to frequently close it and reopen during testing.

With regards,
Jan

----- Original Message -----
From: Paul Curtis
To: l...
Sent: Tuesday, October 14, 2008 10:02 PM
Subject: RE: [lpc2000] RAM function calling FLASH function WARNING, Crossworks

> is there a way to obtain a warning when a function marked to reside in RAM
> (.fast_run) calls a non-marked function residing in FLASH (which the
compiler
> does not inline)?

No. Whilst "possible" and I can see your situation, it won't happen in
general.

Perhaps the best you can do, on an LPC, is compile with long calls disabled
because then you get an error if you call from RAM to FLASH or FLASH to RAM.
If you compile a *single* file with long calls enabled, to allow you to get
from FLASH to RAM, and all other files with long calls off will cause an
error using cross-memory-space references because the shorter BL fixup can't
span the distance between flash and RAM.

Hope that helps.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors

#ygrp-mkp { BORDER-RIGHT: #d8d8d8 1px solid; PADDING-RIGHT: 14px; BORDER-TOP: #d8d8d8 1px solid; PADDING-LEFT: 14px; PADDING-BOTTOM: 0px; MARGIN: 14px 0px; BORDER-LEFT: #d8d8d8 1px solid; PADDING-TOP: 0px; BORDER-BOTTOM: #d8d8d8 1px solid; FONT-FAMILY: Arial}#ygrp-mkp HR { BORDER-RIGHT: #d8d8d8 1px solid; BORDER-TOP: #d8d8d8 1px solid; BORDER-LEFT: #d8d8d8 1px solid; BORDER-BOTTOM: #d8d8d8 1px solid}#ygrp-mkp #hd { FONT-WEIGHT: bold; FONT-SIZE: 85%; MARGIN: 10px 0px; COLOR: #628c2a; LINE-HEIGHT: 122%}#ygrp-mkp #ads { MARGIN-BOTTOM: 10px}#ygrp-mkp .ad { PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px}#ygrp-mkp .ad A { COLOR: #0000ff; TEXT-DECORATION: none}



The 2024 Embedded Online Conference