#30 Support for 18F4620

closed
nobody
None
5
2011-04-19
2011-01-15
Sebastian Kosch
No

Gentlemen,

there are a couple of 18F-series processors I would love to be able to simulate, particularly the 4620.
How is the support implemented in the source code? Could I write my own code to add support? How easy is it to translate data sheets into gpsim source code? In other words, is it feasible for the uninitiated to do so within, say, two afternoons?

Thanks for your amazing work! :)
Sebastian

Discussion

  • Robert Pearce
    Robert Pearce
    2011-01-15

    Well, it's not as easy as we'd like but not as hard as some people think.

    Each supported PIC is implemented as a C++ class derived from a one of the core PIC family classes. In fact, most are derived from other real PICs rather than directly from the PIC18 or equivalent. If your desired new processor is similar to an existing supported one then it's quite easy - you either copy the existing class or derive from it, then make the necessary changes. Every once in a while somebody demands that we make this process easier, but as yet nobody has come up with an actual thought-out proposal for how. It's actually quite hard, even without the whole legacy issue.

    In your case, the 4620 looks quite similar to the already-supported 4321. You will need to compare the two data sheets and see what's different. Memory size is trivial to handle - in fact you should create the whole family of devices covered by one data sheet if memory is the only difference, because it's helpful and will only take an extra five minutes. Changes in memory map or different peripherals is slightly harder. A new peripheral or variant that isn't yet supported starts to get hard.

    Anyway, I'd say it's not too hard in most cases. One of the very first things I did with GPSim when I discovered it was to add a new device type (three times - I kept using unsupported PICs!). At the time I had limited and rusty C++ and no prior knowledge of GPSim, and I managed to create new device patches fairly fast. So I'd say give it a try; if it proves too hard then you may be lucky and one of us might find time, but you might have to wait for a while!

    Oh, and make notes. We keep meaning to at least document this process somewhere, but if someone outside the developer "team" were to provide a starting point for that we'd be far more likely to actually do it ;)

     
  • That's a more detailed answer than I was hoping for! I'm quite busy myself at the time, but maybe I'll find the time sometime next week or the week after. If I produce anything useful I'll post it to the devel list!

    Cheers,
    Seb

     
  • Torben
    Torben
    2011-01-16

    Actually I've added support for 18F4620. I have attached patches below. It's a while ago I made it so I hope it is compatible with current CVS. It is based on P18F4x21 as bdt-rod sort of suggest. I also added a 8 bit wide, up to 65536 bytes long EEPROM.
    It has been tested in all the ways I could think of, but probably not exhaustively.

    /Torben

     
  • Torben
    Torben
    2011-01-16

    Ehh, I intended to attach the patches, but seems I can't. Is there a place to upload?

    /Torben

     
  • Wow, fantastic! I guess you could post the additions to the devel list, and/or email them to me directly?

    Thank you!
    -Seb

     
  • Robert Pearce
    Robert Pearce
    2011-01-16

    It seems you can only attach files when creating a tracker ticket. Please post your patches to the developer list, or create a new "patch" tracker item.

     
  • Robert Pearce
    Robert Pearce
    2011-01-30

    I've looked at Torben's patch and am working on fixing it so that proper 18F4620 support can be added. If sebastian wishes to make progress immediately, the patch does apply cleanly and looks like it will work sufficiently for testing. The problems relate to erroneous extra functionality that shouldn't be there.

     
  • That's great news! Many thanks Torben and Rob!
    I've been way too busy myself lately to work on my project, but will definitely grab the patch and see how it goes before next week.
    Again, thank you!

     
  • Robert Pearce
    Robert Pearce
    2011-02-03

    18F4620 added to SVN at r2152. I've only tested it fairly briefly, but it should be OK.

     


Anonymous


Cancel   Add attachments