Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 23, 2024, 07:58:13 19:58


Login with username, password and session length


Pages: 1 2 3 4 5 [6] 7 8 9 10 11 12
Print
Author Topic: XC8 Compilers - Discussion  (Read 226842 times)
0 Members and 1 Guest are viewing this topic.
ferdok9
Inactive

Offline Offline

Posts: 2

Thank You
-Given: 6
-Receive: 1


« Reply #125 on: March 18, 2016, 10:03:03 22:03 »

MPLAB® XC8 Compiler v1.37
medicine is working!
Logged
koky
Active Member
***
Offline Offline

Posts: 180

Thank You
-Given: 149
-Receive: 157


WWW
« Reply #126 on: March 20, 2016, 12:18:49 12:18 »

where have you find 1.37 version?
Logged
flo0319
Junior Member
**
Offline Offline

Posts: 81

Thank You
-Given: 7
-Receive: 17


« Reply #127 on: March 20, 2016, 01:38:49 13:38 »

where have you find 1.37 version?

On microchip website www.microchip.com/mplabxc8windows , the page (http://www.microchip.com/mplab/compilers) still show version 1.36 but if you download it you will get version 1.37
Logged
jumulab
Junior Member
**
Offline Offline

Posts: 77

Thank You
-Given: 91
-Receive: 74


« Reply #128 on: June 17, 2016, 09:00:28 09:00 »

I'm working with the XC8 compiler under MPLAB X IDE V3.30 and  need  the compiler do not initialize to zero
all  RAM registers when restart  or reset the program whitout removing power.

Any user know how I can do this ?.
Thx's
Logged
mars01
V.I.P
Hero Member
*****
Offline Offline

Posts: 536

Thank You
-Given: 693
-Receive: 1763



« Reply #129 on: June 17, 2016, 11:33:33 11:33 »

I'm sorry to say but your question needs to be improved otherwise it will not receive a full answer. I bet many saw your question and moved on because the question is not clear.

I understand that you work with XC8 compiler and MPLABX. The rest is just mixed ideas.

Just my 2 cents: if you are after a software reset you can use information's from here:

http://microchip.wikidot.com/8bit:rst

or use a Watchdog timer to perform the reset:
http://microchip.wikidot.com/8bit:wdt

Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #130 on: June 17, 2016, 12:47:43 12:47 »

when I read your answer I thought you fully understood his question.. seems the guy is seeking a way to force the compiler not to reset the variable (all all RAM locations) to zero after reset. the reset part is the easy one : -)
Logged
mars01
V.I.P
Hero Member
*****
Offline Offline

Posts: 536

Thank You
-Given: 693
-Receive: 1763



« Reply #131 on: June 17, 2016, 03:53:42 15:53 »

Maybe is something with me today, but I could not understand completely what he wanted. Sorry!

As far as I understand a software reset does not clear RAM in a hardware way (MCLR reset count as a pin-based software reset also).
Indeed XC compiler inserts some code to zero all RAM variables before calling main() function.

This can be overridden by using the __persistent attribute.

Page 63 in XC8 compiler manual, found here: http://ww1.microchip.com/downloads/en/DeviceDoc/MPLAB_XC8_C_Compiler_User_Guide.pdf
says that, and I quote:

"3.5.12 How Can I Stop Variables Being Cleared at Startup?
Use the persistent qualifier (see Section 5.4.8.1 “Persistent Type Qualifier”),
which will place the variables in a different psect that is not cleared by the runtime
startup code."

As for the registers, some will be hardware reset and that cannot be changed (maybe if you write the registers in EEPROM each time you change the registers and then if a reset is detected, some start-up code will restore them) and some will be not.
« Last Edit: June 17, 2016, 03:57:13 15:57 by mars01 » Logged
jumulab
Junior Member
**
Offline Offline

Posts: 77

Thank You
-Given: 91
-Receive: 74


« Reply #132 on: June 18, 2016, 07:21:15 19:21 »

Hi mars01 and metal,
thank you for your help. As mars01 noted, a good ide ais use the __persistent qualifier.
ASAP I will check this behaviour  in the compiler  work.
I am not too instructed in this compiler, because normally I am using Renesas and some ARM devices under
IAR compilers and Atmel Studio.
Metal has catch the exact sense of my question.
After the reset,  some compilers, XC8 too, call some "lowlevel" function to initialize the processor internal
registers, memory, peripherals , etc. 
In IAR compiler, normally  has a lowlevel_init.c  or similar function to do this.
In the XC8,  you can see in the ..\xc8\v1.36\dat   some *.dat files with informations about the processor configuration
and in the ..\xc8\v1.36\sources\pic\ powerup.as
This file , you can get a copy and insert in your project to do an initializAtion of the processor before the compiler call
to main() function. The bad new : this file are assembler, and if we are working in "C", is a troouble.

A better explanation of my question:
Assumed we have  1K of RAM memory,  after the reset and before main is called, the compiler place some code to
clear ALL ram,  and I need  a block without any changes.
Thing , if I am working and an unexpected RESET, is done ( watch-dog, EMI noise, etc),  I need  some variables
not be touched , to remember some states of the machine.
Of course, if the  reset is done by an power up , or from a switch off/on, these variables , will be set to zero
by code.  ( I maintain some "keys" or  block CRC to  check the health of variables).

I have asked tro Microchip support, expect some answer soor.
Thanks again !     and sorry for my english!


Posted on: June 18, 2016, 08:13:20 20:13 - Automerged

Hi again mars01,
I have found and read the paragraph you mentioned in the XC8 manual, and OOOPS !   that is !.
Is the good answer.

Thanks a lot.
Logged
mars01
V.I.P
Hero Member
*****
Offline Offline

Posts: 536

Thank You
-Given: 693
-Receive: 1763



« Reply #133 on: June 23, 2016, 10:10:04 22:10 »

Hi,
By accident I also came upon this setting in MPLABX that manage the RAM clear at runtime, maybe it will help.

Logged
jumulab
Junior Member
**
Offline Offline

Posts: 77

Thank You
-Given: 91
-Receive: 74


« Reply #134 on: June 27, 2016, 04:54:20 16:54 »

Hi mars01,
the selection you mentioned work  as expected.
If you select x-Clear BSS   all variables defined  are cleared before  fisrt call in
main is called , in this compiler  SYSTEM_Initialize()
If you  select x-Initialize data, all,variables  defined like  : uint16_t var1 = 0x1234
when the program reaches main,  var1  value is 0x1234. If this selection is not selected,
when program goes to main, the value of var1 = 0 if the Clear Bss are selected, or
umpredictable is no.

Finally  the solution for the initially question has been solved  placing the group of
variables  into on strcut in the way : ( is an example)

__persistent  _st_NOVOLTIL {

    char rele1:1;
    char rele2:1;
    char rele3:1;
    char rele4:1;
    uint8_t ui8VAR1;
    uint8_t ui8VAR2;
    uint16_t ui16VAR1;

...  and so on ...

} st_NOVOLATIL.


Logged
Catcatcat
Senior Member
****
Offline Offline

Posts: 417

Thank You
-Given: 275
-Receive: 1536



WWW
« Reply #135 on: July 14, 2016, 04:25:32 16:25 »

MPLAB® XC8 Compiler v1.38
medicine is working!
Logged
mars01
V.I.P
Hero Member
*****
Offline Offline

Posts: 536

Thank You
-Given: 693
-Receive: 1763



« Reply #136 on: December 14, 2016, 07:53:54 19:53 »

Just a small report: Mplab XC8 v1.40 is working as PRO with the current medicine.

As improvements, for now I can say that a project that was compiled with v1.38 took 572 RAM bytes and 1130 FLASH bytes, compiled with v1.40 occupy 571 RAM bytes and 1128 FLASH bytes in a 16F1938 microcontroller.
Logged
lm317
Junior Member
**
Offline Offline

Posts: 92

Thank You
-Given: 123
-Receive: 29


« Reply #137 on: December 16, 2016, 08:52:39 08:52 »

By new version, smaller than 1-2 byte! 
Very high improvement Smiley
Logged
mars01
V.I.P
Hero Member
*****
Offline Offline

Posts: 536

Thank You
-Given: 693
-Receive: 1763



« Reply #138 on: December 16, 2016, 07:10:46 19:10 »

I am sure that there are other changes under the hood. Also, maybe my code was not the best to test whatever changes they made: I have some big arrays of int's. Not much that can be improved there.
I just wanted to say that at least they did "something" to improve things.
Not to mention support for new controllers and maybe some fixes.
Logged
lcn
Junior Member
**
Offline Offline

Posts: 42

Thank You
-Given: 15
-Receive: 1


« Reply #139 on: December 27, 2016, 05:51:13 17:51 »

With XC8 v1.40, i can't get the medecine working .

If i rename or delete original xclm.exe and then replace it by the medecine, compiler stays in FREE mode.

I tried to manually run the new xclm.exe from CMD console window as administrator, but still no chance.

Did i miss something ?
Logged
lm317
Junior Member
**
Offline Offline

Posts: 92

Thank You
-Given: 123
-Receive: 29


« Reply #140 on: December 27, 2016, 06:27:16 18:27 »

Renamed original xclm.exe  may not original! 

1- uninstall  and clear install folder.
2-Setup again. as free mode. After setup completed you have new original xclm.exe .
3- rename this original xclm.exe  as xclm.old
4-Copy medicine xclm.exe  to folder.
5-Cmd as administrator. Run this command
C:\Program Files (x86)\Microchip\MPLABX\v3.40\mplab_ide\bin>xclm.exe


resut as
.... patched
.... patched
.... patched
...  completed.
Logged
mars01
V.I.P
Hero Member
*****
Offline Offline

Posts: 536

Thank You
-Given: 693
-Receive: 1763



« Reply #141 on: December 27, 2016, 09:04:22 21:04 »

With XC8 v1.40, i can't get the medecine working .

If i rename or delete original xclm.exe and then replace it by the medecine, compiler stays in FREE mode.

I tried to manually run the new xclm.exe from CMD console window as administrator, but still no chance.

Did i miss something ?

It did happen to me once and since then what I do is:
1. move the original xclm.exe from the install folder somewhere else, like desktop.
2. rename the original xclm.exe to xclm.old
3. copy the cracked xclm.exe near the xclm.old file, e.g on desktop.
4. move both files at the same time to the XC8 install folder, where the original xclm.exe file use to be before step 1.
5. run xclm.exe as administrator

I don't know if this method is the only one that works, but it works for me.

In your case, before doing what I have wrote above, you need to uninstall the XC8 compiler, delete the XC8 folder and then reinstall the XC8 compiler. I say this, because once you see that the files can't be patched, my method will not work until you actually do the uninstall - reinstall thing.
Logged
FTL
Junior Member
**
Offline Offline

Posts: 83

Thank You
-Given: 170
-Receive: 33


« Reply #142 on: December 29, 2016, 05:09:00 17:09 »

I re-built my workbench PC last week and re-installed all the Microchip development tools:

 MPLab 3.45
 XC8    1.38 (1.40 is now out. 1.38 was current as of Dec. 03 when I downloaded it)
 XC16  1.30
 XC32  1.42

The medicine appeared to work fine, but to be sure, I created a simple but very useless main.c program and compiled a project on XC8, XC16 and XC32 with various levels of optimization. The program I compiled is the following:

Code:
/* A silly program just to test XC8, XC16, and XC32. */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char * argv[]) {
  int Counter;
  char dum[100];
  for (Counter=0; Counter < 5000; Counter++) {
    if (argc < Counter) {
      argc++;
      Counter--;
      sprintf(dum,"%4d",Counter);
      Counter += (int)strcmp(dum,argv[0]);
    };
  };
  return 0;
};

I compiled essentially the same program under each compiler with different optimization levels and got the following results:

Code:
Compiler   Device            Version  Optimization     Program Code size (bytes)
XC32       PIC32MX230F256D   V1.42          0                 9508
                                            2                 9464
                                            S                 9448
XC16       PIC24F16KM202     V1.30          0                 2902
                                            2                 2912
                                            S                 2900
XC8        PIC18F25K50       V1.38          Free              1544
                                            STD                948
                                            PRO                838

This is probably not the best test program given that sprint probably makes up most of the compiled code, but it does show that the various optimization levels actually do make a difference so all three compilers are actually optimizing. Also I only tested with one device for each compiler. I can imagine that the optimization could be a lot different with different devices.

The program may be too small to optimize properly. XC16 actually produced larger code in Mode 2, and Mode S was only very slightly better than no optimizations. The purpose of the code was to prove that the optimizations were doing something, and they obviously are. The non-Free optimization with XC8 was the most dramatic.

The thing I have not proven is whether the optimizations will still work in a month. I'm not sure how to tell if the compilers really think they are properly licensed.
Logged
bluex
Junior Member
**
Offline Offline

Posts: 83

Thank You
-Given: 10
-Receive: 39


« Reply #143 on: January 08, 2017, 01:55:33 01:55 »

By new version, smaller than 1-2 byte! 
Very high improvement Smiley

http://ww1.microchip.com/downloads/en/DeviceDoc/Readme_XC8_140.htm#TOC_WhatsNew
Logged
magician
Newbie
*
Offline Offline

Posts: 13

Thank You
-Given: 25
-Receive: 3


« Reply #144 on: January 13, 2017, 08:18:51 08:18 »

For reference:

Medium size project for PIC 18F4620, .hex outputs:

C18 in Pro mode: 58KB
XC8 v1.35 in Pro mode: 38KB
XC8 v1.40 in Free mode: 52KB
XC8 v1.40 in Standard mode: 45KB
XC8 v1.40 in Pro mode: 37KB

regards
Logged
chicowood
Junior Member
**
Offline Offline

Posts: 92

Thank You
-Given: 101
-Receive: 25


« Reply #145 on: January 18, 2017, 10:58:13 22:58 »

With XC8 v1.40, i can't get the medecine working .

If i rename or delete original xclm.exe and then replace it by the medecine, compiler stays in FREE mode.

I've been having the same problem. I've got all versions up to 1.34 running in Pro Mode (MPLABX 3.51) but can't get 1.38 or 1.40 to go Pro. Tried all the recommendations in the posts above and more...no luck.

I can live with using 1.34 Pro and 1.40 Free, but I'm challenged to figure out why I can't get the later versions to work.

I see there's another xclm.exe inside the MPLABX bin folder...wonder if that has anything to do with it...anybody have further ideas?
Logged
mars01
V.I.P
Hero Member
*****
Offline Offline

Posts: 536

Thank You
-Given: 693
-Receive: 1763



« Reply #146 on: January 19, 2017, 12:24:49 00:24 »

@chicowood

I attach bellow the xclm files (xclm.old and xclm.exe) taken from my own 1.40 XC8 installation folder. Try to uninstall the XC8 compiler, clean the folder if something still remain inside (maybe use CCleaner to clean the registry), install again the XC8 compiler v 1.40,  then delete the original xclm.exe from the bin folder in the XC8 installation directory and lastly, copy the attached files into the bin folder in the XC8 installation directory.

Make sure UAC is disabled (who knows, it might be interfering somehow).
Open an command prompt windows, as administrator, CD to the bin directory of the XC8 installation and run xclm.exe - you should see a few lines saying something like "patching OK" (I don't remember exactly the wording).

My XC8 installation is in this location:


If this is still not working then I don't know what will.

LE: Actually there may be another way ... I updated the attached file and added also the picc and pic18 files already patched. Maybe they will help you by replacing them in the installation directory.
« Last Edit: January 19, 2017, 12:32:35 00:32 by mars01 » Logged
chicowood
Junior Member
**
Offline Offline

Posts: 92

Thank You
-Given: 101
-Receive: 25


« Reply #147 on: January 19, 2017, 12:27:32 00:27 »

Thanks, will try all and report back...
Logged
mars01
V.I.P
Hero Member
*****
Offline Offline

Posts: 536

Thank You
-Given: 693
-Receive: 1763



« Reply #148 on: January 19, 2017, 12:33:09 00:33 »

I've updated my previous post. See the edit.
Logged
Catcatcat
Senior Member
****
Offline Offline

Posts: 417

Thank You
-Given: 275
-Receive: 1536



WWW
« Reply #149 on: January 19, 2017, 04:09:45 04:09 »

Follow the instructions as described in the specification of the medicine. I have everything working, the operating system W10, MPLAB X 3.51. Do not forget to run xclm, as administrator.
Logged
Pages: 1 2 3 4 5 [6] 7 8 9 10 11 12
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC