Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] PICC-18 How to disable all optimisation

Status
Not open for further replies.

mrcube_ns

Advanced Member level 1
Joined
Apr 10, 2002
Messages
452
Helped
48
Reputation
96
Reaction score
34
Trophy points
1,308
Location
Europe
Activity points
3,813
Dear all,

I use PICC-18 v.9.66 with MPlab v8.10. I write code in MPlab and use external compiler PICC-18.


QUESTION:
How to disable all optimisation?



Thanks!!!


Mr.Cube
 

emresel

Full Member level 5
Joined
Feb 12, 2008
Messages
265
Helped
61
Reputation
122
Reaction score
61
Trophy points
1,308
Location
Turkiye
Activity points
2,842
you should use "--OPT=none" param in build options, to add this param from MPlab Project->BUld options->Global
 

bigdogguru

Administrator
Joined
Mar 12, 2010
Messages
9,831
Helped
2,349
Reputation
4,692
Reaction score
2,275
Trophy points
1,413
Location
Southwest, USA
Activity points
62,376
You may also want to update your MPLAB from v8.10 to v8.70, there has been many fixes since v8.10.
 

mrcube_ns

Advanced Member level 1
Joined
Apr 10, 2002
Messages
452
Helped
48
Reputation
96
Reaction score
34
Trophy points
1,308
Location
Europe
Activity points
3,813
You may also want to update your MPLAB from v8.10 to v8.70, there has been many fixes since v8.10.

Is there any difference which version of MPlab is used, isn't that just a editor which calls compiler?
Or I'm wrong?!?

Mr.Cube
 

emresel

Full Member level 5
Joined
Feb 12, 2008
Messages
265
Helped
61
Reputation
122
Reaction score
61
Trophy points
1,308
Location
Turkiye
Activity points
2,842
May be it is important if you want to simulate your code (seeing register space, ram space etc.) But i prefer to use Proteus for simulation and step by step debugging...
 

mrcube_ns

Advanced Member level 1
Joined
Apr 10, 2002
Messages
452
Helped
48
Reputation
96
Reaction score
34
Trophy points
1,308
Location
Europe
Activity points
3,813
But i prefer to use Proteus for simulation and step by step debugging

I prefer to use demo board, or even make final pcb, and then I test system in real conditions (on table).

I generally have problem with overlapping of strings in my code and I can't solve this.

I have 18f4550, with enough RAM memory, but compiler optimise code and overlap string over string (I do not know why), even I declared strings as static char rxBuff[200].


Maybe, killing optimisation will solve problem.....



Thanks!!!

Mr.Cube
 

bigdogguru

Administrator
Joined
Mar 12, 2010
Messages
9,831
Helped
2,349
Reputation
4,692
Reaction score
2,275
Trophy points
1,413
Location
Southwest, USA
Activity points
62,376
Yes, it an IDE which call the compiler. However, when the underlying compilers are updated then the IDE calling the compilers may require updating as well. Different compiler options, defaults, etc may need to be called.

Also some previous versions of MPLAB v8.x suffered from stability issues, possibly memory leaks. I was using v8.50 for quite a while, after many hours of coding it would sometimes abruptly close and exit, v8.70 seems quite a bit more stable, plus Hi-Tech has upgraded their compilers several times since v8.10 and PICC18 v9.66 is very recent.

Good Luck with Your Project,


BigDog
 

mrcube_ns

Advanced Member level 1
Joined
Apr 10, 2002
Messages
452
Helped
48
Reputation
96
Reaction score
34
Trophy points
1,308
Location
Europe
Activity points
3,813
It seems that everything works fine with oooold PICC-18 STD 9.51 version.

I cann't explain why, same code works only with old version and further more it's STD version.


Thanks a lot!!!!


Mr.Cube
 

bigdogguru

Administrator
Joined
Mar 12, 2010
Messages
9,831
Helped
2,349
Reputation
4,692
Reaction score
2,275
Trophy points
1,413
Location
Southwest, USA
Activity points
62,376
Does your code compile with or without errors using the newer version of the compiler?
 

mrcube_ns

Advanced Member level 1
Joined
Apr 10, 2002
Messages
452
Helped
48
Reputation
96
Reaction score
34
Trophy points
1,308
Location
Europe
Activity points
3,813
No, I do not get any error when compiling with new ver 9.66 but during execution of code I have problems with strings, I actually see situation when in one string I read part of another one (those two strings are not connected in code, so it is impossible to get that part of string in first string except if compiler overlap memory and allocate same area for 2 different strings....).
Another problem is that ovelapping i get even on chars or int variables.

Most problem for me is I make something to work, add some code lines, after that overlaping changes, some part of code which was working OK, don't working OK ....

This is new for me, I used PIC16Fxxxx series for long time (over 10 years) and never have problem.


With 9.51 I get Warning[359] xxxxxxxx : illegal conversion between pointer types but everything working OK.


Mr.Cube
 

bigdogguru

Administrator
Joined
Mar 12, 2010
Messages
9,831
Helped
2,349
Reputation
4,692
Reaction score
2,275
Trophy points
1,413
Location
Southwest, USA
Activity points
62,376
Yes, I saw you other posting discussion your problem.

Hi-Tech C can be rather finicky about string literals. If I have the time I'll try and troubleshoot your "overlapping string" issue.

BigDog
 

mrcube_ns

Advanced Member level 1
Joined
Apr 10, 2002
Messages
452
Helped
48
Reputation
96
Reaction score
34
Trophy points
1,308
Location
Europe
Activity points
3,813
In version 9.66 in ini file I found this about 18F4550:
[18F4550]
MAKE=MICROCHIP
ARCH=PIC18
FAMILY=18f4550
PROCID=4550
ROMSIZE=8000
RAMSIZE=7A0
COMMON=00-5F
REALICEROM=7D80-7FFF
ICD2ROM=7DC0-7FFF
REALICERAM=3EF-3FF
ICD2RAM=3F4-3FF
PERIPH=BOOTROM@0-7FF
PERIPH=USBRAM@400-7FF
EEPROMSIZE=100
FLASH_EW=40,20
ERRATA=FASTINTS
INSTR=EXTENDED
CFGS_UNPROG=1,0500,2,1F1F,3,83FF,4,FF85,5,C00F,6,E00F,7,400F

in version 9.51:
[18F4550]
MAKE=MICROCHIP
ARCH=PIC18
PROCID=4550
ROMSIZE=8000
RAMSIZE=400
COMMON=00-5F
ICD2ROM=7DC0-7FFF
ICD2RAM=3F4-3FF
PERIPH=BOOTROM@0-7FF
PERIPH=USBRAM@400-7FF
EEPROMSIZE=100
FLASH_EW=40,20
ERRATA=FASTINTS
INSTR=EXTENDED

RAM size are different.
Why?


Mr.Cube
 

bigdogguru

Administrator
Joined
Mar 12, 2010
Messages
9,831
Helped
2,349
Reputation
4,692
Reaction score
2,275
Trophy points
1,413
Location
Southwest, USA
Activity points
62,376
I'm afraid I can't answer your last question, I'll have to research it.

If you want to upload a zip of your project, I'll take a look and see if I can correct the string literal overlapping you describe.


BigDog
 

mrcube_ns

Advanced Member level 1
Joined
Apr 10, 2002
Messages
452
Helped
48
Reputation
96
Reaction score
34
Trophy points
1,308
Location
Europe
Activity points
3,813
I have to translate comments to english, and after that I'll send you code.

Mr.Cube
 

mrcube_ns

Advanced Member level 1
Joined
Apr 10, 2002
Messages
452
Helped
48
Reputation
96
Reaction score
34
Trophy points
1,308
Location
Europe
Activity points
3,813
Hi BigDog,

I solved problem, it's me all time.

I found bug in code: Initially txBuff was 250 bytes large, and I use memset(txBuff, 0, 250) command in a few places.
I change size of txBuff later to 50 and (of course) forget to correct memset command.

Thanks for help and time.


Best regards,

Mr.Cube
 
Last edited:

nsaspook

Junior Member level 2
Joined
Jun 23, 2010
Messages
21
Helped
5
Reputation
12
Reaction score
5
Trophy points
1,283
Location
Fairview, Oregon
Activity points
1,404
After being burned by this in the past I now try to dogmatically use defines for all constants in programming anything non-trivial.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top