[fpc-devel] Embedded Strings on nRF51-DK
Paul Michell
Paul at michellcomputing.co.uk
Thu Apr 16 12:49:49 CEST 2015
Hello,
I'm using FPC to build embedded binaries for the Nordic Semiconductor nRF51-DK
development board:
http://www.nordicsemi.com/eng/Products/nRF51-DK
I have been able to adapt the sample gcc make scripts to replace C units with
equivalent pascal units after partially translating the header files from the
SDK. This has enabled me to build test applications to use the board's
buttons, LEDs, UART and timers.
However, when I try to use pascal string variables (short or long) the
compiler fails. For example the following works:
Function Main: Integer; Cdecl; Alias: 'main';
Begin
UARTConfigure(11, 9, 10, 8, True);
UARTPutString('Hello World');
End;
But this fails:
Function Main: Integer; Cdecl; Alias: 'main';
Var
Text: String;
Begin
Text := 'Hello World';
UARTConfigure(11, 9, 10, 8, True);
UARTPutString(Text);
End;
With the following errors:
Main.pas:(.text.n_main_$$_main$$smallint+0xe): undefined reference to
`fpc_pushexceptaddr'
Main.pas:(.text.n_main_$$_main$$smallint+0x12): undefined reference to
`fpc_setjmp'
Main.pas:(.text.n_main_$$_main$$smallint+0x26): undefined reference to
`fpc_shortstr_to_shortstr'
Main.pas:(.text.n_main_$$_main$$smallint+0x42): undefined reference to
`fpc_shortstr_to_ansistr'
Main.pas:(.text.n_main_$$_main$$smallint+0x4e): undefined reference to
`fpc_popaddrstack'
Main.pas:(.text.n_main_$$_main$$smallint+0x54): undefined reference to
`fpc_ansistr_decr_ref'
Main.pas:(.text.n_main_$$_main$$smallint+0x64): undefined reference to
`fpc_reraise'
I assume this is because string handling support is not included in the
embedded RTL generated with the compiler, or that I am not linking the right
object files if I need to do this by hand? What would be the best way to
enable string handling? Even short string handling would make FPC far more
preferable to C for me for embedded work.
Thanks,
Paul Michell
More information about the fpc-devel
mailing list