Reply
Posts: 19
Registered: ‎06-17-2016
Accepted Solution

EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

I tested an SMBUS bootloader based on AN767, it's working by itself

I'm trying to make my application bootloader aware by following steps in AN767 and AN533

I'm not sure where to add the linker command line options to add the infoblock at the end of the image

I went to project properties -> C/C++ Build -> Settings -> Keil 8051 Linker -> Command line pattern

and appended

CODE(0x400-0x1DFF,?CO?F39X_INFOBLOCK(0x1DF5))

application FW space is 0x400 to 0x1DFF

Obviously I'm missing something here, this is a dump of the log with the error:

 

 

21:21:28 **** Incremental Build of configuration Keil 8051 v9.53 - Debug for project R1001_fw ****

make all

PATH=/Applications/SimplicityStudio_v3/developer/toolchains/keil_8051/9.53/BIN:/Applications/SimplicityStudio_v3/developer/utilities/build-support/usr/bin:/Applications/SimplicityStudio_v3/developer/utilities/third-party/wine/opt/local/bin:/Applications/SimplicityStudio_v3/developer/utilities/build-support/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin

 

Building target: R1001_fw.omf

Invoking: Keil 8051 Linker

wine /Applications/SimplicityStudio_v3/developer/toolchains/keil_8051/9.53/BIN/LX51 "@R1001_fw.lnp" || test $? -lt 2

fixme:heap:HeapSetInformation 0x0 1 0x0 0

 

LX51 LINKER/LOCATER V4.66.30.0 - SN: K1RIC-W0HRLZ

COPYRIGHT ARM Germany GmbH 1995 - 2014

@R1001_fw.lnp "./src/InitDevice.OBJ",

"./src/Interrupts.OBJ",

"./src/R1001_fw_main.OBJ",

"./src/SILABS_STARTUP.OBJ",

"./src/drv8825.OBJ",

"./src/i2c.OBJ",

"./src/F39x_InfoBlock.OBJ"

TO "R1001_FW.OMF.CRBUILD" REMOVEUNUSED PRINT(.\R1001_fw.m51) PAGEWIDTH (120) PAGELENGTH (65) CODE(0x400-0x1DFF,?CO?F39X_INFOBLOCK(0x1DF5)) CLASSES( XDATA(X:0x0 - X:0xff), HDATA(X:0x0 - X:0xff))

make: *** [R1001_fw.omf] Error 1

 

*** ERROR L201: INVALID COMMAND LINE SYNTAX

    POS: 279

    T (.\R1001_fw.m51) PAGEWIDTH (120) PAGELENGTH (65) CODE (0x400-0x1DFF,

 

21:21:29 Build Finished (took 377ms)

Posts: 1,839
Registered: ‎10-14-2014

Re: EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

@sherif_eid

Do you have a chance to try the BL51 instead of LX51.

 

With LX51 you may try flag like keyword SEGMENTS than CODE.

My views are my own and do not necessarily represent the views of Silicon Labs

WeiguoLu
Posts: 19
Registered: ‎06-17-2016

Re: EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

I just tried, I got a different error

 

23:40:52 **** Incremental Build of configuration Keil 8051 v9.53 - Debug for project R1001_fw ****

make all

PATH=/Applications/SimplicityStudio_v3/developer/toolchains/keil_8051/9.53/BIN:/Applications/SimplicityStudio_v3/developer/utilities/build-support/usr/bin:/Applications/SimplicityStudio_v3/developer/utilities/third-party/wine/opt/local/bin:/Applications/SimplicityStudio_v3/developer/utilities/build-support/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin

 

Building target: R1001_fw.omf

Invoking: Keil 8051 Linker

wine /Applications/SimplicityStudio_v3/developer/toolchains/keil_8051/9.53/BIN/BL51 "@R1001_fw.lnp" || test $? -lt 2

 

BL51 BANKED LINKER/LOCATER V6.22 - SN: K1RIC-W0HRLZ

COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 2009

"./src/InitDevice.OBJ",

"./src/Interrupts.OBJ",

"./src/R1001_fw_main.OBJ",

"./src/SILABS_STARTUP.OBJ",

"./src/drv8825.OBJ",

"./src/i2c.OBJ",

"./src/F39x_InfoBlock.OBJ"

TO "R1001_FW.OMF.CRBUILD" PRINT(.\R1001_fw.m51) PAGEWIDTH (120) PAGELENGTH (65) CODE(0x400-0x1DFF,?CO?F39X_INFOBLOCK(0x1DF5)) XDATA(0x0 - 0xff)

 

*** FATAL ERROR L218: NOT AN OBJECT FILE

make: *** [R1001_fw.omf] Error 1

    FILE: ./src/InitDevice.OBJ

 

23:40:52 Build Finished (took 379ms)

Posts: 19
Registered: ‎06-17-2016

Re: EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

I realized that I tried CODE with BL51

do you have an example of how to try SEGMENTS keyword?

Posts: 19
Registered: ‎06-17-2016

Re: EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

@delu

do you have any examples on how to use SEGMENTS keyword?

Posts: 8,003
Registered: ‎08-13-2003

Re: EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

Posts: 19
Registered: ‎06-17-2016

Re: EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

Thanks, I was able to get the build to run without errors or warnings, I used command line options

Keil Compiler: INTVECTOR(0x400) INTERVAL(3)

Keil Linker LX51: CODE(0x400-0x01DFF) SEGMENTS(?CO?INFOBLOCK (0x1DF5))

 

it showed the following in console

"./src/InfoBlock.OBJ"

TO "R1001_FW.OMF.CRBUILD" REMOVEUNUSED PRINT(.\R1001_fw.m51) PAGEWIDTH (120) PAGELENGTH (65) CODE(0x400-0x01DFF) SEGMENTS(?CO?INFOBLOCK (0x1DF5)) CLASSES( XDATA(X:0x0 - X:0xff), HDATA(X:0x0 - X:0xff))

 

now when I looked at the hex file it started with

 

:020000040000FA
:10000000020424E88FF0A4CC8BF0A42CFCE98EF041
:10001000A42CFC8AF0EDA42CFCEA8EF0A4CDA8F070
:100020008BF0A42DCC3825F0FDE98FF0A42CCD3534
:10003000F0FCEB8EF0A4FEA9F0EB8FF0A4CFC5F09E
:100040002ECD39FEE43CFCEAA42DCE35F0FDE43C97
....

 

shouldn't the address in the second line (data) start with 0400 rather than 0000? or should I just take the data and flash it at 0x400?

Posts: 19
Registered: ‎06-17-2016

Re: EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

@erikm it seems that lx51 is not supported on silabs IDE for 8051

do you know of a way to use bl51?

 

http://community.silabs.com/t5/8-bit-MCU-Knowledge-Base/Keil-LX51-Linker/ta-p/111979

 

Highlighted
Posts: 19
Registered: ‎06-17-2016

Re: EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

So after some exchange with Silicon Labs support I finally got everything to work. They're really fast in getting bak.

It's actually quite some additional extra work other than what's documented in AN767 or AN533, so I'm listing the details here

 

1- Get the compiler to point the interrupt vectors to the application firmware start address (0x400 in my case) by opening the project properties

C/C++ Build -> Settings -> Keil 8051 Compiler -> General -> Interrupt vectors at address (set it to 0x400)

2- Get the linker to placed the application code at the start address, AND the block information at the end of the last page of the application firmware, go to

C/C++ Build -> Settings -> Keil 8051 Linker

  - make sure the Command is set to 'LX51'

C/C++ Build -> Settings -> Keil 8051 Linker -> Miscellaneous -> Additional Flags

  - add 'CLASSES(CODE (C:0x400-C:0x1DFF)) OVERLAY(* ! ?CO?F39X_INFOBLOCK) SEGMENTS(?CO?F39X_INFOBLOCK (C:0x1DF5))'

 

as you see this line is significantly from what's documented in AN767/AN533, so here's what it means

 

CLASSES(CODE (C:0x400-C:0x1DFF)) : relocates the program code space to be bounded by address range 0x400 to 0x1DFF

 

OVERLAY(* ! ?CO?F39X_INFOBLOCK)  : THIS IS VERY IMPORTANT, the information block in AN767 is typically a block that won't be referenced anywhere by the application firmware. If for any reason it is used then this command it not needed. If it's not referenced the linked with REMOVE the segment as it will consider it UNUSED, so that segment needs to be added as a root segment, this command does that

 

SEGMENTS(?CO?F39X_INFOBLOCK (C:0x1DF5)) : this places the infoblock data segment at the end of the last page

 

Posts: 8,003
Registered: ‎08-13-2003

Re: EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

[ Edited ]

just a note, many have missed this

 

with bootloaders is essential to realize that relocating interrupt vectors does NOT relocate them. it just makes a call at the hardware defined interrupt vector location to wherever you 'relocate' them.

 

thus a bootloader that uses interrupts together with an app that uses interrupts MUST have a shared interrupt handler that is permanently in page 0 never to be replaced, that code then will call the appropriate boot/app ISR based on a flag.

 

another trap: if you use the relocate vector function, the linker automatically set the calls in page 0, so using vector relocate to position the 'vectors' will result in the load file for this code to have page 0 code and thus destroy the non-replaceable code

erik
Posts: 19
Registered: ‎06-17-2016

Re: EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

thanks @erikm

so what you're saying is that it's better to NOT use interrupts in the bootloader

are there cases where it is useful or required? what you go then?

Posts: 8,003
Registered: ‎08-13-2003

Re: EFM8 ERROR L201: INVALID COMMAND LINE SYNTAX

1) if you can do it w/o using interrupts in the bootloader, it's easy, just have page 0 as part of the app.

2) if you need ints in both it takes a chunk of assembler code to make the "interrupt distrbutor

3) there are 'solutions' without the above but they all do not adhere to 'my' rule "a power interrupt at any time will not make reprogramming by e2c required a bootload will be possible regardless

erik