# Forum: ARM programming with GCC/GNU tools bootloader via USB

Rate this post
 0 ▲ useful ▼ not useful
Hello,

I'm working on the bootloader, which is supposed to load image via USB.
It is AT91SAM7S256-based product. I've read Atmel's documentation and
reviewed the accompanied code.

So to test firmware I need to impement a simple user application (i.e.
Win32) to upload the image. I don't quite understand how to split the
image in to equal chunks, which will be sent over USB.

As I understood Atmel's documentation, only whole pages are burnt on
flash, i.e. I need to prepare set of chunks with size of page, correct?
But image size doesn't necessary be multiple, so there would be some
little piece remained.

Are there any ideas about that?

Thanks.

Rate this post
 0 ▲ useful ▼ not useful
Roman Mashak wrote:
> Hello,
>
> I'm working on the bootloader, which is supposed to load image via USB.
> It is AT91SAM7S256-based product. I've read Atmel's documentation and
> reviewed the accompanied code.
>
> So to test firmware I need to impement a simple user application (i.e.
> Win32) to upload the image.

>I don't quite understand how to split the
> image in to equal chunks, which will be sent over USB.
What is the driver you used on the USB ? CDC ?

You read a 256Byts and split them to the maximum size of the EP. I think
is 64 on SAM7 parts.

>
> As I understood Atmel's documentation, only whole pages are burnt on
> flash, i.e.
I need to prepare set of chunks with size of page, correct?
Yeah your right.

> But image size doesn't necessary be multiple, so there would be some
> little piece remained.

The little piece remained will be filled with 0x00 or 0xff or anything
else. It doesn't matter.

>
> Are there any ideas about that?
>
> Thanks.

Hope this help

Jonathan

Rate this post
 0 ▲ useful ▼ not useful
Jonathan Dumaresq wrote:

Thank you for your feedback.
Sorry for such a late reply. Things kept me busy.

> What is the driver you used on the USB ? CDC ?

Correct. I use CDC example form Atmel.

>
> You read a 256Byts and split them to the maximum size of the EP. I think
> is 64 on SAM7 parts.

I don't quite understand here. Why do I read 256bytes and then divide to
the page size? What is EP, to be precise?

>
>>
>> As I understood Atmel's documentation, only whole pages are burnt on
>> flash, i.e.
> I need to prepare set of chunks with size of page, correct?
> Yeah your right.

Is it necessary to prepend every chunk with some header? I mean what is
the way to specify the first or last chunk in the stream?

### Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

### Rules — please read before posting

• Post long source code as attachment, not in the text
• Posting advertisements is forbidden.

### Formatting options

• [c]C code[/c]
• [avrasm]AVR assembler code[/avrasm]
• [code]code in other languages, ASCII drawings[/code]
• $formula (LaTeX syntax)$
 Name: E-mail address (not visible): Subject: Searching for similar topics... Attachment: Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one. Text: