SD Card Bootloader (Beta 1)

Page: < 12 Showing page 2 of 2
Author
Picfreak
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2010/01/27 14:37:30
  • Location: 0
  • Status: offline
RE: SD Card Bootloader (Beta 1) 2010/01/27 14:44:50 (permalink)
0
Hi,
I am on a project right now on a pic24f using c30 compiler.  I need to implement a code that do exacly the same as this one, but adapted for c30 and pic24f.
Do you guys think it is possible to start from this code and do the appropriate modifications ? If yes, do you have an idea of what need to be change, cause there are few functions in c32 not availible on c30 compiler.. ?

Thanks a lot,
Picfreak
#21
microcoder
Starting Member
  • Total Posts : 73
  • Reward points : 0
  • Status: offline
RE: SD Card Bootloader (Beta 1) 2010/02/01 00:48:04 (permalink)
0
Hello jannick,

this works for me:

/*************************************************************************
 * Processor-specific object file.  Contains SFR definitions.
 *************************************************************************/
INPUT("processor.o")

/*************************************************************************
 * For interrupt vector handling
 *************************************************************************/
PROVIDE(_vector_spacing = 0x00000001);
_ebase_address  = 0x9FC02DF0;

/*************************************************************************
 * Memory Address Equates
 *************************************************************************/
_RESET_ADDR              = 0xBFC00000;
_BEV_EXCPT_ADDR          = 0xBFC00280;
_DBG_EXCPT_ADDR          = 0xBFC00380;
_DBG_CODE_ADDR           = 0xBFC02000;
_GEN_EXCPT_ADDR          = _ebase_address + 0x180;

/*************************************************************************
 * Memory Regions
 *
 * Memory regions without attributes cannot be used for orphaned sections.
 * Only sections specifically assigned to these regions can be allocated
 * into these regions.
 *************************************************************************/
MEMORY
{
  kseg0_program_mem    (rx)  : ORIGIN = 0x9FC00390, LENGTH = 0x2C60
  kseg0_boot_mem             : ORIGIN = 0x9FC00020, LENGTH = 0x200
  exception_mem              : ORIGIN = 0x9FC02DF0, LENGTH = 0x200
  kseg1_boot_mem             : ORIGIN = 0xBFC00000, LENGTH = 0x490
  debug_exec_mem             : ORIGIN = 0xBFC02000, LENGTH = 0xFF0
  config3                    : ORIGIN = 0xBFC02FF0, LENGTH = 0x4
  config2                    : ORIGIN = 0xBFC02FF4, LENGTH = 0x4
  config1                    : ORIGIN = 0xBFC02FF8, LENGTH = 0x4
  config0                    : ORIGIN = 0xBFC02FFC, LENGTH = 0x4
  kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x8000
  sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x100000
}
SECTIONS
{
  .config_BFC02FF0 : {
    *(.config_BFC02FF0)
  } > config3
  .config_BFC02FF4 : {
    *(.config_BFC02FF4)
  } > config2
  .config_BFC02FF8 : {
    *(.config_BFC02FF8)
  } > config1
  .config_BFC02FFC : {
    *(.config_BFC02FFC)
  } > config0
}


regards,

microcoder
#22
JT
New Member
  • Total Posts : 23
  • Reward points : 0
  • Joined: 2006/12/15 02:47:22
  • Location: Dijon - FRANCE
  • Status: offline
RE: SD Card Bootloader (Beta 1) 2010/02/02 09:11:33 (permalink)
0
Thank you microcoder... i wil try this in a few days!

Jannick TRONCIN
3C CONCEPT S.A.S
France
#23
Dan777
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2010/03/08 18:05:56
  • Location: 0
  • Status: offline
RE: SD Card Bootloader (Beta 1) 2010/04/23 02:43:51 (permalink)
0

I have a question in regard to code security when using a mass storage based Bootloader such as ths SD card bootloader. Having read through the readme file it is apparent that the hex image of the application code is loaded onto the SD card in its entirity. Could the application code be easily lifted and cloned from the SD card bootloader file? Or, is there a 'code guard' type function that prevents this?

Thankyou,
#24
steaky1212
Starting Member
  • Total Posts : 71
  • Reward points : 0
  • Joined: 2009/10/30 08:21:22
  • Location: 0
  • Status: offline
RE: SD Card Bootloader (Beta 1) 2010/04/29 04:23:40 (permalink)
0
Dann777,

You are going to have this issue whenever you distribute a HEX file.
One possible solution would be to encrypt (or otherwise obfuscate) the HEX file before distribution, store the encrypted version, and decrypt it as part of the bootload process.

Does anyone know when the bootloader will be stable (or come out of beta)?

Also, microcoder - what file have you modified there?
#25
MostlyHarmless
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2010/08/23 15:45:07
  • Location: 0
  • Status: offline
Re:SD Card Bootloader (Beta 1) 2010/11/19 15:29:32 (permalink)
0
Hi, all-
I'm getting a general exception error when my code get's large and I use the boot loader (Bus error exception (data reference: load or store). I followed previous posts in the thread about errors and bugs. Fixed those and got the sd boot loader working until my code got pretty close to the max size. Confirmed it was code size and not some instruction/compiler issue by trying different code that was large. And the code works fine when it's large and loaded via the ICD3 rather than the boot loader, both as release and in debug. MPLAB 8.36/C32 v1.11b. Boot loader is compiled with optimazation to '1'. Main app is not optimized ('0').

1) Anyone else have this issue?
2) Am I correct in thinking this is a boot loader issue?
3) Are there any issues with my procdefs.ld below? I also included the one I use to load the main app that puts the code in the same memory as the boot loader, but programmed with the ICD3.

Sorry about the line breaks/word wrap in the code quotes. Couldn't figure that out. Probably have to paste into a text editor...

Thanks!
Cheers,
MH

boot_config.h defines:
	// Address of main application's Startup code 	#define APPLICATION_ADDRESS         0x9D00A000 	 	// These macros define the maximum size of a Flash block. 	#define PROGRAM_FLASH_BASE          0x1D00A000          // Physical address 	#define PROGRAM_FLASH_LENGTH        0x00076000          // Length in bytes 	#define FLASH_BLOCK_SIZE            (1024 * 4)          // Size in bytes



/*************************************************************************  * Processor-specific object file.  Contains SFR definitions.  *************************************************************************/   /*************************************************************************   * For Intelecell application firmware during development. This file   * allows use of debugger. Firmware is mapped to the same memory as used  * by the hex image created for the boot loader.  *  * This file assumes the boot loader has been optimized to fit into  * 40960 kB of the program memory from 0x9D000000 to 0x9D009FFF.  *  * For creating a hex image of the Intelecell firmware for use with the   * boot loader, use the approriate procdefs.ld file as described in   * README_boot_loader.txt.  *  * For development and debugging ONLY.  *  * Do not change this file without a good understanding of all the  * dependecies between the boot loader and the main application.  *************************************************************************/ 
INPUT("processor.o")
/*************************************************************************  * For interrupt vector handling  *************************************************************************/ PROVIDE(_vector_spacing = 0x00000001);
/**** USE FOR DEBUGGING IC IMAGE FOR BOOTLOADER ****/ _ebase_address  = 0x9FC01000;
/*************************************************************************  * Memory Address Equates  *************************************************************************/
/**** USE FOR DEBUGGING IC IMAGE FOR BOOTLOADER ****/ _RESET_ADDR              = 0xBFC00000; _BEV_EXCPT_ADDR          = 0xBFC00380; _DBG_EXCPT_ADDR          = 0xBFC00480; _DBG_CODE_ADDR           = 0xBFC02000; _GEN_EXCPT_ADDR          = _ebase_address + 0x180;
/*************************************************************************  * Memory Regions  *  * Memory regions without attributes cannot be used for orphaned sections.  * Only sections specifically assigned to these regions can be allocated  * into these regions.  *************************************************************************/ MEMORY {   /**** USE FOR DEBUGGING IC IMAGE FOR BOOTLOADER ****/   kseg0_program_mem    (rx)  : ORIGIN = 0x9D00C000, LENGTH = 0x74000   kseg0_boot_mem             : ORIGIN = 0x9FC00490, LENGTH = 0x970   exception_mem              : ORIGIN = 0x9FC01000, LENGTH = 0x1000   kseg1_boot_mem             : ORIGIN = 0xBFC00000, LENGTH = 0x490   debug_exec_mem             : ORIGIN = 0xBFC02000, LENGTH = 0xFF0   config3                    : ORIGIN = 0xBFC02FF0, LENGTH = 0x4   config2                    : ORIGIN = 0xBFC02FF4, LENGTH = 0x4   config1                    : ORIGIN = 0xBFC02FF8, LENGTH = 0x4   config0                    : ORIGIN = 0xBFC02FFC, LENGTH = 0x4   kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000   sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x100000   configsfrs                 : ORIGIN = 0xBFC02FF0, LENGTH = 0x10 } SECTIONS {   .config_BFC02FF0 : {     KEEP(*(.config_BFC02FF0))   } > config3   .config_BFC02FF4 : {     KEEP(*(.config_BFC02FF4))   } > config2   .config_BFC02FF8 : {     KEEP(*(.config_BFC02FF8))   } > config1   .config_BFC02FFC : {     KEEP(*(.config_BFC02FFC))   } > config0 }



For the main app image to be boot loaded:
/*************************************************************************  * Processor-specific object file.  Contains SFR definitions.  *************************************************************************/   /*************************************************************************   * For creating a hex image file of the Intelecell application firmware  * for use with the bootloader.  *  * This file assumes the boot loader has been optimized to fit into  * 40960 kB of the program memory from 0x9D000000 to 0x9D009FFF. This is  * the boot loader compiled for deployment and NOT the boot loader  * compiled for debugger.  *  * This allows the maximum sized Intelecell firmware by minimizing the  * size of the boot loader. Do not use this Intelecell application hex  * image with a non-optimized boot loader. The boot loader will not load  * the image or will overwrite itself.  *  * For creating a hex image of the Intelecell firmware for use with the   * boot loader, use the approriate procdefs.ld file as described in   * README_boot_loader.txt.  *  * Do not change this file without a good understanding of all the  * dependecies between the boot loader and the main application.  *************************************************************************/ 
INPUT("processor.o")
/*************************************************************************  * For interrupt vector handling  *************************************************************************/ PROVIDE(_vector_spacing = 0x00000001);
/**** USE FOR IC IMAGE WITH BOOT LOADER WITH OPT ****/ _ebase_address  = 0x9D00B000;
/*************************************************************************  * Memory Address Equates  *************************************************************************/
/**** USE FOR IC IMAGE WITH BOOT LOADER WITH OPT ****/ _RESET_ADDR              = 0x9D00A000; _BEV_EXCPT_ADDR          = 0x9D00A380; _DBG_EXCPT_ADDR          = 0x9D00A480; _DBG_CODE_ADDR           = 0xBFC02000; _GEN_EXCPT_ADDR          = _ebase_address + 0x180;
/*************************************************************************  * Memory Regions  *  * Memory regions without attributes cannot be used for orphaned sections.  * Only sections specifically assigned to these regions can be allocated  * into these regions.  *************************************************************************/ MEMORY {   /**** USE FOR IC IMAGE WITH BOOT LOADER WITH OPT ****/   kseg0_program_mem    (rx)  : ORIGIN = 0x9D00C000, LENGTH = 0x74000   kseg0_boot_mem             : ORIGIN = 0x9D00A490, LENGTH = 0xB70   exception_mem              : ORIGIN = 0x9D00B000, LENGTH = 0x1000   kseg1_boot_mem             : ORIGIN = 0x9D00A000, LENGTH = 0x490   kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000   sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x100000 }


For the boot loader:
/*************************************************************************  * Processor-specific object file.  Contains SFR definitions.  *************************************************************************  *  * KSEG0 - cacheable  * KESG1 - not cacheable, code will run properly on reset  *  *************************************************************************/ 
/*************************************************************************   * For BOOT LOADER firmware after development. This file allows for  * compiler optimized boot loader firmware. Keep in ICNExtGenBootLoader   * project folder.  *  * This file assumes the boot loader fits into 40960 kB of the program  * memory from 0x9D000000 to 0x9D009FFF.  *  * The hex image of the Intelecell firmware must fit into the 475136 kB  * starting at 0x9D00C000.  *   * See README_boot_loader.txt for more info and appropriotiate procdefs.ld  * files to use.  *  * Do not change this file without a good understanding of all the  * dependecies between the boot loader and the main application.  *************************************************************************/
/* The INPUT command directs the linker to include the named files in  * the link, as though they were named on the command line. */ INPUT("processor.o")
/*************************************************************************  * For interrupt vector handling  *************************************************************************/
/* The PROVIDE keyword may be used to define a symbol only if it is   * referenced but not defined. The syntax is   * PROVIDE(symbol = expression).  */ PROVIDE(_vector_spacing = 0x00000001);
/* A value may be assigned to a symbol in a linker script. This will   * define the symbol as a global symbol.  */ _ebase_address  = 0x9FC01000; /* KSEG0 */
/*************************************************************************  * Memory Address Equates  *************************************************************************/ _RESET_ADDR              = 0xBFC00000; /* KSEG1 */ _BEV_EXCPT_ADDR          = 0xBFC00380; /* KSEG1 */ _DBG_EXCPT_ADDR          = 0xBFC00480; /* KSEG1 */ _DBG_CODE_ADDR           = 0xBFC02000; /* KSEG1 */ _GEN_EXCPT_ADDR          = _ebase_address + 0x180; /* KSEG0 */
/*************************************************************************  * Memory Regions  *  * Memory regions without attributes cannot be used for orphaned sections.  * Only sections specifically assigned to these regions can be allocated  * into these regions.  *************************************************************************/ MEMORY {   /* Location of boot loader program in KSEG0 - 40960 B ending at 0x9D009FFF */   /* Phy 0x1D000000 to 0x1D009FFF */      /*** With BL opt ***/   kseg0_program_mem    (rx)  : ORIGIN = 0x9D000000, LENGTH = 0xA000
  /* Location of boot memory in KSEG0 - 2416 B ending at 0x9FC00DFF */   /* Phy 0x1FC00490 to 0x1FC00DFF */   kseg0_boot_mem             : ORIGIN = 0x9FC00490, LENGTH = 0x970      /* Location of execption handler in KSEG0 - 4096 B ending at 0x9FC01FFF */   /* Phy 0x1FC01000 to 0x1FC01FFF */   exception_mem              : ORIGIN = 0x9FC01000, LENGTH = 0x1000      /* Location of boot memory in KSEG1 - 1168 B ending at 0xBFC0048F */   /* Phy 0x1FC00000 to 0x1FC0048F */   kseg1_boot_mem             : ORIGIN = 0xBFC00000, LENGTH = 0x490      /* Location of debegging exuctive in KSEG1 - 4080 B ending at 0xBFC02FEF */   /* Phy 0x1FC02000 to 0x1FC02FEF */   debug_exec_mem             : ORIGIN = 0xBFC02000, LENGTH = 0xFF0      /* Location of config registers in KSEG1 - 4 B ending at 0xBFC02FF3 */   /* Phy 0x1FC02FF0 to 0x1FC02FF3 */   config3                    : ORIGIN = 0xBFC02FF0, LENGTH = 0x4      /* Location of config registers in KSEG1 - 4 B ending at 0xBFC02FF7 */   /* Phy 0x1FC02FF4 to 0x1FC02FF7 */     config2                    : ORIGIN = 0xBFC02FF4, LENGTH = 0x4      /* Location of config registers in KSEG1 - 4 B ending at 0xBFC02FFB */   /* Phy 0x1FC02FF8 to 0x1FC02FFB */     config1                    : ORIGIN = 0xBFC02FF8, LENGTH = 0x4      /* Location of config registers in KSEG1 - 4 B ending at 0xBFC02FFB */   /* Phy 0x1FC02FFC to 0x1FC02FFF */      config0                    : ORIGIN = 0xBFC02FFC, LENGTH = 0x4      /* Location of RAM in KSEG1 - 131072 B ending at 0xA001FFFF */   /* Phy 0x00000000 to 0x0001FFFF */     kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000      /* Location of special function registers in KSEG1 - 1048576 B ending at 0xBF8FFFFF */   /* Phy 0x1F800000 to 0x1F8FFFFF */   sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x100000 }
/* The SECTIONS command tells the linker how to map input sections into output  * sections and how to place the output sections in memory.  */ SECTIONS {   .config_BFC02FF0 : {     KEEP(*(.config_BFC02FF0))   } > config3   .config_BFC02FF4 : {     KEEP(*(.config_BFC02FF4))   } > config2   .config_BFC02FF8 : {     KEEP(*(.config_BFC02FF8))   } > config1   .config_BFC02FFC : {     KEEP(*(.config_BFC02FFC))   } > config0 }


#26
MostlyHarmless
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2010/08/23 15:45:07
  • Location: 0
  • Status: offline
Re:SD Card Bootloader (Beta 1) 2010/11/23 16:13:54 (permalink)
0
Quick update. By adding the configuration memory to the procdefs.ld file for the main app. And modifying the boot loader to allow writes to those addresses, I stopped this issue. Don't understand why this worked. Investigating...
#27
steaky1212
Starting Member
  • Total Posts : 71
  • Reward points : 0
  • Joined: 2009/10/30 08:21:22
  • Location: 0
  • Status: offline
Re:SD Card Bootloader (Beta 1) 2010/12/14 09:00:51 (permalink)
0
Hi,

Does anyone know when this will be out of beta, or can they please post their fixes?

Many thanks,
Steaky
#28
adamlin
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2011/01/10 02:10:21
  • Location: 0
  • Status: offline
Re:SD Card Bootloader (Beta 1) 2011/01/10 02:34:56 (permalink)
0
Hi, MostlyHarmless:
     I put your last file as the procdefs.ld in my boot loader project but I got fail message as attached.
     Do I miss anything?  Please help to give a more detail description. Thank you.
Br,
Adam Lin

C:\Program Files\Microchip\MPLAB C32\bin\..\lib\gcc\pic32mx\3.4.4\..\..\..\..\pic32mx\bin\ld.exe: address 0x9d00e750 of .\resources\bldr_110110.elf section .text is not within region kseg0_program_mem
C:\Program Files\Microchip\MPLAB C32\bin\..\lib\gcc\pic32mx\3.4.4\..\..\..\..\pic32mx\bin\ld.exe: section .rodata [9d000000 -> 9d0003db] overlaps section .text [9d000000 -> 9d00e74f]
C:\Program Files\Microchip\MPLAB C32\bin\..\lib\gcc\pic32mx\3.4.4\..\..\..\..\pic32mx\bin\ld.exe: section .data [9d0003dc -> 9d0004cf] overlaps section .text [9d000000 -> 9d00e74f]
C:\Program Files\Microchip\MPLAB C32\bin\..\lib\gcc\pic32mx\3.4.4\..\..\..\..\pic32mx\bin\ld.exe: section .sdata [9d0004d0 -> 9d0004df] overlaps section .text [9d000000 -> 9d00e74f]
C:\Program Files\Microchip\MPLAB C32\bin\..\lib\gcc\pic32mx\3.4.4\..\..\..\..\pic32mx\bin\ld.exe: .\resources\bldr_110110.elf: section .text lma 0x9d000000 overlaps previous sections
#29
ablanco93
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2011/01/19 07:46:22
  • Location: 0
  • Status: offline
Re:SD Card Bootloader (Beta 1) 2011/01/19 07:53:10 (permalink)
0
hello, this  is a very useful tool  thanks =) . But does anyone knows if  there's a bootloader like this one but for PIC24? right now i have a really big problem, because the librery i use to read and writte to the SD card is really big ( is the one you get from microchip) and i can't put it into the bootloder space memory =S does anyone have solved this problem? any help will be great, thanks =)
#30
sheheer
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2011/02/07 02:33:00
  • Location: 0
  • Status: offline
Re: SD Card Bootloader (Beta 1) 2011/02/17 22:37:36 (permalink)
0


Hi

I'm new in PIC32 programming, initially all the programs working well. But when I'm trying the "graphics jpeg demo" program from microchip, it shows "build failed", later I trying to work with the other programs, all shows failed. The "SST25VF016.c" file shows error while compling. Is anyone have a solution for this. I'm using PIC32 ethernet starter kit.



Regards
Sheheer
#31
ErnieM
Super Member
  • Total Posts : 375
  • Reward points : 0
  • Joined: 2007/10/13 02:54:02
  • Location: 0
  • Status: offline
Re: SD Card Bootloader (Beta 1) 2011/02/23 14:44:50 (permalink)
0
Well I'm stuck again. I'm trying to adapt the D loader to my platform (a mikroElektronika PIC32MX4 MultiMedia Board running a PIC32MX460512L). I did get the USB bootloader to work so I believe I'm past hardware problems.

The load seems to fail when it hits the AddressWriteable check with the parameters:

address = 0x1FC02000, length = 0x1FC03000

AddressWriteable is OK with address < MIN_FLASH_ADDRESS, which I see as saying
0x1FC02000 < 0x1D020000 (which is false thus OK).

AddressWriteable fails for address + length >= MAX_FLASH_ADDRESS, which I see as
0x1FC02000 + 0x1FC03000 >= 0x1D020000 + 0x00060000
3F805000 >= 1D080000
which is true thus a failure.

I don't understand the length parameter, I would expect 0x1000, that is what seems to be passed in, but the debugger gives the larger value. And I do admit I don't yet get the memory model of these cores.

Would anyone have a hint for me to search????
#32
christophe29
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2011/04/12 07:07:30
  • Location: 0
  • Status: offline
Re:SD Card Bootloader (Beta 1) 2011/04/18 07:45:01 (permalink)
0
[Hello,
 
I am using PIC32MX795F512L and I need to implement this code that do exactly the same as this one.
I have a problem :
When I press the button S4, the code goes in the function BLIO_LoaderEnabled() and then loadApplication() but he is still stuck in
TransportInitialized = BLMedia_InitializeTransport() which is the FSInit of SD card.
 
I tried MDD File System SD / MMC card open source (Microchip examples) with several modifications in HardwareProfile.h file and He works.
I did this modifications in this project but I still have this mistake.
 
Do you have an idea of my problem ?
 
Christophe]
 
I found the solution. It was a FSInit() problem. I had to modify my HardwareProfile.h.
post edited by christophe29 - 2011/04/21 03:02:55
#33
MostlyHarmless
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2010/08/23 15:45:07
  • Location: 0
  • Status: offline
Re:SD Card Bootloader (Beta 1) 2011/07/27 10:26:52 (permalink)
0
adamlin-
Been a while since I've been on the forum, but I thought I'd post the procdefs that work for me, with the modificaitions I mentioned above.  Hopefully that will help your issue because I couldn't figure out your problem from those errors. And maybe others can use these, too.

Bootloader and the main app is compiled with level "1" optimization. I've got some comments in the procdef files that SHOULD be correct but not 100% sure as I've made some changes.
Cheers,
MH

Define for the the start of the main application
[code] 
// Address of main application's Startup code
#define APPLICATION_ADDRESS         0x9D00A000
[/code]


Bootloader procdefs.ld 
  /*************************************************************************  * Processor-specific object file.  Contains SFR definitions.  *************************************************************************  *  * KSEG0 - cacheable  * KESG1 - not cacheable, code will run properly on reset  *  *************************************************************************/ 
/*************************************************************************   * For BOOT LOADER firmware after development. This file allows for  * compiler optimized boot loader firmware. Keep in ICNExtGenBootLoader   * project folder.  *  * This file assumes the boot loader fits into 40960 kB of the program  * memory from 0x9D000000 to 0x9D009FFF.  *  * The hex image of the Intelecell firmware must fit into the 475136 kB  * starting at 0x9D00C000.  *   * See README_boot_loader.txt for more info and appropriotiate procdefs.ld  * files to use.  *  * Do not change this file without a good understanding of all the  * dependecies between the boot loader and the main application.  *************************************************************************/
/* The INPUT command directs the linker to include the named files in  * the link, as though they were named on the command line. */ INPUT("processor.o")
/*************************************************************************  * For interrupt vector handling  *************************************************************************/
/* The PROVIDE keyword may be used to define a symbol only if it is   * referenced but not defined. The syntax is   * PROVIDE(symbol = expression).  */ PROVIDE(_vector_spacing = 0x00000001);
/* A value may be assigned to a symbol in a linker script. This will   * define the symbol as a global symbol.  */ _ebase_address  = 0x9FC01000; /* KSEG0 */
/*************************************************************************  * Memory Address Equates  *************************************************************************/ _RESET_ADDR              = 0xBFC00000; /* KSEG1 */ _BEV_EXCPT_ADDR          = 0xBFC00380; /* KSEG1 */ _DBG_EXCPT_ADDR          = 0xBFC00480; /* KSEG1 */ _DBG_CODE_ADDR           = 0xBFC02000; /* KSEG1 */ _GEN_EXCPT_ADDR          = _ebase_address + 0x180; /* KSEG0 */
/*************************************************************************  * Memory Regions  *  * Memory regions without attributes cannot be used for orphaned sections.  * Only sections specifically assigned to these regions can be allocated  * into these regions.  *************************************************************************/ MEMORY {   /* Location of boot loader program in KSEG0 - 40960 B ending at 0x9D009FFF */   /* Phy 0x1D000000 to 0x1D009FFF */      /*** With BL opt ***/   kseg0_program_mem    (rx)  : ORIGIN = 0x9D000000, LENGTH = 0xA000
  /* Location of boot memory in KSEG0 - 2416 B ending at 0x9FC00DFF */   /* Phy 0x1FC00490 to 0x1FC00DFF */   kseg0_boot_mem             : ORIGIN = 0x9FC00490, LENGTH = 0x970      /* Location of execption handler in KSEG0 - 4096 B ending at 0x9FC01FFF */   /* Phy 0x1FC01000 to 0x1FC01FFF */   exception_mem              : ORIGIN = 0x9FC01000, LENGTH = 0x1000      /* Location of boot memory in KSEG1 - 1168 B ending at 0xBFC0048F */   /* Phy 0x1FC00000 to 0x1FC0048F */   kseg1_boot_mem             : ORIGIN = 0xBFC00000, LENGTH = 0x490      /* Location of debegging exuctive in KSEG1 - 4080 B ending at 0xBFC02FEF */   /* Phy 0x1FC02000 to 0x1FC02FEF */   debug_exec_mem             : ORIGIN = 0xBFC02000, LENGTH = 0xFF0      /* Location of config registers in KSEG1 - 4 B ending at 0xBFC02FF3 */   /* Phy 0x1FC02FF0 to 0x1FC02FF3 */   config3                    : ORIGIN = 0xBFC02FF0, LENGTH = 0x4      /* Location of config registers in KSEG1 - 4 B ending at 0xBFC02FF7 */   /* Phy 0x1FC02FF4 to 0x1FC02FF7 */     config2                    : ORIGIN = 0xBFC02FF4, LENGTH = 0x4      /* Location of config registers in KSEG1 - 4 B ending at 0xBFC02FFB */   /* Phy 0x1FC02FF8 to 0x1FC02FFB */     config1                    : ORIGIN = 0xBFC02FF8, LENGTH = 0x4      /* Location of config registers in KSEG1 - 4 B ending at 0xBFC02FFB */   /* Phy 0x1FC02FFC to 0x1FC02FFF */      config0                    : ORIGIN = 0xBFC02FFC, LENGTH = 0x4      /* Location of RAM in KSEG1 - 131072 B ending at 0xA001FFFF */   /* Phy 0x00000000 to 0x0001FFFF */     kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000      /* Location of special function registers in KSEG1 - 1048576 B ending at 0xBF8FFFFF */   /* Phy 0x1F800000 to 0x1F8FFFFF */   sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x100000 }
/* The SECTIONS command tells the linker how to map input sections into output  * sections and how to place the output sections in memory.  */ SECTIONS {   .config_BFC02FF0 : {     KEEP(*(.config_BFC02FF0))   } > config3   .config_BFC02FF4 : {     KEEP(*(.config_BFC02FF4))   } > config2   .config_BFC02FF8 : {     KEEP(*(.config_BFC02FF8))   } > config1   .config_BFC02FFC : {     KEEP(*(.config_BFC02FFC))   } > config0 }



Main application procdefs.ld
  /*************************************************************************  * Processor-specific object file.  Contains SFR definitions.  *************************************************************************/   /*************************************************************************   * For creating a hex image file of the Intelecell application firmware  * for use with the bootloader.  *  * This file assumes the boot loader has been optimized to fit into  * 40960 kB of the program memory from 0x9D000000 to 0x9D009FFF. This is  * the boot loader compiled for deployment and NOT the boot loader  * compiled for debugger.  *  * This allows the maximum sized Intelecell firmware by minimizing the  * size of the boot loader. Do not use this Intelecell application hex  * image with a non-optimized boot loader. The boot loader will not load  * the image or will overwrite itself.  *  * For creating a hex image of the Intelecell firmware for use with the   * boot loader, use the approriate procdefs.ld file as described in   * README_boot_loader.txt.  *  * Do not change this file without a good understanding of all the  * dependecies between the boot loader and the main application.  *************************************************************************/ 
INPUT("processor.o")
/*************************************************************************  * For interrupt vector handling  *************************************************************************/ PROVIDE(_vector_spacing = 0x00000001);
/**** USE FOR IC IMAGE WITH BOOT LOADER WITH OPT ****/ _ebase_address  = 0x9D00B000;
/*************************************************************************  * Memory Address Equates  *************************************************************************/
/**** USE FOR IC IMAGE WITH BOOT LOADER WITH OPT ****/ _RESET_ADDR              = 0x9D00A000; _BEV_EXCPT_ADDR          = 0x9D00A380; _DBG_EXCPT_ADDR          = 0x9D00A480; _DBG_CODE_ADDR           = 0xBFC02000; _GEN_EXCPT_ADDR          = _ebase_address + 0x180;
/*************************************************************************  * Memory Regions  *  * Memory regions without attributes cannot be used for orphaned sections.  * Only sections specifically assigned to these regions can be allocated  * into these regions.  *************************************************************************/ MEMORY {   /**** USE FOR IC IMAGE WITH BOOT LOADER WITH OPT ****/   kseg0_program_mem    (rx)  : ORIGIN = 0x9D00C000, LENGTH = 0x74000   kseg0_boot_mem             : ORIGIN = 0x9D00A490, LENGTH = 0xB70   exception_mem              : ORIGIN = 0x9D00B000, LENGTH = 0x1000   kseg1_boot_mem             : ORIGIN = 0x9D00A000, LENGTH = 0x490   config3                    : ORIGIN = 0xBFC02FF0, LENGTH = 0x4   config2                    : ORIGIN = 0xBFC02FF4, LENGTH = 0x4   config1                    : ORIGIN = 0xBFC02FF8, LENGTH = 0x4   config0                    : ORIGIN = 0xBFC02FFC, LENGTH = 0x4   kseg1_data_mem       (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000   sfrs                       : ORIGIN = 0xBF800000, LENGTH = 0x100000 } SECTIONS {   .config_BFC02FF0 : {     *(.config_BFC02FF0)   } > config3   .config_BFC02FF4 : {     *(.config_BFC02FF4)   } > config2   .config_BFC02FF8 : {     *(.config_BFC02FF8)   } > config1   .config_BFC02FFC : {     *(.config_BFC02FFC)   } > config0   }

#34
MostlyHarmless
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2010/08/23 15:45:07
  • Location: 0
  • Status: offline
Re:SD Card Bootloader (Beta 1) 2011/07/27 10:49:16 (permalink)
0
Hi, All-
My bootloader occasionally appears to "hang". Or at least the LCD screen on my device doesn't change. It seems to happen when the main application is called by BootApplication(). Also, it's not associated with actually bootloading from the SD card. It can happen with or without bootloading. And if I power cycle or reset, the bootloader runs fine and starts the main app. Also, I turned on the watchdog in the bootloader, and when I get a WD reset (I do get one), the bootloader and main app work.

What's really annoying is that I can't reproduce it reliably (seems random). And I've never seen it when running the bootloader in debug mode.

Any thoughts out there? Some register setting prevents main app from running? Could the stack get corrupted? Is that stack involved at all when starting the main app?

I'm stumped.
Cheers,
MH

#35
MostlyHarmless
New Member
  • Total Posts : 8
  • Reward points : 0
  • Joined: 2010/08/23 15:45:07
  • Location: 0
  • Status: offline
Re:SD Card Bootloader (Beta 1) 2011/08/01 10:20:41 (permalink)
0
An update on my issue with the bootloader. I put a software reset in my main application. And the watchdog is running in both bootloader and main app. So now my code cycles between the bootloader and the main applicaiton. Here's the pattern:

1) Bootloader runs
2) Bootloader starts main app
3) Main app runs
4) Main app software resets
5) Bootloader runs
6) Bootloader hangs on BootApplication()
7) Watchdog in bootloader(?) resets
8) Bootloader runs
9) Bootloader starts main app
10) Main app runs
11) Main app software resets

As near as I can tell by toggling some LEDs, the main app does not get started when the freeze occurs. Hope someone has some tips.
Cheers,
MH

#36
Page: < 12 Showing page 2 of 2
Jump to:
© 2017 APG vNext Commercial Version 4.5