Menu

16F-12F TMBL+ Bootloader Generator

Anobium
2020-09-18
2023-03-19
  • Anobium

    Anobium - 2020-09-18

    Introduction

    I have written a new bootloader generator for 16f and 12Fs. The new bootloader generator is fully automatic in generating a bootloader that is specific to a specific requirement.

    This resovle the configuration of the bootloader - is very very simple and very fast.

    Users can configure the following:

    • Frequency
    • Baud Rate
    • Startup Delay
    • Serial Ports - either PPS or AFP

    I have, at the moment, limited support to chips with USART. If there is a real need for non-USART chips then I may consider it.

    The purpose of the new bootloader generator is establish a new level of quality in terms of the generated bootloader.

    How does this work?

    The new bootloader generator is wrttien in Great Cow BASIC and the new bootloader generator uses all the intelligence witin Great Cow BASIC to control the 500 chips configurations.

    Set produce a HEX is very simple.

    • Set the chip and frequency - like #chip 16f18855,4
    • Set the baud rate - like USART_BAUD_RATE 115200
    • Set the PPS - using PPSTool - so this is very simple
    • Set the AFP - if needed
    • Done.

    The generated ASM is past automatically via MPASMX to generate the HEX.


    Clearly this is a little more complex in the background but we using the power of Great Cow BASIC and Microchip to produce the HEX.

    Examples

    If you want to try the new HEX please ping me. State the requirements

    • Frequency
    • Baud Rate
    • Startup Delay
    • Serial Ports - using ether PPS or AFP

    Chips - there are probably 100s more
    NVM CHIPS: FAMILY 21: 16F15313, 16F15323, 16F15324, 16F15325, 16F15344, 16F15345, 16F15354, 16F15355, 16F15356, 16F15375, 16F15376, 16F15385, 16F15386, 16F18313, 16F18323, 16F18324, 16F18325, 16F18326, 16F18344, 16F18345, 16F18346, 16F18424, 16F18425, 16F18426, 16F18444, 16F18445, 16F18446, 16F18455, 16F18456, 16F18854, 16F18855, 16F18856, 16F18857, 16F18875, 16F18876, 16F18877, 16F19155, 16F19156, 16F19175, 16F19176, 16F19185, 16F19186, 16F19195, 16F19196, 16F19197, 16LF15313, 16LF15323, 16LF15324, 16LF15325, 16LF15344, 16LF15345, 16LF15354, 16LF15355, 16LF15356, 16LF15375, 16LF15376, 16LF15385, 16LF15386, 16LF18313, 16LF18323, 16LF18324, 16LF18325, 16LF18326, 16LF18344, 16LF18345, 16LF18346, 16LF18424, 16LF18425, 16LF18426, 16LF18444, 16LF18445, 16LF18446, 16LF18455, 16LF18456, 16LF18854, 16LF18855, 16LF18856, 16LF18857, 16LF18875, 16LF18876, 16LF18877, 16LF19155, 16LF19156, 16LF19175, 16LF19176, 16LF19185, 16LF19186, 16LF19195, 16LF19196
    PM CHIPS: FAMILY 18: 16LF18346, 16LF18345, 16LF18344, 16LF18326, 16LF18325, 16LF18324, 16LF18323, 16LF18313, 16LF1789, 16LF1788, 16LF1779, 16LF1778, 16LF1777, 16LF1776, 16LF1773, 16LF1769, 16LF1768, 16LF1765, 16LF1764, 16LF1719, 16LF1718, 16LF1717, 16LF1716, 16LF1713, 16LF1709, 16LF1708, 16LF1707, 16LF1705, 16LF1704, 16LF1703, 16LF1619, 16LF1618, 16LF1615, 16LF1614, 16LF1613, 16LF1579, 16LF1578, 16LF1575, 16LF1574, 16LF1567, 16LF1566, 16LF1559, 16LF1554, 16LF1459, 16LF1455, 16LF1454, 16F18346, 16F18345, 16F18344, 16F18326, 16F18325, 16F18324, 16F18323, 16F18313, 16F1789, 16F1788, 16F1779, 16F1778, 16F1777, 16F1776, 16F1773, 16F1769, 16F1768, 16F1765, 16F1764, 16F1719, 16F1718, 16F1717, 16F1716, 16F1713, 16F1709, 16F1708, 16F1707, 16F1705, 16F1704, 16F1703, 16F1619, 16F1618, 16F1615, 16F1614, 16F1613, 16F1579, 16F1578, 16F1575, 16F1574, 16F1459, 16F1455, 16F1454, 12LF1612, 12LF1572, 12LF1571, 12F1612, 12F1572, 12F1571
    EE CHIPS: FAMILY 14: 16f1782, 16f1783, 16f1784, 16f1786, 16f1787, 16f1788, 16f1789, 16f1823, 16f1824, 16f1825, 16f1826, 16f1827, 16f1828, 16f1829, 16f1829lin, 16f1847, 16f1933, 16f1934, 16f1936, 16f1937, 16f1938, 16f1939, 16f1946, 16f1947, 16lf1782, 16lf1783, 16lf1784, 16lf1786, 16lf1787, 16lf1788, 16lf1789, 16lf1823, 16lf1824, 16lf1824t39a, 16lf1825, 16lf1826, 16lf1827, 16lf1828, 16lf1829, 16lf1847, 16lf1933, 16lf1934, 16lf1936, 16lf1937, 16lf1938, 16lf1939, 16lf1946, 16lf1947,

    Next?

    Working on the same for the 18f range.


    PING ME for a sample HEX!!

     
  • Anobium

    Anobium - 2020-09-18

    This is an example ASM generated. The example shows the level of integration with Great Cow BASIC.

    This is automatically generated with any changes from the default being made in the PICINFO.EXE software. PICINFO validates the config.

     LIST p=16F18854, r=DEC
    #include <P16F18854.inc>
     __CONFIG _CONFIG1, _CLKOUTEN_OFF & _RSTOSC_HFINT32 & _FEXTOSC_OFF
     __CONFIG _CONFIG2, _MCLRE_OFF
     __CONFIG _CONFIG3, _WDTE_OFF
     __CONFIG _CONFIG4, _LVP_OFF
     __CONFIG _CONFIG5, _CPD_OFF & _CP_OFF
    

    Memory location are automatically calculated (NOT A SCRIPT) but from the Great Cow BASIC chip definition file. Memory sizes and memory maps are Great Cow BASIC constants.

    ;Start of the main program

      #define BUFFER_SIZE     80
      #define BUFFER_LOCATION 0x0020
      errorlevel            -302, -306
      #DEFINE FIRST_ADDRESS 3996
      CBLOCK  ( 512 - 7 )
      __CHECKSUM
      __I
      __COUNTER
      __FLAG
      __CNT1
      __CNT2
      __CNT3
      ENDC
      ORG 3996
      ORG 4000
    

    Registers and setup already existed in Great Cow BASIC, so the generator simply uses these constants to populate variable calcs and register names.

    ENTERBOOTLOADER
      movlp ( 4096 >> 8 ) -1
      bsf FSR0H,0
      movlw ( RC1REG & 255 )
      movwf FSR0L
    CONFIGOSCILLATOR
      movlw 96
      banksel OSCCON1
      movwf OSCCON1
      movlw 6
      movwf OSCFRQ
    

    PPS is integrated with the PPSTOOL. To make the setup of PPS easy.

    PPSLOCKCONTROL
      movlw 20
      banksel RC6PPS
      movwf RC6PPS
      bcf ANSELC,7
      movlw 23
      banksel RXPPS
      movwf RXPPS
    

    The same source program supports three different chip architectures

    NVMCON1SUPPORT
    PMCON1SUPPORT
    EEMCON1SUPPORT
    

    As part of the project I have also updated the TBL+ exe. This is now version 12.4

    The new version includes programming the bootloader using PICKitPlus, new support for interbyte transmissions, improved GUI experience.


    Enjoy!!

     
  • Anobium

    Anobium - 2020-09-22

    I should share the update to documentation. This shows the configuration. This is very useful to validate the config.

    ;Start of the main program
    ;asm showdebug ';CHIPARCHITECTURE = 1 = NV Memory
    ;asm showdebug ';CHIPARCHITECTURE = 2 = PM Memory
    ;asm showdebug ';CHIPARCHITECTURE = 4 = EE Memory
        #DEFINE _CHIPARCHITECTURE .. 1
    
    
    
        #DEFINE _IDTYPEPIC ............ 220[DECIMAL]
        #DEFINE _CHIP ................. 16F19156
        #DEFINE _FREQUENCY ............ 32 MHZ
        #DEFINE _BAUD RATE ............ 115200
        #DEFINE _PROGMEM WORDS ........ 16384
        #DEFINE _RAM BYTES ............ 2048
        #DEFINE _CHIPFAMILY ........... 15
        #DEFINE _EEMEMORY BYTES ....... 256
        #DEFINE _SAFMEMORY WORDS ...... 128
        #DEFINE _HEFMEMORY WORDS ...... 0
        #DEFINE _HEFSAFMANAGED WORDS .. 96
        #DEFINE _PPS_CHIP ............. YES
        #DEFINE _PPS_CONFIG_DEFINED ... YES
        #DEFINE _PPSTOOLPART .......... 16F19156
        #DEFINE _TIMERDELAY ........... 1 SECS
    

    This specific config shows - the IDTYPEPIC which relates to the PICCODES.INI, the chip and that the chip IS PPS, the PPS is configured, and the PPS is related to this chip (not another in error), the SAF memory protected (96 bytes). This also shows at the top the memory architecture - this is a type 1 therefore a NV memory chip.

    Other parameters include TNBL+ timer delay, Baudrate and other key chip parameters.

    There is error checking. An error message will be shown - If PPS setup does not match the selected chip or the SAF/HEF is not availiable but has been specified. Examples follow:

    WARNING_PPS_MISMATCH_OR_INCORRECT_PPS_SETTING


    This documentation really helps get the bootloader working at the first attempt.

     
  • Anobium

    Anobium - 2020-09-26

    I have now added the following microcontrollers to the automatic generator process.

    Target chips: 16f707, 16f720, 16f721, 16f722, 16f722a, 16f723, 16f723a, 16f724, 16f726, 16f727, 16f73, 16f737, 16f74, 16f747, 16f76, 16f767, 16f77, 16f777, 16f87, 16f870, 16f871, 16f873, 16f873a, 16f874, 16f874a, 16f876, 16f876a, 16f877, 16f877a, 16f88, 16f882, 16f883, 16f884, 16f886, 16f887, 16lf707, 16lf720, 16lf721, 16lf722, 16lf722a, 16lf723, 16lf723a, 16lf724, 16lf726, 16lf727, 16lf73, 16lf74, 16lf747, 16lf76, 16lf767, 16lf77, 16lf777, 16lf87, 16lf870, 16lf871, 16lf873, 16lf873a, 16lf874, 16lf874a, 16lf876, 16lf876a, 16lf877, 16lf877a, 16lf88

    If this has an 16f part listed about and there is no 16LF part then you can assume it is supprorted.


    The following parameters can be changed to meet specific needs:

    Frequency
    Baud Rate
    Startup Delay
    Serial Ports via AFP (if available)
    Configuration


    This is an example report for 16F886

    ;Start of the main program
        #DEFINE _TOOLVERSION .......... 1.04
    
    
    ;asm showdebug ';CHIPARCHITECTURE = 1 = NV Memory
    ;asm showdebug ';CHIPARCHITECTURE = 2 = PM Memory
    ;asm showdebug ';CHIPARCHITECTURE = 4 = EE Memory
        #DEFINE _CHIPARCHITECTURE .. 4
    
    
    
        #DEFINE _IDTYPEPIC ............ 170[DECIMAL]
        #DEFINE _CHIP ................. 16F886
        #DEFINE _FREQUENCY ............ 8 MHZ
        #DEFINE _BAUD RATE ............ 115200
        #DEFINE _PROGMEM WORDS ........ 8192
        #DEFINE _RAM BYTES ............ 368
        #DEFINE _CHIPFAMILY ........... 14
        #DEFINE _EEMEMORY BYTES ....... 256
        #DEFINE _TIMERDELAY ........... 1 SECS
    

    The tooling generates HEX of less than 100 words.

     

    Last edit: Anobium 2020-09-29
  • Anobium

    Anobium - 2020-09-27

    Now added a user report.

    This report is generated automatically and pulls togther the information from the GCB source, the ASM and LST file generated.

    This is useful documentation.

    TOOLVERSION .......... 1.04B
    
    
    
    IDTYPEPIC............  0xAA [PICCODES.INI] 
    CHIP ................. 16F886
    FREQUENCY ............ 8 MHZ
    BAUD RATE ............ 115200
    PROGMEM WORDS ........ 8192
    RAM BYTES ............ 368
    CHIPFAMILY ........... 14
    EEMEMORY BYTES ....... 256
    CHIPARCHITECTURE ..... 4
    
    
    TIMERDELAY ........... 1 SECS
    
    
    APFCONTROL: NOP 'TXSEL = 0: RXSEL = 0
    
    MEMORY USAGE MAP ('X' = Used,  '-' = Unused)
    
    0000 : XXX------------- ---------------- ---------------- ----------------
    1F80 : ---------------- ------------XXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
    1FC0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX-
    2000 : -------XX------- ---------------- ---------------- ----------------
    
    All other memory blocks unused.
    
    Program Memory Words Used:   102
    Program Memory Words Free:  8090
    

    Updated with the latest automatic report.

     

    Last edit: Anobium 2020-09-28
  • Sark Mevachko

    Sark Mevachko - 2021-09-21

    (My first post on SourceForge) Yer Tiny Bootloader+ is great and the bootloader generator sounds cool. Is the generator code/executable available somewhere?

    Thanx

     
    • Anobium

      Anobium - 2021-09-25

      I can create a bootloader for chips for 'beer money!'. We have updated the generator to create bootloaders for chips that require PICAS.

      Send me a Personal message to let me know what chip you need bootloader for.

      :-)

       
  • Moi

    Moi - 2022-11-21

    Hello

    Firstly thanks for sharing your bootloader !

    But i'm completly loste with available files, i like to found a bootloader UART for 16F1825 this one seem to be in the compatibility list but the file are missing.

    Reading this post you says "PING ME for a sample HEX!!" so is possible to have something ?

    Best regards

     
    • Anobium

      Anobium - 2022-11-21

      Create a new posting with your chip name (so, others can find it). I will then put a bootloader on the new post.

       
  • David Brooks

    David Brooks - 2022-12-02

    Hi,
    This is really awesome work you've put into this. I was looking for a PIC16LF18346 bootloader.

    Was wondering if you already have a precompiled version I could try?

    Thanks!

     
    • Anobium

      Anobium - 2022-12-02

      Thank you.

      See the PDF. What needs to be changed?

      So, you are aware I have re-written this is Great Cow BASIC and I still plan to web enable this to make this automated.

      Let me know what changes are needed. Please ignore the config as you can edit at your end with ease.

       
      • David Brooks

        David Brooks - 2022-12-02

        Thanks for the quick reply! The only change I can see is the part is a LF version. I think I can test it out with all the other settings.

        Very interested in the web enable. Will this be a website, or though an application?

        Thanks again

         
        • Anobium

          Anobium - 2022-12-02

          Great. The LF is no different.

          Send me a PM or to my email (see https://www.pickitplus.co.uk/Typesetter/index.php/About-Us).

          I am thinking web server. I may get time to work on it early next year.

           
  • Terry Platt

    Terry Platt - 2023-03-19

    Hi Anobium,

    Have you written any bootloader support for the 18F series? Specifically the 18F16Q40?
    Thanks!

     
    • Anobium

      Anobium - 2023-03-19

      Maybe later this week.

      I am truly working on this with Microchip. The program in terms of the source is complete by for the Q10 I cannot use MPASM and therefore I must use PIC-AS ( the latest tool for these chips).

      I have an engineer allocated to help me this week and as I write this I writing up the technical specification of TBL+ for the engineer.

      So, check back next week.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.