• AVR Freaks

Helpful ReplyHot!Configuration bits on 30F6012A with MPLABX

Author
F26S
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2021/01/25 09:16:59
  • Location: 0
  • Status: offline
2021/01/25 13:35:34 (permalink)
0

Configuration bits on 30F6012A with MPLABX

Hello,
 
I'm currently tring to migrate a project form MPLAB8 to MPLABX.
I have to deal with an issue about the setting of the configuration bits
I read the developper help :
https://microchipdevelope...set-configuration-bits

So I generated the source code and included it in my project.
But when I build the project, I read this error
"Error: section address must be in range [0..0x7ffffe]"
Of course the configuration bits area is not in this range !
But I don't know what I have to do to allows the setting of the configuration bits by the code!
 
Thank you for your help !
#1
ric
Super Member
  • Total Posts : 29870
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Configuration bits on 30F6012A with MPLABX 2021/01/25 21:47:13 (permalink)
2 (1)
You don't mention if this is a C or ASM project.
Can you show the start of your main source file, including the config settings?
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#2
F26S
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2021/01/25 09:16:59
  • Location: 0
  • Status: offline
Re: Configuration bits on 30F6012A with MPLABX 2021/01/26 00:50:32 (permalink)
0
This is a C project.
See below the beginning of the main.c
 
"
#include <p30fxxxx.h> // librarie du compilateur
#include <stdio.h>
#include "Time.h"
#include "configbits.c"
 
int main (void) {....
"
 
The file configbits.c is : 
 
"
#include <p30Fxxxx.h>
int FOSC __attribute__((space(prog), address(0xF80000))) = 0xC706 ;
//_FOSC(
// XT_PLL8 & // Oscillator (XT w/PLL 8x)
// CSW_FSCM_OFF // Clock Switching and Monitor (Sw Disabled, Mon Disabled)
//);
int FWDT __attribute__((space(prog), address(0xF80002))) = 0x3F ;
//_FWDT(
// WDTPSB_16 & // WDT Prescaler B (1:16)
// WDTPSA_512 & // WDT Prescaler A (1:512)
// WDT_OFF // Watchdog Timer (Disabled)
//);
int FBORPOR __attribute__((space(prog), address(0xF80004))) = 0x8733 ;
//_FBORPOR(
// PWRT_64 & // POR Timer Value (64ms)
// NONE & // Brown Out Voltage (Reserved)
// PBOR_OFF & // PBOR Enable (Disabled)
// MCLR_EN // Master Clear Enable (Enabled)
//);
int FBS __attribute__((space(prog), address(0xF80006))) = 0x310F ;
//_FBS(
// WR_PROTECT_BOOT_OFF &// Boot Segment Program Memory Write Protect (Boot Segment Program Memory may be written)
// NO_BOOT_CODE & // Boot Segment Program Flash Memory Code Protection (No Boot Segment)
// NO_BOOT_EEPROM & // Boot Segment Data EEPROM Protection (No Boot EEPROM)
// NO_BOOT_RAM // Boot Segment Data RAM Protection (No Boot RAM)
//);
int FSS __attribute__((space(prog), address(0xF80008))) = 0x330F ;
//_FSS(
// WR_PROT_SEC_OFF & // Secure Segment Program Write Protect (Disabled)
// NO_SEC_CODE & // Secure Segment Program Flash Memory Code Protection (No Secure Segment)
// NO_SEC_EEPROM & // Secure Segment Data EEPROM Protection (No Segment Data EEPROM)
// NO_SEC_RAM // Secure Segment Data RAM Protection (No Secure RAM)
//);
int FGS __attribute__((space(prog), address(0xF8000A))) = 0x7 ;
//_FGS(
// GWRP_OFF & // General Code Segment Write Protect (Disabled)
// GSS_OFF // General Segment Code Protection (Disabled)
//);
int FICD __attribute__((space(prog), address(0xF8000C))) = 0xC003 ;
//_FICD(
// ICS_PGD // Comm Channel Select (Use PGC/EMUC and PGD/EMUD)
//);
"
 
For each line I have the same error :
"ccSUdaaa.s:41: Error: section address must be in range [0..0x7ffffe]"
 
 
#3
ric
Super Member
  • Total Posts : 29870
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Configuration bits on 30F6012A with MPLABX 2021/01/26 01:31:14 (permalink)
0
So are you using the old C30 compiler, not XC16?
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#4
F26S
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2021/01/25 09:16:59
  • Location: 0
  • Status: offline
Re: Configuration bits on 30F6012A with MPLABX 2021/01/26 01:47:29 (permalink)
0
Yes.
I use the C30 compiler (As in the previous version of the project under MPLAB8)
In this case, is it mandatory to use the X16 compiler ?
 
 
#5
ric
Super Member
  • Total Posts : 29870
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Configuration bits on 30F6012A with MPLABX 2021/01/26 02:43:50 (permalink)
0
I dont know. Have never used C30, and that is a totally different way of specifying the config bits to how xc16 does it.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#6
stumichaels
Super Member
  • Total Posts : 567
  • Reward points : 0
  • Joined: 2007/03/13 21:03:10
  • Location: Commack, NY
  • Status: online
Re: Configuration bits on 30F6012A with MPLABX 2021/01/26 02:56:03 (permalink) ☄ Helpfulby MBedder 2021/01/26 04:49:24
5 (2)
This is how I spec'd the configuration bits in C30:
 
/*   Configuration registers defined here              */

/* XT osc, PLL = 4, switching and monitor disabled */
_FOSC (XT_PLL4 & CSW_FSCM_OFF)
                                                 
/* Turn on watchdog timer by software later */
_FWDT (WDT_OFF & WDTPSA_8 & WDTPSB_4) /* time-out=35ms, min; 64ms, typ, 128ms, max */

/* Enable Brown-out reset @ 2.7V, power up timer = 64ms, enable MCLR* */
_FBORPOR (MCLR_EN & PBOR_ON & BORV_27 & PWRT_64)

/* Turn off all code protection for now */
_FBS (CODE_PROT_OFF)

_FGS(CODE_PROT_OFF)

_FSS(CODE_PROT_OFF)


#7
ric
Super Member
  • Total Posts : 29870
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Configuration bits on 30F6012A with MPLABX 2021/01/26 03:02:06 (permalink)
0
stumichaels
This is how I spec'd the configuration bits in C30:

Did you try just using that?
Plainly that is not what you showed in post#1.
The format of the config bits depends upon the compiler in use, not the IDE.
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#8
stumichaels
Super Member
  • Total Posts : 567
  • Reward points : 0
  • Joined: 2007/03/13 21:03:10
  • Location: Commack, NY
  • Status: online
Re: Configuration bits on 30F6012A with MPLABX 2021/01/26 03:14:26 (permalink)
4 (1)
Ric,
Did you confuse my response with the OP?
#9
F26S
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2021/01/25 09:16:59
  • Location: 0
  • Status: offline
Re: Configuration bits on 30F6012A with MPLABX 2021/01/26 03:29:57 (permalink)
0
I just tryed with the code proposed by stumichaels.
Now I can build the project without error.
I don't have the hardware near to program the device. I will let you know if it works.
Thank you !!
#10
ric
Super Member
  • Total Posts : 29870
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Configuration bits on 30F6012A with MPLABX 2021/01/26 03:54:06 (permalink)
0
stumichaels
Ric,
Did you confuse my response with the OP?

Oops, yes, not paying good attention. Looks like you had the best answer :)

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#11
F26S
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2021/01/25 09:16:59
  • Location: 0
  • Status: offline
Re: Configuration bits on 30F6012A with MPLABX 2021/01/26 13:33:52 (permalink)
0
I just tried to program the device by icluding the example of code provided by stumichaels.
Now it works ! 
Thanks a lot for your quick answer !
#12
stumichaels
Super Member
  • Total Posts : 567
  • Reward points : 0
  • Joined: 2007/03/13 21:03:10
  • Location: Commack, NY
  • Status: online
Re: Configuration bits on 30F6012A with MPLABX 2021/01/26 13:42:50 (permalink)
5 (1)
You are quite welcome!
 
Perhaps you will help someone in the future!
#13
Jump to:
© 2021 APG vNext Commercial Version 4.5