elftosb: string parameter

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

elftosb: string parameter

跳至解决方案
906 次查看
peterruesch
Contributor IV


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.

标记 (2)
0 项奖励
回复
1 解答
776 次查看
peterruesch
Contributor IV

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

在原帖中查看解决方案

0 项奖励
回复
1 回复
777 次查看
peterruesch
Contributor IV

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

0 项奖励
回复