Bootloaders and configs


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2012
    Posts
    81

    Default Bootloaders and configs

    Hello everyone,

    I just started collecting documentation on bootloaders and I remember reading somewhere that certain configs must be included in the bootloader.
    Below is my set of configs and defines. I would like to match the bootloaders communication speed with my future Debug communication.
    My question is which of them must go in the bootloader and which can be part of the new .HEX file to be loaded.

    Code:
    @__config_device_pic16f819
    @__config_wdt_off
    @__config_hs_osc
    @__config_pwrt_on
    @__config_mclr_off
    @__config_lvp_off
    @__config_protect_on
    @__config_CCP1_RB2
    
    DEFINE OSC 8        
    
    DEFINE DEBUG_REG PORTB
    DEFINE DEBUGIN_REG PORTB
    DEFINE DEBUG_BIT 6
    DEFINE DEBUGIN_BIT 7
    DEFINE DEBUG_MODE 1                 
    DEFINE DEBUG_BAUD 38400
    
    DEFINE  ADC_BITS        8
    DEFINE  ADC_CLOCK       3
    DEFINE  ADC_SAMPLEUS    50
    ADCON1=%01001110  
    
    
    CCP1CON = %00001100     
    PR2 = 15            
    CCPR1L = 0         
    CCP1CON.5 = 0
    CCP1CON.4 =0
    Any input on that will be greatly appreciated.

    Nick

  2. #2
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: Bootloaders and configs

    My question is which of them must go in the bootloader and which can be part of the new .HEX file to be loaded
    Put them all in the bootloader.

    I'd be very leery of letting your bootloader reprogram config settings. If you get them wrong or things hiccup you can end up with a board that won't boot.

  3. #3
    Join Date
    Oct 2012
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: Bootloaders and configs

    Thanks, Tumleweed.
    Are we are talking all configs only?
    The defines can and will be programmed by the new .HEX file. True?

    Nick

  4. #4
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: Bootloaders and configs

    Yeah, I'm talking only about the CONFIG settings.

    Everything else is either a program or register setting that gets done at run-time, so you can always change these.

  5. #5
    Join Date
    Oct 2012
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: Bootloaders and configs

    Thanks again.
    This makes it clear even for a beginner like me.

    Nick

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Bootloaders and configs

    The CONFIGs definitely needs to be in the bootloader code that gets programmed to the chip using a real device programmer.
    You should not allow the downloaded "application" to change the CONFIG (besides it's not even possible on all PICs) because it might brick it. For example, if the bootloader is written for a board using a HSPLL oscillator running at 32MHz and the user, by mistake or unknowingly, downloads a piece of code that changes the oscillator CONFIG to INTOSC. This bricks the device and you need to reprogram it with a device programmer.

    /Henrik.

  7. #7
    Join Date
    Oct 2012
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: Bootloaders and configs

    Thank you Henrik for the extra information.
    In my case it should be simple since I’m using an old fashion chip (PIC16F819).
    I’m stuck with quite a few of them in my inventory and I would like to make use of them.
    I will include all the configs in the bootloader and I will make sure the new HEX will have none.

    Thanks again,

    Nick

  8. #8
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: Bootloaders and configs

    Hex isn't problem. You can have configs in hex, but application that parse hex file should ignore configs and send only program and eeprom to bootloader. I post simple bootloader code somewhere on forum.

  9. #9
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,516


    Did you find this post helpful? Yes | No

    Default Re: Bootloaders and configs

    The 16F series isn't even capable of reprogramming their own CONFIG word(s). For example, on the 16F819, the CONFIG word is at address 2007h and the datasheet says
    It is important to note that address 2007h is beyond the
    user program memory space which can be accessed
    only during programming.
    It also says
    Accessing a location above the
    physically implemented address will cause a
    wraparound.
    So if you TRIED to write to the CONFIG word you'd actually write to another location possibly corrupting the program.

    So yeah, you need to be carefull of what you're doing. I'm curious, the 16F819 doesn't have an UART, are you planning to use bitbanged serial for the download or are you going to inject the new firmware image in some other way (SPI, I2C)?

    /Henrik.

  10. #10
    Join Date
    Oct 2012
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: Bootloaders and configs

    Hi Team,

    Pedja089 I will search for your post, thank you.
    Henrik, I will have a friend of mine, who knows more assembly than I do, helping with this project.
    We are trying to make small changes, to fit our needs, to this project I found in my research:

    http://pygmy.utoh.org/pikme/

    Right now we are collecting as much information as we can to make sure we are taking the right path.
    Thank you for your advices and interest.

    Nick

Similar Threads

  1. Replies: 7
    Last Post: - 24th September 2014, 18:27
  2. recommendations for secure bootloaders
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th August 2014, 01:31
  3. 18F6310 configs
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th January 2012, 07:47
  4. 18F4520 Configs
    By ruijc in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 10th June 2010, 23:18
  5. Getting Configs straight
    By vacpress in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 24th January 2007, 05:16

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts