Hi,
I'm having trouble to set a string constant via a command line argument.
I want to specify the firmware binary file as a parameter when calling elftosb.
invocation elftosb:
[developer@localhost linux]$ ./elftosb --debug --command command_file.bd --output output.sb -DAPPLICATION_OFFSET=0xA000 -DAPPLICATION_BINARY=debug.bin
failed to open source file: xyz.bin (ignoring for now)
APPLICATION_OFFSET = 40960
APPLICATION_BINARY = 0
error: line 20: error opening source 'APPLICATION_BINAR
my command_file.bd:
constants
{
APPLICATION_OFFSET = 0;
}
sources
{
APPLICATION_BINARY = "xyz.bin";
}
section (0)
{
erase all;
info "APPLICATION_OFFSET = $(APPLICATION_OFFSET)";
info "APPLICATION_BINARY = $(APPLICATION_BINARY)";
if (0 != APPLICATION_OFFSET)
{
load APPLICATION_BINARY > APPLICATION_OFFSET;
reset;
}
else
{
error "-DAPPLICATION_OFFSET=0x?????? must be supplied";
}
}
I want to have to "xyz.bin" replaced dynamically as it works great with the APPLICATION_OFFSET value.
Solved! Go to Solution.
the solution is to use the "extern" keyword:
...
sources
{
APPLICATION_BINARY = extern(0)
}
...
this makes it possible to call the elftosb tool with the binary file as parameter:
[developer@localhost debug]$./elftosb -V -f kinetis -z -c command_file.bd -o led_demo_bin_zero_key.sb -DAPPLICATION_OFFSET=0xA000 $PWD/gpio_led_output_frdmk64f.bin
the solution is to use the "extern" keyword:
...
sources
{
APPLICATION_BINARY = extern(0)
}
...
this makes it possible to call the elftosb tool with the binary file as parameter:
[developer@localhost debug]$./elftosb -V -f kinetis -z -c command_file.bd -o led_demo_bin_zero_key.sb -DAPPLICATION_OFFSET=0xA000 $PWD/gpio_led_output_frdmk64f.bin