I want to generate SB file from BIN file.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I want to generate SB file from BIN file.

2,874 Views
rohitchudasama
Contributor III

I want to generate SB file from BIN file.

I make 3 sample code and build it using KDS but its not showing me any BIN.

How to generate BD file and KEY file and how to combine all the files ???

I tried to convert hello_world.bin into SB.bin using hello_world.bd but still i am getting below error while flashing.

 " Connected to device successfully! Collecting device information...... Device information is updated! Start update progress...... Updating image...... Error: Update image failed(SBSourceFile::createDataSource() has not been implemented.). Update process is stopped by error "

Thanks.

Labels (2)
0 Kudos
9 Replies

1,852 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello rohit chudasama,

      You can refer to the KSDK2.2_FRDM-K82 hello_world_qspi code readme.

    You can download KSDK2.2_FRDM-K82 from this link:

   Welcome to MCUXpresso | MCUXpresso Config Tools 

  SDK builder, board choose FRDM-K82, then generate it and download it.

    You can find hello_world_qspi in folder: SDK_2.2_FRDM-K82F\boards\frdmk82f\demo_apps\hello_world_qspi

   There also has a readme.txt. All the following step is from readme, it includes the SB file generation.

Tool dependencies: Use the blhost and the elftosb tool included in Kinetis Bootloader for the K8x devices. The
package including these tools can be downloaded from www.nxp.com/kboot.

Steps for running this demo:

1. Press and hold the SW2 button (NMI button) while connecting a USB cable between the PC host and the OpenSDA USB port
(or USB port on some boards) on the board. The button should be pressed until the openSDA USB port is connected.

2. Build the demo project and generate the .srec output file. The example requires the use of the SREC file format.
The project can generate the srec file directly. If you want to generate the src output file in another location,
 use the following steps for your given toolchain:

  - IAR: open Option for demo Configuration -> Output Converter -> Choose "Generate additional output".
  Set the format as "Motorola", then rebuild the demo.

  - Keil: open Option for demo project -> User -> Choose "Post build" and write
    "fromelf.exe --m32combined  --output  "$L@L.srec"  "#L" "to the line.

  - KDS: open "Property" for demo project C/C++ Build -> Settings -> Toolchains -> Choose "Create flash image".
    Then C/C++ Build -> Settings -> Cross ARM GUN Create Flash Image -> General -> "Output file format". Choose "Motorola
    S-record" -> "OK".

  - Atollic: open "Property" for demo project C/C++ Build->Settings -> Tool settings -> Other -> Output format ->
    Choose "Convert Output" -> Choose "Format" to "S-record".

  - ARMGCC: Use the command "objcopy -O srec hello_world_qspi.elf hello_world_qspi.srec"
    to generate the srec output file.

3. Prepare the QSPI config block for BootROM.

    -  Generate qspi_config_block.bin using tools QCBGenerator in Kinetis Bootloader for the K8x devices, the path of
     the tool is in FSL_Kinetis_Bootloader_K80_Tools_1_0_0/FSL_Kinetis_Bootloader_K80_Tools_1_0_0/bin/win. Double click
     QCBGenerator.exe, it will generate a qspi_config_block.bin file.
     
    - If you are using a different flash chip, the qspi config block should be reconfigured in the source file, located in
     FSL_Kinetis_Bootloader_K80_Tools_1_0_0/demo/QCBGenerator. Users can use GCC/Visual Studio/Code Block to recompile
     a .bin file for the proper QSPI configuration block. The projects for VS and Code Block is provided in the folder.

    - For detailed information, see the documentation Kinetis Bootloader QuadSPI User's Guide.pdf in the Kinetis
    Bootloader tools downloaded.

4. Use elftosb tool to convert the srec image to secure binary (SB) format required by the blhost tool.

    - First a .bd file is needed, so open .bd file in:
     <SDK_Install>/boards/<board>/demo_apps/hello_world_qspi/hello_world_qspi.bd.

    When changing to another demo, change the srec file name in .bd file. Move the qspi_config_block.bin to the same
    folder with hello_world_qspi.bd, or change the path of qspi_config_block.bin in hello_world_qspi.bd file.

    - On the command line, use the command "./elftosb.exe -V -c hello_world_qspi.bd -o hello_world_qspi.sb" to generate an
    sb file.

5. Use blhost to configure the bootloader and download the image.
   - On the command line using blhost, "./blhost.exe -p COMxx -- receive-sb-file hello_world_qspi.sb" ("COMxx" means
   the virtual COM number of the board.)

   Notice:
      - If you are using UART as the communication interface between blhost and the target, do not open a terminal session until
      the flash is complete or the download may fail.

      - Some platforms can only use the USB port for hardware reasons, i.e., the Freescale Freedom FRDM-K82 development board. To use the USB interface, the command
      should be "./blhost.exe -u -- receive-sb-file hello_world_qspi.sb".

6. Open a serial terminal with the following settings:
    - 115200 baud rate
    - 8 data bits
    - No parity
    - One stop bit
    - No flow control

7. Press the reset button on your board.

8. You should see the "Hello World" string printed to your terminal.
Customization options

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,852 Views
rohitchudasama
Contributor III

Hello,

But i am working on TWR-KE18F. And i am getting error in that.

Thanks

0 Kudos

1,852 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello rohit chudasama,

 

How did you download the code to TWR-KE18F, do you also use the USB MSC bootloader function?

If yes,  Please refer to this post try again:

USB MSD Bootloader Implementation 

  Any updated question, just let me know!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,852 Views
rohitchudasama
Contributor III

Hello,

I went through the all process and finally generate .sb file.

Now, how to download .sb file in my TWR-KE18F ???

I don't want use OpenSDA. I want to upload using ROM Bootloader. So, how can i do that ???

In future i am going to use only MKE18F512VLL16. So, how can i upload .sb file in MKE18F512VLL16 ???

Thanks

0 Kudos

1,852 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello rohit chudasama,

    If you want to upload the application code with ROM bootloader, you even don't need to convert the .sb file.

   Actually, the application code .bin file is enough.

   As you know, the KE18F have the UART ROM bootloader, you can use our KBOOT2.0 kinetisFlashTool to download the .bin file.

   More details, you can refer to this post:

https://community.nxp.com/message/888942?commentID=888942#comment-888942

  I already reply that post, and give the detail step how to download the application code with UART ROM bootloader.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,852 Views
rohitchudasama
Contributor III

Hello,

But i want to secure that .bin file with the key. So no one can hack my file and no one can get an actual data from .bin file.

Thanks

0 Kudos

1,852 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello rohit chudasama,

   Thank you for your detail information.

   Please refer to my attached file.

Page 14,

4.2.2 Browse button
Click the "Browse" button to locate the application image that is written to the Kinetis device. Currently, the supported file
types are .bin, .sb, .hex, .s19, and .srec.

The KinetisFlashTool support the .sb file download directly.

Wish it helps you!

If you still have question, just kindly let me know!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,852 Views
rohitchudasama
Contributor III

Hello,

In the first que i mentioned that i am getting an error while uploading .sb file using KinetisFlashTool.

I make simple hello_world code and generate hello_world.bin file. After that i make hello_world.bd file and at the end using elftosb.exe i generate hello_world.sb file. But when i am trying to upload that i am getting below error :

 " Connected to device successfully! Collecting device information...... Device information is updated! Start update progress...... Updating image...... Error: Update image failed(SBSourceFile::createDataSource() has not been implemented.). Update process is stopped by error "

my hello_world.bd file is below :

sources {
# BIN File path
myBINFile = "hello_world.bin";
}

section (0) {
#1. Erase the internal flash
erase all;
#2. Load BIN File to internal flash
load myBINFile > 0xa000;
#3. Reset target.
reset;
}

Thanks

0 Kudos

1,852 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi rohit chudasama,

   Sorry, my fault.

   I have test it on my side. KE18 bootloader can't support the SB file download.

pastedImage_1.png

pastedImage_2.png

  


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos