USB CDC bootloader problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
air
Level 2
Level 2
First like given 50 sign-ins 10 questions asked

 Hello,

 

I am using cy8c6136.

I am using the modified basic DFU bootloader project by me.

I write the bootloader.hex file into the blank state MCU and dfus APP1 using dfuh-tool.

There’s no problem here.

 

But, in a specific situation (button input and using enterDFU() ) in APP1, the bootloader does not run.

APP1 seems to be executed immediately without going through bootloader.

The reason is that there is no port output(about 5 Sec) in the bootloader main() inserted by me.

 

APP1 is an IAR project, and the *.icf file has been modified.

I attach the bootloader project and APP1 config file.

The common_ram part is for determining whether the bootloader proceeds DFU.

 

#define BOOTLOADER_ID  (0u)      // App ID of bootloader

void enterDFU(void)

{

   dbg("DFU mode start!!!");

   common_ram->validMark = COMMON_RAM_VALIDT_MARK;

   common_ram->dfuMark = DFU_START_MARK;

   common_ram->dfuState = 0;

   common_ram->dfuStatus = 0;

 

   Cy_DFU_ExecuteApp(BOOTLOADER_ID);

//  CySoftwareReset();

}

 

 

Additionally, I wonder why the ram_common area and the .noinit area are different after build.

 

/* The noinit section, used across all the applications */
.cy_boot_noinit (NOLOAD) :
{
  KEEP(*(.cy_boot_noinit));
} > ram_common

 

air_0-1668475342081.png

 

I would like some help on which part is the problem.

 

Thank you.

0 Likes
1 Solution
Alakananda_BG
Moderator
Moderator
Moderator
50 likes received 250 sign-ins 250 replies posted

Hi @air ,

Can you please verify the address regions of ".cy_boot_noinit" section from the .map file after the build.

It should be inside the boundary of ram_common.

Regards,

Alakananda

View solution in original post

0 Likes
3 Replies
Alakananda_BG
Moderator
Moderator
Moderator
50 likes received 250 sign-ins 250 replies posted

Hi @air ,

Can you please verify the address regions of ".cy_boot_noinit" section from the .map file after the build.

It should be inside the boundary of ram_common.

Regards,

Alakananda
0 Likes
air
Level 2
Level 2
First like given 50 sign-ins 10 questions asked

 Hello,

 

The common ram start address is 0x08002000, and several bytes are used to share some information between the bootloader and the app.

In the configuration, appId was set to "start" of common_ram area, and it was modified to "end".

It works without problems after that.

 

thank you

 

* OLD : place at start of IRAM1_common_region { readwrite section .cy_boot_noinit.appId };

* NEW : place at end of IRAM1_common_region { readwrite section .cy_boot_noinit.appId };

0 Likes
air
Level 2
Level 2
First like given 50 sign-ins 10 questions asked

I have an additional question.

I can produce using below 1/2.

  1. Write bootloader *.hex
  2. DFU the app *.cyacd2 file

 

I wonder if there is any way to write these two files at once during mass production.

 

 Thank you.

0 Likes