View previous topic :: View next topic |
Author |
Message |
Matro Guest
|
Why is there a missing block in the .lst file? |
Posted: Wed Mar 19, 2008 6:33 am |
|
|
Hi everybody,
A strange thing happens when I compile my code.
The whole ASM code corresponding to the "write_program_memory()" function doesn't appear in the ".lst" file.
The memory area seems to be reserved but nowhere is the generated ASM.
The code seems present in the hex file too.
It's really a problem to look for bugs.
Is that normal? Or a bug of the compiler? Or something else?...
I use CCS 4.069.
Thanks for your answers.
Matro. |
|
|
Ttelmah Guest
|
|
Posted: Wed Mar 19, 2008 7:54 am |
|
|
At the top of the include file for your processor, there will be a line '#nolist'. Simply remove this line, or use // to 'remark' it out.
With this present, assembler will not be shown for any of the internal functions (arithmetic, I/O etc.).
It makes it simpler to see the assembler for _your_ code, but leaves these odd 'holes'.
Best Wishes |
|
|
Matro Guest
|
|
Posted: Wed Mar 19, 2008 8:01 am |
|
|
Hi Ttelmah,
Once again your help is very appreciated because accuracy & efficiency. ;-)
Simply what I need. Exactly!
Thanks a lot. And maybe see you soon. :-D
Matro. |
|
|
Matro Guest
|
|
Posted: Wed Mar 19, 2008 8:11 am |
|
|
Actually I've another question following the last one.
My problem is that I need to place a bootloader in a specific memory area.
This part is OK.
And the bootloader uses of course the built-in "write_program_memory()".
Here comes the problem. This built-in function uses itself a function that it calls. But this sub-function is placed anywhere in memory by the compiler. And of course at a location where the bootloader overwrite it.
The #ORG of the bootloader function seems not to be sufficient and I can't find nowhere a way for "forcing" the memory location of this sub-function.
Is there a way to do so?
Hoping the explanation was OK.
Thanks in advance,
Matro. |
|
|
Ttelmah Guest
|
|
Posted: Wed Mar 19, 2008 9:34 am |
|
|
Look at the keyword 'default' for the #org statement.
Without this, the defined range will only be used for your code, not the cmpiler 'default' functions.
Best Wishes |
|
|
Matro Guest
|
|
Posted: Thu Mar 20, 2008 2:40 am |
|
|
Hi Ttelmah,
your tip sounded ok but I tried it and unfortunately it didn't solve the problem.
This behavior of the compiler is very embarrassing.
Thanks again for your help.
Matro. |
|
|
Ttelmah Guest
|
|
Posted: Thu Mar 20, 2008 4:05 am |
|
|
What syntax are you using?.
You do realise, you have to declare the memory area you want to use, and add the 'default' to the same statement?.
The way it works:
#org start,end
Puts the next routine into the specified area.
#org start,end DEFAULT
Puts the next routine _including internal compiler routines_, into the specified range.
#org DEFAULT
Turns this off.
The version with default included, definately works.
Best Wishes |
|
|
Matro Guest
|
|
Posted: Thu Mar 20, 2008 4:43 am |
|
|
I did so,but it didn't work.
I will try to provide a sample code for demonstrating.
Matro. |
|
|
Matro Guest
|
|
Posted: Thu Mar 20, 2008 5:06 am |
|
|
The following code demonstrates the problem:
Code: |
#include <16F88.h>
#use delay(clock=8000000)
#INLINE
void bootloader()
{
int dataBuff[8];
int i;
for(i=0;i<8;i++)
dataBuff[i] = i;
write_program_memory(0x020,dataBuff,8);
}
#ORG 0xE00,0xFFF DEFAULT
void test_bootloader()
{
if(input(PIN_A0) == 1)
bootloader();
}
#ORG default
void main()
{
test_bootloader();
}
|
It appears only if the bootloader() function is coded separately and declared as #INLINE.
If it is directly coded in the test_bootloader() function, the tip you previously gave works fine.
CCS bug or feature?
Matro. |
|
|
Ttelmah Guest
|
|
Posted: Thu Mar 20, 2008 5:33 am |
|
|
Feature.....
You are declaring 'bootloader', before you change the default declarations. Though 'bootloader' itself will go 'inline', and therefore be inside the declared area, anything it calls, won't be put in the area. If you want the bootloader functions to be at a specific address, _it_ needs to have a default declaration before it.
You can (for instance), declare a different memory area, with the default option, and still declare bootloader as 'inline'. Bootloader will be put in the second declared area as 'inline', while the system calls it makes wil be put in the area declared before the bootloader.
Best Wishes |
|
|
Matro Guest
|
|
Posted: Thu Mar 20, 2008 6:20 am |
|
|
OK. Thanks for that.
The problem has actually been solved by writing my own "write_program_memory()" and it save a lot of space because I adapted it to my needs. ;-)
Thanks for all tips and advices.
See you.
Matro. |
|
|
|