Helpful ReplyUSB Thumbdrive Bootloader (BETA 1)

Page: < 123 > Showing page 2 of 3
Author
jtoebes
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2009/06/02 06:09:39
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2009/10/07 20:17:59 (permalink)
0

ORIGINAL: rubes99

This question is to JTobes, I am currently working for a company trying to design a bootloader program and I was testing your design and for one I can't work on the workspace because of version control. And when I make my own project workspace and imort all the files there are some files that are not in your directory like "GenericTypeDefs.h" And when you say program the flash, what do you mean by that. Build and compile the workspace? Program to the microchip? Sorry I am new to the PIC32, just starting to learn some of the key details. I tried using the beta version of the USB bootloader and I am not sure if its working because I don't have any LED's light up.


The easiest thing I have found to do is to open up samantha.mcp file in a text editor and look for the vault section which has 5 lines like

[VAULT]
vault={1B368E2B-FF50-41FF-8C01-583CE166C30B}
000=1.0
001=\\server\Vss\srcsafe.ini
002=$/Microchip/Samantha


If you delete those lines and save it back out you should be able to open it up fine.
#21
SavoyTruffle
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2009/09/15 05:30:09
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2009/10/08 13:21:29 (permalink)
0
I also have an issue.  The compiler hits a snag with undefined refence to "f_chdrive" in boot_media_usb_msd.c.  I've been checking out the fat32 library I downloaded from Microchip, and I haven't been able to find a reference to that particular function.  Thanks in advance.  
#22
jtoebes
New Member
  • Total Posts : 18
  • Reward points : 0
  • Joined: 2009/06/02 06:09:39
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2009/10/08 21:34:33 (permalink)
0
I did not use the version from Microchip, but instead took the one from the fatfs web site (http://elm-chan.org/fsw/ff/00index_e.html)  I included a microchip subdirectory in my source so you can use that as a reference.

#23
SavoyTruffle
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2009/09/15 05:30:09
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2009/10/09 07:58:44 (permalink)
0
I didn't see the Microchip subdirectory in the zipped up source files, but I found the FatFS website and used that.  The compiler I'm using is the free crippled C32, so I couldn't use the optimizations you had enabled - but I think it will still do.

Thanks! grin
#24
rubes99
New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2009/10/02 06:46:12
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2009/10/12 08:07:13 (permalink)
0
I still am having trouble, I can now view the project, but there are a lot of files missing such as "GenericTypedefs.h" Your main files call for it, am I getting the wrong zip cause I don't even have the microchip zip file that you said was included. Thanks I really appreciate the work. If you can email me, I would like to work closer with you about this problem. I can disscuss with you some of the neat stuff we are doing at our company with the PIC32. my email is ruben.loganantharaj@smartfield.com ...... thanks hope to hear from you.
#25
rubes99
New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2009/10/02 06:46:12
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2009/10/14 11:59:27 (permalink)
0
nvm... I got the program to work correctly..... though will the boot loader remain on the bootflash or will it have to reside in the program memory?
#26
SavoyTruffle
New Member
  • Total Posts : 21
  • Reward points : 0
  • Joined: 2009/09/15 05:30:09
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2009/10/26 06:46:50 (permalink)
0
Has anybody tried out the "USB HOST - BOOTLOADERS" included with the latest Microchip libraries?  I realize it's for the PIC24, but I notice it now has a different AddToBlock() function that is #defined for the PIC32.  Anyway, I'm wondering if they took care of some of the bugs pointed out on this forum.
#27
itcon
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2009/12/28 02:51:55
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2009/12/29 12:46:53 (permalink)
0
John, Ruben or anybody else, dose any of you has the linker script for the application that will be loaded by the boot loader?
Changing the script to fit the bootloader APPLICATION_ADDRESS  generate lots of errors.
Also could you post a complete project(with dbg.h, microchip folder,GenericTypeDef.h instead of integer.h, definition for USB_DRIVE, correct def for _mon_putc and _mon_get so it will also compile in Release, etc:-)
Thanks a lot for a great help already.
#28
barber
Senior Member
  • Total Posts : 169
  • Reward points : 0
  • Joined: 2009/02/02 08:09:48
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/01/27 06:32:18 (permalink)
0
Hi
Thanks for the link. This is my first PIC32 project so I have a few questions.
1. It appears that this demo uses fat16. With thumb drives normally at or over 4gb what do I need to do to update to Fat32. This project also needs long file name. Will replacing MDD with the ELM FatFs solve these problems?
2. Any idea if this well ever be added to the supported MC application libraries?
3. We may have ram issues depending on the feature list for the final product. As a fall back position we are looking at the 5XX or 6XX production line so we can use the 64 or 128K ram. Do you know what is specific to the 4XX series chip? The 5XX and 6XX chips appear to have the same USB core so I hope the changes will be minimal.
#29
John305
New Member
  • Total Posts : 12
  • Reward points : 0
  • Joined: 2010/02/10 12:51:57
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/03/05 08:57:21 (permalink)
0
I am trying to run this bootloader on the explorer 16 with the PIC32MX460F512L PIM, and the USb Pictail.  I ran and programmed the original attachment and when I press the button S4 along with the RESET, light D10 flashes.  So that part is working, but when I put a thumb drive into the USb Pictail, nothing seems to happen.  Light D10 continues to flash at the same rate and when I remove the image.hex file thinking its supposed to blink faster, Nothing Happens.  Does anyone have an idea about what might be going on.
#30
MKC
Super Member
  • Total Posts : 399
  • Reward points : 0
  • Joined: 2009/12/04 13:24:27
  • Location: Belgium
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/03/15 12:57:24 (permalink)
0
I need the PIC32 USB boot loader with HOST Style - Plug a memory stick into the PIC32 and it boot loads a file.

So I found it for the PIC24 but not for the PIC32.

“C:\Microchip Solutions\USB Host - Bootloaders\Mass Storage Bootloader”

Do I need to do the changes myself or is there any link to a ready to use project.

I use the latest version of the USB stack

Any help appreciated

Marc
#31
friesen
Super Member
  • Total Posts : 1745
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/03/15 13:00:42 (permalink)
0
The bootloader from the first page built by toebes? works for me. 

I think microchip may have forgotten this.  I can't figure out why they did the pic32 beta first, and then forgot it.  Perhaps if enough folks bug them they may finish it up.  It doesn't need much really.

Erik Friesen
#32
MKC
Super Member
  • Total Posts : 399
  • Reward points : 0
  • Joined: 2009/12/04 13:24:27
  • Location: Belgium
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/03/18 12:19:20 (permalink)
0
Hi Erik,

Thanks for the reply, i am now trying to startup the code from tjoebes web.

After reconstructing the project (as the project file from tjoebes is configured with version control I can´t open it. For now I am at the point that the bootloader is looking for a Samantha.hex file.

To build a bootable project hex file I need a procdefs.ld file that matches with the memory layout of toebes bootloader.
Is there any available?


One issue that I want to share with other users ….. If one forgets to setup heap space in the project the bootloader will crash.
The cosmetic error is located in the function “BOOL BLMedia_InitializeTransport ( void )”
The code “ USBInitialize(0);” //this is a define for the function “BOOL USBHostInit( unsigned long flags )”
The function “BOOL USBHostInit( unsigned long flags )” does a malloc. If the malloc fails it will return FALSE. But in the calling function “BOOL BLMedia_InitializeTransport ( void )” there is no test for the FALSE return. So the code will crash the first time it uses the struct created on the heap.

Regards
Marc
#33
friesen
Super Member
  • Total Posts : 1745
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/03/18 13:00:35 (permalink)
0
When I have some time,(ha ha) I may post my working code.  It can be a bear to get it going.

Here is what I learned to get his thing going.

You may have to modify his mcp project file and remove the vault so that it will load without version control

The thumb drive should be formatted to fat (fat16) not fat32.  It seems to work better if there is nothing else on the drive.  The name is case sensitive.

You must use the correct procdefs for the bootloader. 

You need to use a procdef that starts at 0x010000, I think there is one somewhere there.

You export the file without bootflash or configuration bits, and start at 0x10000.  The bootloader seems to lock up if the file is not the correct size, or it sees something wrong with it.

Erik Friesen
#34
FAbengal
New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2010/03/31 01:49:14
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/03/31 02:03:22 (permalink)
0
Hi,

I am working on the bootloader for a PIC32HX460F256L, and am having some issues.

I can compile my application code properly usinf a specific proced.ld

here is the map file generated.

kseg0 Program-Memory Usage
section                    address  length [bytes]      (dec)  Description
-------                 ----------  -------------------------  -----------
.text                     0x9d022000        0x12e84      77444  Application's executable code
.rodata                 0x9d034e84        0x2234        8756  Read-only constant data
.eh_frame            0x9d0370b8        0x20            32  Stack unwind info
.data                    0x9d0370d8        0x27a8       10152  Data-initialization template
.sdata                   0x9d039880        0x38           56  Small data-initialization template
      Total kseg0_program_mem used  :     0x178b8       96440  25.0% of 0x5e000

kseg0 Boot-Memory Usage
section                    address  length [bytes]      (dec)  Description
-------                 ----------  -------------------------  -----------
.startup                0x9d020490          0x1e0         480  C startup code
         Total kseg0_boot_mem used  :       0x1e0         480  16.4% of 0xb70

Exception-Memory Usage
section                    address  length [bytes]      (dec)  Description
-------                 ----------  -------------------------  -----------
.app_excpt             0x9d021180           0x10         16  General-Exception handler
.vector_0                0x9d021200           0x8           8  Interrupt Vector 0
.vector_4                0x9d021280           0x8           8  Interrupt Vector 4
.vector_19              0x9d021460           0x8           8  Interrupt Vector 19
.vector_24              0x9d021500           0x8           8  Interrupt Vector 24
.vector_32              0x9d021600           0x8           8  Interrupt Vector 32
          Total exception_mem used  :     0x38         56  1.4% of 0x1000

kseg1 Boot-Memory Usage
section                    address  length [bytes]      (dec)  Description
-------                 ----------  -------------------------  -----------
.reset                  0x9d020000           0x10          16  Reset handler
.bev_excpt              0x9d020380           0x10          16  BEV-Exception handler
         Total kseg1_boot_mem used  :        0x20          32  2.7% of 0x490
        --------------------------------------------------------------------------
         Total Program Memory used  :     0x17af0       97008  24.7% of 0x60000
        --------------------------------------------------------------------------


kseg1 Data-Memory Usage
section                    address  length [bytes]      (dec)  Description
-------                 ----------  -------------------------  -----------
.data                   0xa0000200           0x27a8       10152  Initialized data
.sdata                  0xa00029a8           0x38          56  Small initialized data
.sbss                    0xa00029e0           0xd6         214  Small uninitialized data
.bss                     0xa0003000            0x4034       16436  Uninitialized data
.stack                   0xa0007034           0x400        1024  Minimum space reserved for stack
         Total kseg1_data_mem used  :      0x6cea       27882  85.1% of 0x8000
        --------------------------------------------------------------------------
            Total Data Memory used  :      0x6cea       27882  85.1% of 0x8000
        --------------------------------------------------------------------------

In my opinion everything is fine. My questions are:

- Is the bootloader able to handle file of the size is 270kbytes?
- Is the ram of the bootloader application is sharing its ram memory of the main application?

The bootloader uses half of the RAM memory of the PIC32HX460F256L, is this memory lost for the application?

thanks in advance for any advice

regards

F


#35
friesen
Super Member
  • Total Posts : 1745
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/03/31 04:32:14 (permalink)
0

- Is the bootloader able to handle file of the size is 270kbytes?

You will need to change the address parameters in the header file to match the 256

- Is the ram of the bootloader application is sharing its ram memory of the main application?

The bootloader uses half of the RAM memory of the PIC32HX460F256L, is this memory lost for the application?

You don't totally understand a bootloader yet.  Once the bootloader has run, it will have an entry point, and will start just like any other.  There is no sharing, nor need of sharing.  The only possible thing to remember is to initialize your variables properly, because the location of your new variable may be the same as one of the bootloader variables.



Erik Friesen
#36
FAbengal
New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2010/03/31 01:49:14
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/03/31 04:59:29 (permalink)
0
thank you for your reply.

Do you know where to change the parameters for the bootloader to accept file of size: 267 Kbytes
I suppose it's in the file boot_config :

// Address of main application's Startup code
#define APPLICATION_ADDRESS         0x9D020000

// These macros define the maximum size of a Flash block.
#define PROGRAM_FLASH_BASE          0x1D020000          // Physical address
#define PROGRAM_FLASH_LENGTH        0x00080000          // Length in bytes 
#define FLASH_BLOCK_SIZE            (1024 * 4)          // Size in bytes

the flash_length variable seems enough for me... 524288 bytes. should be ok.... but it doesn't work.

thanks
#37
friesen
Super Member
  • Total Posts : 1745
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/03/31 05:16:28 (permalink)
0
That is right -
#define PROGRAM_FLASH_LENGTH        0x00080000          // Length in bytes
should be
#define PROGRAM_FLASH_LENGTH        0x00040000          // Length in bytes

You also need to change the procdefs for the bootloader to match the 256.  I don't have it in front of me here.

By the way, it looks like you may have the original.  You need to use the one from jtoebs.  Its application address starts at 0x010000, that only takes up 1/4 of the space, instead of 1/2 like the original.  Not only that there is a bug in the oe.


Erik Friesen
#38
FAbengal
New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2010/03/31 01:49:14
  • Location: 0
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/03/31 08:25:55 (permalink)
0
Thanks for the tips.

I tried to get the john.toebes bootloader working however I got several files missing... does anyone have them? I would be some much fun to have just one zip file with everything in it.

regards

F
#39
friesen
Super Member
  • Total Posts : 1745
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
RE: USB Thumbdrive Bootloader (BETA 1) 2010/03/31 10:32:18 (permalink)
0
I spent some time trying to get something together on this and put my files here, and ended up frustrated.  As near as I can tell, there is enough difference between the base files on these builds and the new c32 that I can't get my projects based on the new to compile.  For example, I get previous declaration errors with a workspace that has compiled previously with no changes. 

The only solution for now that I can think of for you is to bug microchip about this, or see if jtoebes will update his files.  If I have time later I might work on this some more but it will be a few weeks. 

Erik Friesen
#40
Page: < 123 > Showing page 2 of 3
Jump to:
© 2017 APG vNext Commercial Version 4.5