Menu

Bootloader of 84 words

Dan
2013-12-08
2018-05-24
  • Dan

    Dan - 2013-12-08

    Hi,All,

    I introduce it because we succeeded in developing a 84 word firmware in PIC10F322.

    [Way of thinking]
    1 second loop using cnt1, cnt2, cnt3 the Receive routine requires a lot of code.
    To shorten the code using the WDT (2 seconds initial).

    [Before]
    IntrareBootloader:
    clrf ANSELA ; digital I/O
    #ifdef Direct_TX
    bcf LATA,TX
    #else
    bsf LATA,TX
    #endif
    bcf TRISA,TX ; set TX Port
    call Receive ; init int clock & serial port
    ; wait for computer
    sublw 0xC1 ; Expect C1
    skpz
    goto way_to_exit ; connection errer or timeout

    Receive: movlw xtal/2000000+1 ; for 20MHz => 11 => 1second
    movwf cnt1
    rpt2: clrf cnt2
    rpt3: clrf cnt3
    rptc: ; check Start bit
    #ifdef Direct_RX
    btfss PORTA,RX
    #else
    btfsc PORTA,RX
    #endif
    goto $+4
    call r1rx11 ; recive data
    addwf crc,f ; compute checksum
    return

                decfsz  cnt3,f
                goto    rptc
                decfsz  cnt2,f
                goto    rpt3
                decfsz  cnt1,f
                goto    rpt2
    

    way_to_exit: goto first_address ; timeout:exit in all other cases

    [After]
    IntrareBootloader:
    btfss STATUS,NOT_TO
    goto first_address ; connection errer or timeout

        clrf    ANSELA          ; digital I/O
    

    #ifdef Direct_TX
    bcf LATA,TX
    #else
    bsf LATA,TX
    #endif
    bcf TRISA,TX ; set TX Port
    call Receive ; init int clock & serial port
    ; wait for computer
    sublw 0xC1 ; Expect C1
    skpz
    goto first_address ; connection errer or timeout

    Receive: bsf WDTCON,SWDTEN ; start WDT(2s)

        #ifdef  Direct_RX
                btfss   PORTA,RX
        #else
                btfsc   PORTA,RX
        #endif
                goto    $-1
    
                bcf WDTCON,SWDTEN   ; stop WDT and clear
        call    r1rx11          ; recive data
                addwf   crc,f           ; compute checksum
                return
    
     

    Last edit: Dan 2013-12-08
  • Dan

    Dan - 2013-12-08

    Adding.

    I was able PIC12F1822, PIC16F1823 also fit into 84 words.

    Although I checked the writing of EEPROM,
    It will fail if attempted to write EEPROM in V0.8.0 or later.

    I made sure to write the EEPROM in V0.7.1.

    Changes in V0.7.1

    ①Change of source
    B --> K

    ②Add to piccodes.ini
    $19, B, 12F 1822(84W), $1000, 256, 168, 32,
    $37, B, 16F 1823(84W), $1000, 256, 168, 32,

     
  • Dan

    Dan - 2013-12-10

    Hi,ALL,

    It is a bootloader for ATTINY13A/84Words.

    The addition of a slight modification,
    applicable to the following ATTINY.

    ATTINY24A
    ATTINY25
    ATTINY261A

     
  • Dan

    Dan - 2013-12-10

    Hi,ALL,

    There was a small bug in the firmware of PIC16F1823 and PIC12F1822.

    [Contents of the bug]
    It rewrite the 01Dh without rewriting the RCSTA (19Dh) to WDT reset after detection.

    I will up the bug fix products.

    [Change]
    RCSTA because it is cleared by WDT reset,
    I have changed the jump destination of the WDT reset after detection.

    There is no effect on the operation even if there is a bug,
    because it has not yet been implemented 01Dh

     
  • Dan

    Dan - 2013-12-11

    Hi,All,

    There was a bug in the firmware of ATTINY13A.
    (This does not affect the behavior.)

    [Contents of the bug]
    Code jump to the bootloader is wrong.

                .org    0x0000      ;;Reset vector
    

    ; RJMP IntrareBootloader
    .dw 0xcf9f ;RJMP PC-0x60

    -------------------------->

                .org    0x0000      ;;Reset vector
    

    ; RJMP IntrareBootloader
    .dw 0xcfaf ;RJMP PC-0x50

    I attach the modified version.

     
  • edorul

    edorul - 2013-12-12

    Hello Dan!

    Thanks for these firmwares :-)
    I'll put them in the next release of TinyBootloader+

    Best regards,
    Edorul

     

    Last edit: edorul 2013-12-12
  • Ayinde Olayiwola

    Hi Dan, i have been trying for months on increasing the TinyBootloader size from 100words to about 200words for PIC18, what do i need to change in the code and PC Software?

     
  • Anobium

    Anobium - 2018-05-24

    Why? The bootloader is intended to be less that 100words - why increase?

    Please explain rational for the ask.

     
  • Ayinde Olayiwola

    Thank you Anobium for the reply,

    My Tiny Bootloader software will show "Error: hex file too large, writing bootloader firmware" error message when uploading if code is more than 2000h of the program memory space.

     

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.