MPLAB-X Plugin...

Discuss the Integrated Development Environment (IDE)

Moderators: David Barker, Jerry Messina

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: MPLAB-X Plugin...

Post by Jerry Messina » Thu Jan 29, 2015 12:09 pm

...Or should the command line accept "#variables" rather than defines?
Being able to add "#option" and "#variables" settings to the command line would be a great addition for other things as well.

For example, right now I have a project .bas that supports different #options for different builds. To generate these I have to manually edit the options, compile, rename the resulting hex file, etc. If I could specify #options on the command line then all that could be automated with batch files and the command-line compiler.

Alternatively, if the ICD_ROM and ICD_RAM could not be extracted from any microchip files when auto-generating the Swordfish device files
I don't remember where i got this info from, but I don't think I ever found it in a file. It's not in the MPASM 8bit_device.info file, not in the .dev file, and not in the MPLAB internal .PIC file either.

It's a linker function so you'd think it's controlled there, but I don't recall seeing the actual info in the .lkr files either. The .lkr files have a section in them that relies on various _DEBUGxxxxx symbols getting set, but for the life of me I have no idea where it gets this info.

I think maybe I just bit the bullet and sat down with the MPLAB help file and extracted it from there.


All of this raises a good point. MPLABX uses a different set of files for all this, different assembler, etc. If they don't keep MPASM up to date, then future devices may need to use that tool chain (mpasmx). Maybe a discussion for a different day...

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: MPLAB-X Plugin...

Post by David Barker » Thu Jan 29, 2015 12:12 pm

OK, so I think the consensus is

(a) use a "mplabicd.bas" file and store in sys.import
(b) make the above part of the swordfish installation
(c) support simple defines at the command line

this will allow complete automation of an ICD build in MPLAB-X and provide other useful features as well.

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: MPLAB-X Plugin...

Post by Jerry Messina » Thu Jan 29, 2015 12:40 pm

>>(a) use a "mplabicd.bas" file and store in sys.import

Yeah, I think you might be stuck with something like that. It's not ideal, but unless someone can find the info in a file somewhere that's probably the best choice. Shame... it'd be a lot nicer if it were in the device file itself, but you gotta take what you can get!


One thing to point out. If you have config settings in the mplabide.bas file the order of WHEN it gets included is important. It has to be after everyone else has had a chance to set the 'config', otherwise it can't override what's in the project files (since the last 'config' wins).

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: MPLAB-X Plugin...

Post by David Barker » Thu Jan 29, 2015 1:10 pm

> One thing to point out. If you have config settings in the mplabide.bas file
> the order of WHEN it gets included is important. It has to be after everyone
> else has had a chance to set the 'config', otherwise it can't override what's
> in the project files (since the last 'config' wins).

any file in "sys.import" is included in the following way for every module
  • device file include
  • sys import include
  • <user declarations and includes>
I cannot see this being a problem for a simple file that modifies ICD_ROM and ICD_RAM?

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Re: MPLAB-X Plugin...

Post by octal » Thu Jan 29, 2015 1:23 pm

For example, right now I have a project .bas that supports different #options for different builds. To generate these I have to manually edit the options, compile, rename the resulting hex file, etc.
This can be done in MPLabX automatically simply by using "Build Configurations". This is how Microchip, for example, provides the example of Custom HID device for multiple boards (you select the config related to one of the boards directly from the Combobox in the toolbar).

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: MPLAB-X Plugin...

Post by Jerry Messina » Thu Jan 29, 2015 2:12 pm

>> I cannot see this being a problem for a simple file that modifies ICD_ROM and ICD_RAM?
That's workable... as long as you can test for ICD, one can always add some project-specific stuff afterwards


>>This can be done in MPLabX automatically simply by using "Build Configurations"
I have a hard time seeing how that would work w/SF, unless you're just talking about a Build Configuration changing a command-line #option setting (with the new method). Unlike C, you can't include/link in different files for different build configurations.

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: MPLAB-X Plugin...

Post by David Barker » Thu Jan 29, 2015 2:20 pm

> Unlike C, you can't include/link in different files for different build configurations.

Not sure what you mean here - can you give an example? Swordfish can include different files, depending on a define...

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: MPLAB-X Plugin...

Post by Jerry Messina » Thu Jan 29, 2015 2:34 pm

> Swordfish can include different files, depending on a define...

Right, but for this to work w/SF an IDE 'Build Configuration' wouldn't be able to do anything other than set a #define, or #option, and you'd need to have the "new" command-line handling for this to work.

I think once you have that then having different Build Configurations should work fine.

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Re: MPLAB-X Plugin...

Post by octal » Thu Jan 29, 2015 3:42 pm

David Barker wrote:Swordfish currently supports "sys.import", like Firewing. I think this may be the way to go. You can test this now.

(1) create a folder in your main Swordfish library folder called "sys.import" (not sys.imports, leave the "s" off!)
(2) place your debug file into the "sys.import" folder
(3) restart Swordfish

This file will now be automatically linked into your code, without having an explicit "include". So you can now

(a) control using code, as before
(b) set via a command line option when using the command line compiler
(c) a will always override b

How does this sound?
I think this could be the best solution. For the command line option, it's better to not make it associated to ICD.

It's better to have:
1- a generic think like the "-D" switch on most C compilers. User can specify many times the "-D" to setup any define. with a -DMPLAB_ICD user will be able to use something like #ifdef MPLAB_ICD ... #endif
2- to have a -O switch to define any option with its value, for example -OMPLAB_ICD=FALSE witch will lead to something like #option MPLAB_ICD=false, and it will consider this as the FIRST statement in the compiled PROGRAM file.

Both switch need to be able to appear multiple times on the command line in order to define multiple items ( -OMPLAB_ICD=false -OUSE_SOFT_UART=true ...)

Regards

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: MPLAB-X Plugin...

Post by David Barker » Thu Jan 29, 2015 4:10 pm

OK, I will look at implementing -def, -op, -var where

-def => #define
-op => #option
-var =>#variable

for example

-defMPLAB_ICD[=<val>]
-opMPLAB_ICD=<val>
-varMPLAB_ICD=<val>

so you could use any of the above. Does that look OK? Is there anything else we need for command line parsing? I suspect we need a flag for generating coff. Anything else?

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Re: MPLAB-X Plugin...

Post by octal » Thu Jan 29, 2015 4:29 pm

Up to now, cof is systematically generated by the SFToolchain for MPLabX. I think, it's better to keep it as it's now. i.e. we generate systematically cof and hex files, as the MPLabX debug tools tries to read file info directly there, and even the IDE uses the cof information to update the project dashboard view (the view that shows RAM/ROM occupation statistics). The main difference, when we'll specify -defMPLAB_ICD=true will be the maxram and config fuse setting that will be different between "production" and "debug" releases.

btw. David, you need to explicitly document if the -opt will create and make the option availble for the main program only. If not, users may think it will be applicable to any module having the mentioned option and it will become a nightmare even for the actual SF IDE parser.

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: MPLAB-X Plugin...

Post by Jerry Messina » Thu Jan 29, 2015 7:03 pm

octal -

>> need to explicitly document if the -opt will create and make the option availble for the main program only.
>> If not, users may think it will be applicable to any module having the mentioned option

Could you explain a bit more what you mean here?

The compiler "#" settings are global and are seen by all modules from the point that they are set on forward.

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Re: MPLAB-X Plugin...

Post by octal » Thu Jan 29, 2015 9:24 pm

Hi Jerry,
forgot my stupid suggestion. I was too busy and tired when I answered the post :oops:

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Re: MPLAB-X Plugin...

Post by octal » Thu Jan 29, 2015 11:52 pm

Cool, ICD3 debug is working now.
Next step is adding syntax highlight and specialized editor to let MPLabX handle SF source codes correctly. (Note that MPLabX already handles the asm syntax colouring - we inherits Microchip work, this is why in following screenshot the debug assembly window looks great)
Attachments
icd3debug.png
icd3debug.png (80.96 KiB) Viewed 25514 times

User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: MPLAB-X Plugin...

Post by Coccoliso » Fri Jan 30, 2015 7:16 pm

:shock: sleepless nights ..
Excellent results are a big!

Post Reply