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.
Hello.
I have a bootloader that use F0 flag to indicate if the bootloader is executing (F0 = 1) or if the application is executing (F0 = 0).
But some Keil library functions modify this flag (float division, 32-bits signed long division, etc).
Somebody can help me with the full list of functions that modify this flag?
I cannnot modify the bootloader because the product is just in production (and sold out).
You definitely need to contact Keil support direct for this to get a definitive answer!
Anything else is just hearsay, including: www.8052.com/.../read.phtml
http://www.keil.com/support/docs/2893.htm
The routines that are using F0 are:
This should be clearly stated in the Manual - it should not be left to users to "stumble" across this information in the knowledgebase or the forum!
Thanks. This can help me!
I use this flag (F0) to execute the ISR of the bootloader or the ISR of the application. I think that if I disable interrupts (with EA = 0) before executing these functions and then restore F0 flag and EA, it will work.
Also, I notice that flag F1 is forced to 0 in the entry-code of the ISRs.
I also think that this must be documented in the C compiler manual.
while this is raised in a Keil forum, I think this should be mentioned.
The F0 flag is, for every '51 toolset I know (and I know quite a few) "reserved for compiler use".
I have often suggested that F0 be used to indicate overflow on the return from arithmetic routines since this would not in any way upset current use that does not 'know' if overflow occurred and, at the same time, allow those using the revised versions to test this flag.
Erik
http://www.keil.com/support/man/docs/c51/c51_ap_regusage.htm
PSW includes F0 and it clearly states that this is used.
"PSW includes F0 and it clearly states that this is used."
Yes, but PSW also includes F1. The knowledgebase article suggests that user programs may use F1, but the experience cited here suggests otherwise...
Many 51 devices have also a F1 (PSW.1) flag. You may use it instead of F0.
erik
I have downloaded the last version of sdcc compiler. I have checked the source code of the libraries and, yes, they also use the FO flag in some math functions.
Oh! And I thank that use F0 was a good idea!
Javier
Viktor
The problem is that I cannot change the bootloader.
"Also, I notice that flag F1 is forced to 0 in the entry-code of the ISRs."
Standard ISR entry will clear the entire PSW, to guarantee BANK0 selection for the ISR handler. You may alter this by declaring different policies for banking. You may also circumvent this by declaring a ASM entry/exit handler that does the context saving/restore, preserving the user flags of PSW on entry for the ISR to check on them. Another, more dangerous approach, is to check the value of PSW pushed into the stack, but this is very sensitive.
I posted : "The F0 flag is, for every '51 toolset I know (and I know quite a few) "reserved for compiler use"." sdcc compiler .... they also use the FO not one of those I know, this just confirms the generality of "F0 is a compiler flag"