mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 04:59:25 +02:00
+ Xtensa: add linklib statements, better _halt procedure
git-svn-id: trunk@44441 -
This commit is contained in:
parent
8e929b2879
commit
314b8999aa
@ -9,6 +9,27 @@ unit esp32;
|
||||
|
||||
interface
|
||||
|
||||
{$linklib esp32,static}
|
||||
{$linklib soc,static}
|
||||
{$linklib driver,static}
|
||||
{$linklib freertos,static}
|
||||
{$linklib log,static}
|
||||
{$linklib esp_common,static}
|
||||
{$linklib heap,static}
|
||||
{$linklib newlib,static}
|
||||
{$linklib vfs,static}
|
||||
{$linklib esp_ringbuf,static}
|
||||
{$linklib spi_flash,static}
|
||||
{$linklib app_update,static}
|
||||
{$linklib xtensa,static}
|
||||
{$linklib esp_timer,static}
|
||||
{$linklib bootloader_support,static}
|
||||
{$linklib pthread,static}
|
||||
{$linklib soc_esp32,static}
|
||||
{$linklib hal,static}
|
||||
{$linklib c,static}
|
||||
{$linklib esp_event,static}
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -16,23 +37,55 @@ unit esp32;
|
||||
|
||||
var
|
||||
_stack_top: record end; public name '_stack_top';
|
||||
operatingsystem_result: longint; external name 'operatingsystem_result';
|
||||
|
||||
procedure PASCALMAIN; external name 'PASCALMAIN';
|
||||
|
||||
|
||||
procedure esp_deep_sleep_start;external;
|
||||
procedure putchar(c : char);external;
|
||||
function getchar : char;external;
|
||||
|
||||
function __getreent : pointer;external;
|
||||
procedure fflush(f : pointer);external;
|
||||
|
||||
procedure printpchar(p : pchar);
|
||||
begin
|
||||
while p^<>#0 do
|
||||
begin
|
||||
putchar(p^);
|
||||
inc(p);
|
||||
end;
|
||||
fflush(ppointer(__getreent+8)^);
|
||||
end;
|
||||
|
||||
|
||||
procedure printdword(d : dword);
|
||||
const
|
||||
s = '0123456789ABCDEF';
|
||||
var
|
||||
i : longint;
|
||||
begin
|
||||
for i:=1 to 8 do
|
||||
begin
|
||||
putchar(s[(d and $f)+1]);
|
||||
d:=d shr 4;
|
||||
end;
|
||||
fflush(ppointer(__getreent+8)^);
|
||||
end;
|
||||
|
||||
|
||||
procedure _FPC_haltproc; public name '_haltproc';noreturn;
|
||||
begin
|
||||
printpchar('_haltproc called, going to deep sleep, exit code: $');
|
||||
printdword(operatingsystem_result);
|
||||
printpchar(#10);
|
||||
while true do
|
||||
esp_deep_sleep_start;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
procedure app_main;public name 'app_main';noreturn;
|
||||
begin
|
||||
PASCALMAIN;
|
||||
PASCALMAIN;
|
||||
_FPC_haltproc;
|
||||
end;
|
||||
|
||||
@ -48,7 +101,7 @@ unit esp32;
|
||||
ReadChar:=true;
|
||||
ACh:=getchar;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
OpenIO(Input, @WriteChar, @ReadChar, fmInput, nil);
|
||||
OpenIO(Output, @WriteChar, @ReadChar, fmOutput, nil);
|
||||
|
Loading…
Reference in New Issue
Block a user