MPLABX first users

Go To Last Post
77 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Split form here JS https://www.avrfreaks.net/commen...

 

Copy of a message I sent off to AVRSupport@microchip (as they request for people trying to use MPLAB for AVR):

 

So I’m running MPLABX “latest” on my Mac, compiling AVR projects, and thought I’d provide some feedback (as requested.)
 

Product Version: MPLAB X IDE v5.05
Java: 1.8.0_144; Java HotSpot(TM) 64-Bit Server VM 25.144-b01
Runtime: Java(TM) SE Runtime Environment 1.8.0_144-b01
System: Mac OS X version 10.13.6 running on x86_64; UTF-8; en_EN (mplab)
User directory: /Volumes/MacOS/HD-Users/BillW/Library/Application Support/mplab_ide/dev/v5.05
Cache directory: /Volumes/MacOS/HD-Users/BillW/Library/Caches/mplab_ide/dev/v5.05/var

This is essentially the first time I have used MPLAB to any extent; normally I use CLI tools.  I’m not sure which of the following comments are specific to the new AVR support, and which are generic to MPLAB, or IDEs in general.

I maintain the Optiboot Bootloader (an old version of which is used on Arduino and many derivatives.)
I’m currently working on porting that to the ATmega4809, “just because.”  That means that I’m working with bare metal C code - no ASF, no “Atmel Start”, etc.
I’m using an ATmega4809 Xplained Pro board.

 

1) The “Disassembly view” is showing a disassembly of the object code.   It seems to have some sort of “object code generated from the .o files.”  While it’s nice that this includes source lines as well as the assembly code, it has problems:
 a) frequently has troubles finding the source for the current PC, even when it’s in the user code.  It really ought to disassemble what’s there, anyway.
 b) only displays one function at a time.  In a disassembly view, I want the big picture.
     (never mind - just discovered the “program memory panel” displayed as code.
 c) In both the disassembly window AND the Program memory, it doesn’t seem to properly figure out the target of rcall/call instructions.  The disassembly window shows “CALL __vectors” or “CALL 0x0” (__vectors is a symbol whose value is zero.)  The program memory panel shows “call __vectors” as well.  I think it doesn’t understand that “call” is a two-word instruction.  (other problem: "-mrelax”, which allows two-word calls to be collapsed into one-word “rcall” when possible, should be a default compile option, and not one that has to be entered manually as an “extra.”
 d) I can’t single-step at the assembly-instruction level.
 e ) related to (d), I can’t figure a way to step through the code that happens prior to “main” - the “reset” button shows the next thing to be executed is the first line of main(), rather than the restart vector and/or crt code.

 

2) There doesn’t seem to be an effective way to specify a start option other than 0.  Since the new-style chips (eg 4809) have the bootloader in low memory, this is especially a problem.  (I supposed it could also be solved with a modified linker script.)  Atmel-Studio has a link-option for this that sets “—sections-start=.text=100” (for example), but adding this as an extra option in the MPLAB linker option panel results in a executable that seems to break/hang the debugger.  (It shouldn’t.  The empty space where theoretically a bootloader would go contains a noop-like instructions that it should just step through before getting to the “jmp” that is in the reset vector at the start of the .text section.) (This happens properly in Atmel Studio’s debugger.)

 

3) Is it really supposed to be consuming 2.5 CPUs worth of cycles when the debug binary is running, even though there are no breakpoints, no watchpoints, and I can’t imagine what they would be communicating about??  Under similar circumstances, a VM running Atmel Studio debugger is essentially idle.  I should mention that this seems to be the case when I’m debugging a PIC evaluation board as well (a PIC16F18446-Xpress board)

 

4) The bootloader-related BOOTEND and APPEND configuration values of the ATmega4809 are not shown in the “configuration bits” panel.

 

5) in the IO View, registers of a peripheral seem to be shown in alphabetic order, rather than address order.  I don’t see how to sort differently.
   A bunch of the sub-byte info is generally messed up (it seems to think that BOOTLOCK is a bit in USARTn.CTRLB, for example.)

 

6) I don’t see a way to get an assembly listing out of the compile step, either the (relatively useless) .s files that the compiler would generate, or the more useful version generated by using “avr-objdump” on the .elf file.

 

7) I guess I should add my voice to those who think it’s unacceptable for Microchip to have restricted what is essentially the open-source avr-gcc compiler to -O1 optimization levels.  If and when Optiboot is ported to the 4809, the chances that it will “fit” in the allocated space with -O1 optimization are essentially zero.

 

Other than that, it was pretty nice to be using a full-fledged debugger from a native Mac environment, instead of having to fire up a PC or PC VM to run Atmel Studio.

Last Edited: Mon. Oct 8, 2018 - 07:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know if this is a bug or if it was done on purpose, but when I try to add a new AVR toolchain that does not come from Microchip/Atmel to MPLAB, its version is not recognized correctly (always appears as "v1.00").

AS7 has no problems working with toolchains compiled by 3rd parties.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Should we split this into a new MPLABX related thread? Some of us will be getting new toys to use with MPLABX and it may be nice to keep all the feedback in one place to start with.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Split would be a good idea because I will likely join you and will certainly have many questions / comments / screams of anguish / etc Does not seem like the spirit of the preceding thread.

 

Jim

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another forum bug, even though I have a post here there is no Red thumbs up! Maybe now it will appear.

 

 

Edit Yep, now I get the thumbs up.

 

Wrong Forum John, Site feedback? - JM

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Tue. Oct 9, 2018 - 08:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The PICKIT4 is on it's way to me and should be here on Monday.

 

What happens with MPLABX? Is it all in one package like AVRStudio or do we need to download the compiler(s)/Assembler separately?

 

Eventually I would like to use a computer with some form of Linux installed but for now I will get the Windows version to reduce the high blood pressure factor....whether it helps or not it will be another story.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

IMO the MPLABX IDE is not as good as AS7 visually and in terms of code navigation, and it's a bit more sluggish to parse code (well, my laptop is getting old).

 

There seems to be 2 compiler versions for AVR available from Microchip:

MPLAB XC, the famous crippled version that can do only -O1 optimization, and the AVR toolchain, which is fully functional. Currently they both have the exact same avr-gcc version, 5.4.0, but one is crippled, the other isn't. Go figure.

 

To me, it's pretty obvious one should install the fully functional version.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Same situation as js. Due here on Monday. Need to get MPLABX installed so that that I can hit the ground crawling.

 

Jim

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

What happens with MPLABX? Is it all in one package like AVRStudio or do we need to download the compiler(s)/Assembler separately?

 MPLABX includes Assemblers, but not C compilers.  (huh.  It seems to have auto-detected the AVR C compiler already existing inside of AS7!)

The MPLABX install is a lot "cleaner" than Studio - you get the one Microchip sub-directory containing IDE/IPE/Compilers, rather than some wild scattering of "Windows Studio this & that" pretending to be windows components.  It's still huge, overall.  (~5GB? I did some actual comparisons on previous versions (installing MPLAB and Studio on otherwise virgin VMs and seeing how much disk got consumed - there were pretty close.))

 

 

a message I sent off to AVRSupport@microchip

This got a very quick response, with some good answers...
They seem to be pretty attentive to the early adopters - you may never get such quick responses again!

 

 

>> 1b) only displays one function at a time.  In a disassembly view, I want the big picture.
>>     (never mind - just discovered the “program memory panel” displayed as code.)

There is actually a Listing file that provides the whole Disassembled view of all the project. Window>/Debugging>/Output>/Disassembly listing. For the Debug disassembly view it only shows the area you are focused on while debugging through it, hence is is only one function at a time

Fair enough.  That makes (at least) three separate windows that can display disassembled code, which is a little disturbing, but acceptable.

 

>> d) I can’t single-step at the assembly-instruction level.
In which window may I ask?

Normal Stepping is at the High level C code. There is a Step Instruction which you can add to the tool bar. Right click tool bar customize. Look for step Instruction then drag it onto the toolbar. This will step a single opcode. We do not add it by default to avoid toolbar clutter for the majority of customers who step in a high level C source. This is similar to a lot of our implementation. Deep core developers which sounds like yourself might want to provide some customization.

Also acceptable.   Or would be, except my Mac doesn't seem to do the "drag" thing :-(

There seem to be a bunch of other useful buttons there as well.
I sort-of expected that anything that could be a toolbar button would also appear in some drop-down menu.  I guess not.

 

1d), I can’t figure a way to step through the code that happens prior to “main” - the “reset” button shows the next thing to be executed is the first line of main(), rather than the restart vector and/or crt code.

Under the Tools>/Options>/Embedded>/ there is a customization to reset at the reset vector or at Main() we normally default to main() as not many customers want to start in the reset vector. There is a debug start and reset start that can be configured here. Then you will reset and be able to step through code prior to main()

Another useful set of configuration options.  I'm starting to get the sense that MPLAB is one of those Applications where sitting at someone-else's computer and trying to use their config that is different than your usual config is likely to be annoying.  I guess Studio was probably like that as well - I was never a heavy user, but it seems to have had a "choice of defaults" that I never found quite as bothersome.

 

 

The guy I answered claimed not to know about the -O1 limit, or perhaps I wasn't clear enough that I was talking about "XC8 with AVR support" rather than avr-gcc.  :-(

We would not intend to restrict this. It may be an issue I will document.

There is no policy from Microchip that this would be the case, so it will get fixed.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It seems to have auto-detected the AVR C compiler already existing inside of AS7

Good to know! Some of the work I will be doing is in assembler anyway.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So does this mean that MPLAB would have a full power compiler by using the one in Studio?

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Presumably it has to support all the optimisation modes of avr-gcc to support backwards compatibility? If I'm coming from AS4/AS7 and have a bootloader that builds to 4093 bytes in a 4K booloader section using avr-gcc's strongest optimisation then it would be a bit of s step backwards if this could not now be rebuilt to the same size with new tools that we're presumably supposed to migrate to (as I'm guessing AS7 is dead?)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So does this mean that MPLAB would have a full power compiler by using the one in Studio?

Yes.  Only the XC8 "compiler" for AVR seems to have restrictions (so far.)  AFAICT, this is just a "wrapper" for the avr-gcc binary (but it's the actual ...xc8/v2.00/avr/bin/avr-gcc binary that has the check...)

 

MPIDE is also happy with avr-gcc installed via the "toolchain" versions.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
... (as I'm guessing AS7 is dead?)

https://www.avrfreaks.net/forum/come-join-us-mplab-now-supports-avrs?page=4#comment-2563976

...

"Traditional AVR MCU programmers can also stay with Atmel Studio 7, as we are continuing to offer new device support, add enhancements and implement bug fixes as needed.” - Steve Drehobl (Microchip VP, 8-bit MCU)

...

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In which case what possible motivation is there really for anyone (in Windows) to switch to MPLAB ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
AFAICT, this is just a "wrapper" for the avr-gcc binary (but it's the actual ...xc8/v2.00/avr/bin/avr-gcc binary that has the check...)

http://ww1.microchip.com/downloads/en/DeviceDoc/MPLAB_XC8_C_Compiler_User_Guide_for_AVR.pdf

(page 21)

2.7 OPTION DESCRIPTIONS

Most aspects of the compilation can be controlled using the command-line driver, xc8-cc. The driver will configure and execute all required applications, such as the code generator, assembler and linker.

It is recommended, especially for options that control optimizations or other code generation aspects of the compiler, that you limit your use to only those options described in this user’s guide, even if the options are described in the generic GCC documentation. Not all GCC options have been implemented or may not have been tested. In addition, some options use alternate forms to be compatible with other Microchip MPLAB XC compilers, for example the -mcpu option should be used in preference to the -mmcu GCC option, making this aspect of compilation for AVR devices compatible with other Microchip compilers.

...

(page 40)

[3 instances of xc8-gcc]

via https://www.microchip.com/mplab/compilers (XC8 Documents tab)

 

XC8 is per C90 or C99; GCC includes C11.

https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Standards.html#C-Language

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Microchip had PIC8, PIC16, PIC32

Atmel had AVR8, AVR32, ARM9, Cortex-M0,M3,M4,M7, Cortex-A5

 

Now Microchip has all.

Probably they aren't sure yet what to do....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rammon wrote:

Microchip had PIC8, PIC16, PIC32

Atmel had AVR8, AVR32, ARM9, Cortex-M0,M3,M4,M7, Cortex-A5

 

Now Microchip has all.

Probably they aren't sure yet what to do....

And I forgot about the 8051 variants which both had (well, Microchip via SST)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • MPLAB X plays well with other applications (IDE, USB drivers)
  • MPLAB debuggers are reduced price
  • MPLAB debuggers aren't as well ported as EDBG (though there's MDB)

 

MDB: The Microchip Debugger - Developer Help

http://microchipdeveloper.com/mplabx:mdb

 

P.S.

For the ones who operate macOS, MDB is operational via Xcode though it's not completely integrated (right column, last picture) :

chipKIT PGM Programmer-Debugger - Embedded Computing

https://embeddedcomputing.weebly.com/chipkit-pgm-programmer-debugger.html

...

(left column)

As an alternative, the MDB command-line utility programs the board and launches a debugging session.

Finally, embedXcode supports the chipKIT PGM programmer-debugger. embedXcode requires the prior installation of MPIDE and MDB.
...

(bottom)

...

 

P.P.S.

MDB extension of Microsoft Visual Studio Code?

No; GDB's there.

 

https://marketplace.visualstudio.com/search?term=MDB&target=VSCode&category=All%20categories&sortBy=Relevance

https://marketplace.visualstudio.com/search?term=GDB&target=VSCode&category=All%20categories&sortBy=Relevance

https://code.visualstudio.com/

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

In which case what possible motivation is there really for anyone (in Windows) to switch to MPLAB ?

We are sick and tired, fed up, pi$$ed off and otherwise loathing Windows and need it to work with AVR's....MPLAB might be just what I/we need to be able to jump to Linux full time!

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rammon wrote:
Probably they aren't sure yet what to do....
indecision

MCHP Announces Q1FY19 Financial Results.080918.pdf

Chandler, Arizona

August 9, 2018

https://www.microchip.com/investor/Pressrelease/MCHP%20Announces%20Q1FY19%20Financial%20Results.080918.pdf

...

• Record quarterly dividend declared of 36.40 cents per share.

...

Been a long time since Microchip hasn't paid a dividend.

Each product line (8 bit MCU) likely has multiple profit centers one of which is compilers (MPLAB XC8) (Microchip acquired Hi-Tech Software)

Am guessing that the ones at Microchip have a custom AVR code generator for XC8-GCC.

Others have had a go at custom GCC with varying market success; XC8-GCC may have a leg up due to XC8 longevity.

 


HI-TECH Software

Embedded C Compilers and Tools for Software Development:

http://www.htsoft.com/

https://blog.segger.com/the-segger-linker-and-somnium-assets/

 

Edits: 2nd and 3rd URLs

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Fri. Oct 12, 2018 - 11:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

except my Mac doesn't seem to do the "drag" thing :-(

Reply from Microchip:

 on Macs dragging the Icon from the customized dialog to the task bar is a known issue. We collected that from the NetBeans core. However if you move the dialog off the top of the application then drag it appears to work. We then moved it back and it continued to work. So that is an issue already logged, with us and NetBeans.

(One of the stranger bug/workarounds I've seen!)

 

 

 

what possible motivation is there really for anyone (in Windows) to switch to MPLAB ?

More targets (PIC8, PIC16, PIC32, AVR) supported by the same IDE.  Even more than that, if you consider MPLAB as NetBeans.

Maybe I'm just flighty and lazy, but I like playing with chips from different vendors, and having to switch IDEs for each one is annoying.

(Thus my usual style of CLI tools and ancient editor, but...)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes,   it would be nice to have one straightforward IDE that runs on all platforms.

 

If you thought that Atmel Studio was complex and bloated,   you ain't seen nothing yet !

 

I received the Pickit4 today.    The first job was to make an Adapter for 3x2 ISP/PDI and 5x2 JTAG headers to the 8x1 PIC.

This is actually more robust and convenient than the ATMEL-ICE multi-way.    The PIC Adapter that came with the Pickit4 can connect to 1.27mm 5x2 JTAG/SWD (and legacy ARM 2x10 JTAG)

 

There are several issues using Pickit4 in both MPLABX and AS7.

ATMEL-ICE seems to work in MPLABX

 

I tried MPLABX with an old PIC18F458.    Both Pickit2 and Pickit4 had problems.

I have a lot to learn about MPLABX and PIC.

 

David.

Last Edited: Fri. Oct 12, 2018 - 11:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
(Thus my usual style of CLI tools and ancient editor, but...)
Lots of choices in editors; some like Microsoft Visual Studio Code though am assuming you're an Xcode operator.

GitHub - Redouane64/PIC-on-VSCode: VSCode Set-up needed to code for PIC microcontroller using microchip XC 8 compiler.

https://github.com/Redouane64/PIC-on-VSCode

via https://github.com/topics/microchip (might expand it a few times then search for VSCode)

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I received the Pickit4 today.    The first job was to make an Adapter

 I wasn't very happy that the Pickit4 included NO target cables or adapters...  :-(

 

(An adapter set is currently on sale!  Tempting...  https://www.microchipdirect.com/product/search/all/AC102015?utm_source=MarketoEmail&utm_medium=CTA%252CCTA&utm_content=DevTools&utm_campaign=DevToolDeals )

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for that. Did not know.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
I received the Pickit4 today. The first job was to make an Adapter for 3x2 ISP/PDI and 5x2 JTAG headers to the 8x1 PIC.

I also received my kit as well.  That adapter board is AWFUL!    I laughed when I plugged it into the PK4 and noticed that the little telephone jack is no longer accessible  Whatever that is used for

 

It appears that the ultra small 5x2 cable is compatible with all my JTAGICE3 adaptor boards so I may not have to make adapters to use the kit.  Will report back

 

At teh moment I am fighting a project that I am being paid for and I will only be working with this kit part time at the moment.  But I am eager to take the PK4 and the Atmel ICE on a journey through MPLAB

 

I certainly hope that MPLAB does indeed use the AS7 compiler so I dont have to buy one from the Empire.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, bullet bitten - no prior experience with MPLAB. Zero.

 

I went to the Microchip MPLAB download page. https://www.microchip.com/mplab

 

I see MPLAB X IDE. I see MPLAB XC Compilers. I see Emulators and Debuggers. I see MPLAB Software Solutions. I see MPLAB XPress (seems to be cloud something). Which do I need?

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sat. Oct 13, 2018 - 04:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Install the IDE and then install the compiler of your choice.

 

As you say, Xpress is cloud-based.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks.

 

Do I have to add something for debugging, or does the IDE support that directly. The Emulators and Debuggers section leaves me fuzzy about that. It talks about "Extension Packs", for example.

 

And MPLABX 5.0 - is that the beta we are supposed to use? That is not clear from the thread comments, above. I see westfw using 5.05 but I could not find that on the downloads page. What I downloaded shows as 5.00. <EDIT> found 5.05 after a Google search. Got that. </EDIT>

 

Finally, for now, how do I bring in gcc? This is on a Mac with no existing avr-gcc.

 

What is the difference between mplab_ide and mplab_ipe?

 

ATMEGA4890-XPRO - how do I run that from MPLABX?

 

Sorry if I seem thick-headed here. My limited mental capacity is having a real challenge dealing with all this (new) stuff at once!

 

Appreciate everyone's help. 

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sat. Oct 13, 2018 - 07:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
Whatever that is used for
The Debugger Adapter Board's modular jack connects to an MPLAB ICD 4 modular jack via the modular cable provided with the Debugger Adapter Board.

Debugger Adapter Board

https://www.microchip.com/developmenttools/ProductDetails/PartNO/AC102015#additional-summary

(Overview tab)

...

  • 8 CONDUCTOR MODULAR CABLE, 6"

...

http://microchipdeveloper.com/icd4:icd4-components

...

  • A puck-shaped MPLAB ICD 4 unit housed in a durable, black case with a brushed aluminum top which is accented with an LED indicator bar, a Mini-B USB connector, an RJ-45 connector, and a power connector

...

 

Edit: tab

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sat. Oct 13, 2018 - 04:26 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

[Edit: add non-windows info.]

 

Top level page: https://www.microchip.com/mplab/...

 

Windows:  https://www.microchip.com/mplabx...

Mac: https://www.microchip.com/mplabx...

Linux: https://www.microchip.com/mplabx...

 

 

>> (Thus my usual style of CLI tools and ancient editor, but...)

Lots of choices in editors; some like Microsoft Visual Studio Code though am assuming you're an Xcode operator.

 Nah; Much more ancient than that, and Xcode lacks the "runs on many platforms" feature.

I picked EMACS back when it ran on TOPS-20, ITS, TOPS-10 ("FINE") AND CP/M ("MINCE")

I haven't had much cause to look for anything else.  Though I do miss TECO minibuffers :-(

 

"Visual Studio Code" looks pretty nice; not at all in the style of most modern IDEs.  Only about 200MB for the base install.  (I guess that doesn't include the js runtime environment.  But still...)   (Where did it COME from?)

Last Edited: Sun. Oct 14, 2018 - 01:31 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bill Jim wants the MAC version. wink

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Got the Mac version of MPLABX 5.05. The BIG question, right now, is how to add avr-gcc? Various folks, above, mention doing it, but I have no clue about how to do it, myself.

 

Particularly partial to TextWrangler, here. But, if the included editor is adequate, including multi-file searches, then I can probably live with it.

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sun. Oct 14, 2018 - 01:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
The BIG question, right now, is how to add avr-gcc?
from MPLAB X 5.05 release notes file 'Readme for MPLAB X IDE.htm' :

5.3       Compilers

...

Atmel Compiler (1)

...

  1. Install this compiler in the same location as MPLAB XC compilers so MPLAB X IDE can find them, e.g.;
    C:\Program Files\microchip\ARM_GCC
  2. ...

so .../microchip/AVR_GCC

am uncertain on the '...' for macOS; apparently /Applications per https://www.avrfreaks.net/forum/mplabx-first-users#comment-2569416
IIRC for Linux for other non-Microchip software it's typically /opt/...

 

Edit: macOS directory

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Oct 31, 2018 - 10:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
(Where did it COME from?)
Microsoft's FOSS effort :

InfoWorld

Bossie Awards 2016: The best open source application development tools

by 

Sep 21, 2016

http://www.infoworld.com/article/3120996/application-development/bossie-awards-2016-the-best-open-source-application-development-tools.html#slide11

Visual Studio Code

[Typescript, Electron shell]

...

via https://www.avrfreaks.net/forum/avr-studio-mac-linux#comment-1986336

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The BIG question, right now, is how to add avr-gcc?

On windows, where I had AS installed in the normal place, it discovered it all by itself.

 

I don't recall whether it do so on my Mac, where I have a set of several versions of avr-gcc in /usr/local/..., but it's pretty painless to add it via Preferences/Embedded/BuildTools/Add (all it needs is the base "bin" directory.)   Aside from have inconveniently narrow windows and a non-Mac-Style directory browser...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:

Got the Mac version of MPLABX 5.05. The BIG question, right now, is how to add avr-gcc? Various folks, above, mention doing it, but I have no clue about how to do it, myself.

 

Particularly partial to TextWrangler, here. But, if the included editor is adequate, including multi-file searches, then I can probably live with it.

 

Thanks

Jim

 

I think this is the link for Mac: https://www.microchip.com/mymicr...

 

You install this somewhere, then point the IDE to the .../bin folder as described in the post above.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, folks...

 

That should get me started.

 

I feel embarrassed to ask this, but, in recent half-dozen years, I've just gotten avr-gcc as it comes with Atmel Studio. I know that there is an older version banging around in the ethers, but where does one get the up-to-date version? Google leads me to: https://www.microchip.com/mplab/... but it talks about "source code" and I have no idea what to do with that on a Mac! This is what happens when you are "just a GUI driver"!

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sun. Oct 14, 2018 - 11:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is what happens when you are "just a GUI driver"!

And NOT a Luddite like some others using CLI...... devil

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Scroll further to the download section...

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you Morten!

 

THAT is what happens when a GUI driver does not think!

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The compiler version you can get from Microchip is currently 5.4.0, while gcc is currently in version 8. This may seem terribly outdated, but really there are no amazing improvements.

Yes, the optimization is somewhat better; for a project I have, code size is 2444 bytes with near bleeding edge avr-gcc 8.1.0 and 2626 bytes with the current Microchip version. When you look at the assembly listing, you can see the compiler is indeed a bit smarter in more recent versions.

The ISR prologue/epilogue is the most significant improvement.

 

But I use pre-built versions, I never tried to build gcc and binutils from source, I believe this is quite a task.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
... I never tried to build gcc and binutils from source, I believe this is quite a task.
That's common; during Gentoo stage 3, gcc is built.

The following is for arm-eabi :

Prebuilt GNU Toolchains for Windows

Building your own GNU toolchains

http://gnutoolchains.com/building/

 


https://wiki.gentoo.org/wiki/Stage_tarball

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe I'll give it a try one of these days.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not sure I trust the newer gcc versions for AVR, given the way that "the greater gcc community" tends to ignore "minor players."

The version of gcc that comes with MPLAB is avr-gcc (AVR_8_bit_GNU_Toolchain_3.6.2_42) 5.4.0, which seems to have at least one bug in addition to the -O1 limitation:

 

I’ve confirmed by bypassing the XC8 “wrapper”, but still using the avr-gcc distributed with XC8, gives incorrect results - I get the vectors at location 200, but the rest of the code at low addresses…

 

/Applications/microchip/xc8/v2.00/avr/bin/avr-gcc -mmcu=atmega4809 -g -O1 main.c uart.c clock.c -B /Applications/microchip/mplabx/v5.05/packs/Atmel/ATmega_DFP/1.2.258/gcc/dev/atmega4809/ -I  /Applications/microchip/mplabx/v5.05/packs/Atmel/ATmega_DFP/1.2.258/include/ -Wl,--section-start=.text=0x200

avr-gcc (AVR_8_bit_GNU_Toolchain_3.6.2_42) 5.4.0

 

Disassembly of section .text:

00000200 <__vectors>:

 200:   4f c0           rjmp    .+158           ; 0x2a0 <__ctors_end>

 202:   00 00           nop

 204:   9c cf           rjmp    .-200           ; 0x13e <__bad_interrupt>

:

Disassembly of section .text:

00000000 <mainx>:

int mainx(int argc, char** argv) {

VPORTB.DIR = 0xFF;

   0:   8f ef           ldi     r24, 0xFF       ; 255

   2:   84 b9           out     0x04, r24       ; 4

 

 

 

While using the same command line with the stack Atmel avr-gcc (theoretically the latest version) gives correct results:

 

avr-gcc (AVR_8_bit_GNU_Toolchain_3.6.1_495) 5.4.0

Copyright (C) 2015 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

WWHackintosh<10043> avr-gcc -mmcu=atmega4809 -g -O1 main.c uart.c clock.c -B /Applications/microchip/mplabx/v5.05/packs/Atmel/ATmega_DFP/1.2.258/gcc/dev/atmega4809/ -I  /Applications/microchip/mplabx/v5.05/packs/Atmel/ATmega_DFP/1.2.258/include/ -Wl,--section-start=.text=0x200 

 

Disassembly of section .text:

 

00000200 <__vectors>:

 200:   0c 94 50 01     jmp     0x2a0   ; 0x2a0 <__ctors_end>

 204:   0c 94 5a 01     jmp     0x2b4   ; 0x2b4 <__bad_interrupt>

 208:   0c 94 5a 01     jmp     0x2b4   ; 0x2b4 <__bad_interrupt>

:

000002b8 <mainx>:

int mainx(int argc, char** argv) {

VPORTB.DIR = 0xFF;

 2b8:   8f ef           ldi     r24, 0xFF       ; 255

 2ba:   84 b9           out     0x04, r24       ; 4

 

So it looks like some error introduced in the XC8 built of avr-gcc, rather than something in the xc8 wrapper.

(The presence of "rjmp" in the vectors is interesting as well, given no "-mrelax" on the compile command (MPLAB does not provide -mrelax by default, and I've noticed that in other parts of my code I get long calls, so it doesn't seem to be "defaults to -mrelax.")  (my code is too simple to tell whether the rjmp vectors are a bug...)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is the version of the linker (ie "binutils") in each case? If anything the issue appears to be in the -Wl,-section-start as it appears to have failed to move __bad_interrupt which appears to have been left down closet to 0x0000.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmm.  Claims to be the same base:

 

WWHackintosh<10065> /Applications/microchip/xc8/v2.00/avr/bin/avr-ld --version
GNU ld (AVR_8_bit_GNU_Toolchain_3.6.2_42) 2.26.20160125

WWHackintosh<10066> avr-ld --version
GNU ld (AVR_8_bit_GNU_Toolchain_3.6.1_495) 2.26.20160125
 

I had thought it was everything but the crt stuff that got left in low memory, but perhaps it was ONLY the vectors that got moved up...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am not having much luck debugging an ATmega328p with my JTAGICE3 using MPLAB.

Even after the rather painful "upgrade the jtagice3 to most recent firmware" dance, lots of things go wrong with MPIDE.

It doesn't claim that JTAGICE3 is unsupported, and it "sometimes" succeeds in programming the 328, but debugging seems to hang in ways that aren't undoable without restarting MPLAB.

 

(This was just an experiment.  Tomorrow's experiment, maybe: Atmel ICE.  (But Tuesday I'm off to Disneyland!))

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's sure how it looks from this line:

204:   9c cf           rjmp    .-200           ; 0x13e <__bad_interrupt>

The ". - 200" is almost all the way back to the default start. Meanwhile the gcrt1.S has this:

191	        .text
192	        .global __bad_interrupt
193	        .func   __bad_interrupt
194	__bad_interrupt:
195	        .weak   __vector_default
196	        .set    __vector_default, __vectors
197	        XJMP    __vector_default
198	        .endfunc

So __bad_interrupt is just in plain ".text" not in one of the .init or .fini sections (which I guess makes sense as it's a CALL/RET function)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the Pickit4 included NO target cables or adapters...

Did you look under the carrier box? Mine were there.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the little telephone jack is no longer accessible  Whatever that is used for

I think thats the standard PIC debug connector, it should be an upright connector in this case but as we are not using PICs who cares......devil

 

The compiler and assembler?? installed for Studio were detected.

 

Just had a quick run of MPLABX, assembler of course, and the code assembled correctly but could not start a DW session, no time today to do more.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

John,

 

Bill bought a regular Pickit4.   It only comes with USB cable.

 

You have got an "extra" Adapter and ribbons.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I had thought it was everything but the crt stuff that got left in low memory, but perhaps it was ONLY the vectors that got moved up...

 

/Applications/microchip/xc8/v2.00/avr/bin/avr-gcc -mmcu=atmega4809 -g -O1 main.c uart.c clock.c -B /Applications/microchip/mplabx/v5.05/packs/Atmel/ATmega_DFP/1.2.258/gcc/dev/atmega4809/ -I  /Applications/microchip/mplabx/v5.05/packs/Atmel/ATmega_DFP/1.2.258/include/ -Wl,--section-start=.text=0x200

 

 avr-nm -n a.out|grep ' [tT] '
00000000 T mainx          ;; my code
0000001c T delay_onesec   ;;
00000030 T main           ;;
0000009c T uart_putc      ;;  :
000000ac T uart_init
000000c6 T uart_puts
000000e6 T uart_banner
000000ec T uart_getc
00000102 T clock_init     ;; end of my code.
0000010c T __bad_interrupt
00000200 T __vectors
000002a0 t .dinit
000002a0 T __ctors_end
000002a0 T __ctors_start
000002a0 T __dtors_end
000002a0 T __dtors_start
000002a0 T __trampolines_end
000002a0 T __trampolines_start
000002b4 T _exit
000002b6 t __stop_program
000002b8 T _etext

 

 

I supposed it could be a bad linker script?

 

Hmm. I don't really understand linker scripts very much, but I don't see the mplab linker script including *(.text) (as inputs?) to .text (as output?)

Is that a problem?

 

 diff -u /usr/local/CrossPack-AVR/avr/lib/ldscripts/ ./avr/lib/ldscripts/avrxmega3.x
--- /usr/local/CrossPack-AVR/avr/lib/ldscripts/avrxmega3.x      2018-06-13 13:53:05.000000000 -0700
+++ ./avr/lib/ldscripts/avrxmega3.x     2018-05-03 06:34:40.000000000 -0700
@@ -89,6 +89,7 @@
     KEEP(*(.vectors))
     /* For data that needs to reside in the lower 64k of progmem.  */
      *(.progmem.gcc*)
+     KEEP(*(.dinit))
     /* PR 13812: Placing the trampolines here gives a better chance
        that they will be in range of the code that uses them.  */
     . = ALIGN(2);
@@ -100,7 +101,6 @@
     /* avr-libc expects these data to reside in lower 64K. */
      *libprintf_flt.a:*(.progmem.data)
      *libc.a:*(.progmem.data)
-     *(.progmem*)
     . = ALIGN(2);
     /* For future tablejump instruction arrays for 3 byte pc devices.
        We don't relax jump/call instructions within these sections.  */
@@ -139,9 +139,6 @@
     KEEP (*(.init8))
     *(.init9)  /* Call main().  */
     KEEP (*(.init9))
-    *(.text)
-    . = ALIGN(2);
-     *(.text.*)

     . = ALIGN(2);
     *(.fini9)  /* _exit() starts here.  */
     KEEP (*(.fini9))
@@ -174,8 +171,6 @@
   .data          :
   {
      PROVIDE (__data_start = .) ;
-    *(.data)
-     *(.data*)
     *(.gnu.linkonce.d*)
     . = ALIGN(2);
      _edata = . ;
@@ -184,8 +179,6 @@
   .bss  ADDR(.data) + SIZEOF (.data)   : AT (ADDR (.bss))
   {
      PROVIDE (__bss_start = .) ;
-    *(.bss)
-     *(.bss*)
     *(COMMON)
      PROVIDE (__bss_end = .) ;
   }  > data

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Microchip says (they're continuing to be very responsive!):

 

<Code location>

To position the entire .text and .data sections, the linker options -Ttext=<addr> and -Tdata=<addr> can be used.

To allocate a single function, the section attribute along with the __at() attribute can be used.

 

As part of BFA Implementation, there is no single output section (.text) that contains all code. BFA creates multiple output sections for best-fit allocation.

So, the "-Wl,--start-section" option will work only for the sections mapped through the linker scripts. Currently in the linker script, vectors, initN functions, ctors/dtors, etc are mapped. Only these sections get moved by specifying that option.

-Ttext=0x200 does indeed seem to solve the problem...

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

PICkit4 just arrived. Thanks!

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am not having much luck debugging an ATmega328p with my JTAGICE3 using MPLAB.

Tomorrow's experiment, maybe: Atmel ICE.

Alas, not having any luck with MPLAB trying to debug a 328p, using JTAGICE3, AtmelICE, or mx328p Xplained Mini.

It looks like it's not managing the whole ISP/DebugWire dance correctly, perhaps even at the GUI level.  (I can "program" the 328, and if it's in debugwire mode I get a nice popup about "you'll have to leave DW mode to change config bits.   When I debug, it hangs after doing the device reset.  But if I unplug the board, the same popup appears (too late, since the board is unplugged and the IDE is leaving debug mode.)

 

It also doesn't seem to be able to change the config bits, either automatically or manually.  Wants me to read them from the device first, but fails with a "no such memory type" or similar.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, 5.05 has problems with dW and cannot do lockbits on ISP. Both issues fixed in 5.10.

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That may explain my problem then with the M88PA, I will try a JTAG board tomorrow.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh good; I was getting worried about how to write up all the different problems I was seeing, I was essentially hoping to say "It's just really broken" and get a "we know; sorry!" sort of response.

(although, it would have been nice to know this sooner - is there a public "bugs" list somewhere?)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

They can see you have lots of hair to pull.......

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Heh.  I'm just fooling around - "no skin in the game" so to speak.  But I've been on the other side of the bug-reporting, and I know how frustrating it can be to get an issue of the form "this doesn't seem to work at all."  :-)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
-Ttext=0x200 does indeed seem to solve the problem...
Then that's weird. I have always treated -Ttext= and -section-start=.text= as synonyms (first just easier to type!) so there's a regression here if on behaviour changed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tried the IPE and it's pretty much useless for AVRs...apart the fact that it doesn't work. The chip is in ISP mode but can't read or even erase the chip, apart from the fact that there is no fuses, lockbits or EEPROM windows. Let's see if MPLAB does a better job.

 

 

 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MPLAB is not much better, I assembled the project (getting around the assembler easily enough) but then I just wanted to program the chip without debugging (DW which is broken at the moment).

 

At first it says that it detects target power (chip is running older code) but then it says it can't see it and also cannot disable DW which is already disabled (checked with Studio).

 

It also says Erasing but the chip is still running the old code (again verified with Studio comparing to the old hex file).