14.1.3 Options
The following xc32-bin2hex
options are supported.
Option | Function |
---|---|
-a or
--sort |
Sort sections by address. |
-i or
--virtual |
Use virtual addresses. |
-p or
--physical |
Use physical addresses (default). |
-v or
--verbose |
Print verbose messages. |
-w or --write-sla |
Write the entry point into a linear start address (SLA) field as part of a type 5 record. |
-? or
--help |
Print a help screen. |
-I file or
--image=file |
Applicable for dual-core PIC32C devices capable of dual reset
only, this option requests the generation of a secondary core image from the
specified binary file. This image will be placed within .c and
.h files. |
-M mode or
--image-copy-mode mode |
Applicable for dual-core PIC32C devices capable of dual reset
only, this option indicates how the secondary core image (generated by the
--image option) should be copied to SRAM. When
mode is set to auto ,
the standard data-initialization template will copy the image to SRAM, using a
simple compression algorithm on the payload. This is the default action if no
option is specified. (See those sections pertaining to the Data-initialization
Template in the MPLAB® XC32 C/C++ Compiler User's Guide
for PIC32C/SAM MCUs.) When mode is set
to manual , only the contents of the secondary core image are
generated, and the end-user is responsible for copying the secondary image
contents to its relevant memory. |
-C name or
--image-generated-c name |
Applicable for dual-core PIC32C devices capable of dual reset
only, this option specifies the base name (and optionally, a path) that will be
used for the C source file containing the secondary core image (requested by
the --image option). If the
--image-generated-h option has not been specified, this
option also supplies the basename for the generated .h header
file. |
-H name or
--image-generated-h name |
Applicable for dual-core PIC32C devices capable of dual reset
only, this option specifies the base name (and optionally, a path) that will be
used for the .h header file appropriate for the source file
that contains the secondary core image (requested by the
--image option). |
-A offset or
--image-offset offset |
Applicable for dual-core PIC32C devices capable of dual reset
only, this option specifies the boot memory address offset. The
offset argument is a hexadecimal
value. |
Note: See the PIC32MX Family Reference Manual (DS61115)
for a description of the PIC32MX Virtual-to-Physical Fixed Memory Mapping.
The following is example output when running verbose mode on an Elf file
generated for a SAM
device.
% xc32-bin2hex -v main.elf
Microchip Language Tool Shell Version 4.20 (Build date: Sep 16 2022).
Copyright (c) 2012-2017 Microchip Technology Inc. All rights reserved
Offsetting PFM addresses by 0x0000000000000000 and BFM address by 0x0000000000000000
writing main.hex
section byte address length (dec)
--------------------------------------------------------------
.vectors 0x400000 0x168 (360)
.text 0x400168 0x20 (32)
.text%8 0x400188 0x150 (336)
.text.Reset_Handler%9 0x4002d8 0x9c (156)
.dinit%10 0x400374 0x70 (112)
.text.__pic32c_data_initialization_impl%11 0x4003e4 0x60 (96)
.text.__libc_start_init%12 0x400444 0x5c (92)
.text%13 0x4004a0 0x42 (66)
.text.Dummy_Handler%16 0x4004e2 0x2 (2)
.text%14 0x4004e4 0x40 (64)
.text.__pic32c_data_initialization%15 0x400524 0x4 (4)
.text.__dummy%17 0x400528 0x2 (2)
Total program memory used (bytes): 0x52a (1322)
The following example shows a command line sequence that will generate secondary core image
source files from the main.elf binary image file. This command will
create secCoreImage.c and secCoreImage.h
files.
xc32-bin2hex --image main.elf --image-offset 100 --image-generated-c secCoreImage main.elf
The
generated C source file can be added to the application (core 0) project, where it can be
used to initialize the secondary core (core 1) RAM. The header file must be placed in the
preprocessor's search path specified for the application project.