Understanding HCD files

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

cross mob
mnemonicservice
Level 1
Level 1
5 sign-ins First reply posted First question asked

I'm working on the example code for the BLE_remote. I'm trying to understand and parse the `.hcd` file that is generated when I build the program.

Looking at configdef20735B1.hdf  I see the following:

 

 

 

     COMMAND "Data" 0x0103
     {
         doc "Config item code used to write an arbitrary chunk of data to an arbitrary address."
         PARAM "Address"
             uint32
             doc "The address to which the Data bytes are to be loaded.";
         PARAM "Data"
             uint8[0xFF00] omit_pad_bytes
             doc "The data bytes to be loaded to the Address specified. The data with arbitrary length. "
                 "The length is implied by the size of the array specified for data, as in data = {0x01, 0x02}.";
     }

 

 

I don't understand how the following line is being treated

 

 

uint8[0xFF00] omit_pad_bytes

 

 

Looking at the output `.hcd` file (which I understand is the outcome of when this file is parsed, along with the .cgs file) I cannot conciliate the data that I pass and it's length to the length bytes in the "packet".

For example, this is a packet of data passed in the BLE_HID_Remote.cgs file:

 

ENTRY "Data" = "CODE_AREA from tier2/Generic/fcbga/bld/20735_ram_ext.elf"
{
    "Address" = 0x270400
    "Data" =
    COMMENTED_BYTES
    {
        <hex>
        07 b4 00 f0 49 fb 00 28 02 d0 07 bc bd e8 f0 8f
        07 bc 01 23 13 70 df f5 a3 bc 00 00 a8 f8 68 02
        bd e8 f0 81 00 f0 68 fe 10 bd 00 00 00 f0 9e fe
        b0 f5 8c bc bd e8 f0 47 00 f0 5a bf 08 46 33 f6
        e4 ff 03 20 bd e8 f0 81 bd e8 10 40 01 f0 3c b8
        (...)
        00 28 f9 d0 08 30 70 bd 44 d3 20 00 04 05 00 81
        68 d3 20 00 04 06 00 81 10 b5 4e f6 05 f9 01 49
        08 70 10 bd 9a 3e 20 00
    } END_COMMENTED_BYTES

 

 

Where there are a total of 16184 bytes (i.e. 0x3f38).

But the BLE_HID_Remote_download.hcd file, on the section that pertains to this "packet", has 0x7ebc as the length of the packet (bytes 0x23f-0x240).

 

00000230  03 54 01 73 03 54 01 73  03 11 01 01 01 03 01 bc  |.T.s.T.s........|
00000240  7e 00 04 27 00 07 b4 00  f0 4c fc fd f2 41 00 ff  |~..'.....L...A..|
00000250  49 fb 00 28 02 d0 07 bc  bd e8 f0 8f 07 bc 01 23  |I..(...........#|
00000260  13 70 df f5 a3 bc 00 00  a8 f8 68 02 bd e8 f0 81  |.p........h.....|

 

What explains this difference?

Thank you

0 Likes
1 Solution
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi @mnemonicservice ,

Please refer the section "Details of *.hcd Format" in CYW208XX Feature and Peripheral Guide Pg 25. There you can find how to parse the HCD file.

https://www.cypress.com/file/468621/download

Can you please let us know if you are looking to generate the HCD file from the CGS file? If you already have the HCD file, you can simply follow the above document to issue HCI commands to program the device. Is there any requirement for you to know how each and every byte of the HCD binary file is generated?

You can simply use the cgs.exe file to generate the HCD file from the CGS and the hdf file.

Regards,
Bragadeesh

View solution in original post

3 Replies
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi @mnemonicservice ,

Please refer the section "Details of *.hcd Format" in CYW208XX Feature and Peripheral Guide Pg 25. There you can find how to parse the HCD file.

https://www.cypress.com/file/468621/download

Can you please let us know if you are looking to generate the HCD file from the CGS file? If you already have the HCD file, you can simply follow the above document to issue HCI commands to program the device. Is there any requirement for you to know how each and every byte of the HCD binary file is generated?

You can simply use the cgs.exe file to generate the HCD file from the CGS and the hdf file.

Regards,
Bragadeesh
mnemonicservice
Level 1
Level 1
5 sign-ins First reply posted First question asked

Hi @BragadeeshV , thanks again for the quick response.

"Please refer the section "Details of *.hcd Format" in CYW208XX Feature and Peripheral Guide Pg 25. There you can find how to parse the HCD file."

Yes I had consulted the documentation (more specifically for the CYW20735), and read about the HCD format. But this pdf you referred me to has a bit more information about the process of constructing the HCD files which is very helpful, thank you.

Related still to the HCD, is there any documentation on the vendor specific HCI commands? Some vendors (like Texas Instruments) have these available but I haven't been able to find any official sources on Cypress/Broadcom.

"Can you please let us know if you are looking to generate the HCD file from the CGS file?(...)Is there any requirement for you to know how each and every byte of the HCD binary file is generated?"

Sure! I am conducting a security review for a couple products that use the CYW20735, for which I was not given the source code. So my starting point is the code available in flash, which I need to parse and review.

0 Likes

Hi @mnemonicservice ,

You can check the CyBluetool, that has a list of vendor specific HCI commands that can be used with the controller.

BragadeeshV_0-1621399622253.png

The vendor specific commands to perform a RAM download and flash download can be found in this document. Check section HCI Commands and Events During a RAM Download.

https://www.cypress.com/design-guides/wiced-hci-uart-control-protocol

Regards,
Bragadeesh