mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 15:40:22 +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
|
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
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -16,23 +37,55 @@ unit esp32;
|
|||||||
|
|
||||||
var
|
var
|
||||||
_stack_top: record end; public name '_stack_top';
|
_stack_top: record end; public name '_stack_top';
|
||||||
|
operatingsystem_result: longint; external name 'operatingsystem_result';
|
||||||
|
|
||||||
procedure PASCALMAIN; external name 'PASCALMAIN';
|
procedure PASCALMAIN; external name 'PASCALMAIN';
|
||||||
|
|
||||||
procedure esp_deep_sleep_start;external;
|
procedure esp_deep_sleep_start;external;
|
||||||
procedure putchar(c : char);external;
|
procedure putchar(c : char);external;
|
||||||
function getchar : 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;
|
procedure _FPC_haltproc; public name '_haltproc';noreturn;
|
||||||
begin
|
begin
|
||||||
|
printpchar('_haltproc called, going to deep sleep, exit code: $');
|
||||||
|
printdword(operatingsystem_result);
|
||||||
|
printpchar(#10);
|
||||||
while true do
|
while true do
|
||||||
esp_deep_sleep_start;
|
esp_deep_sleep_start;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure app_main;public name 'app_main';noreturn;
|
procedure app_main;public name 'app_main';noreturn;
|
||||||
begin
|
begin
|
||||||
PASCALMAIN;
|
PASCALMAIN;
|
||||||
_FPC_haltproc;
|
_FPC_haltproc;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -48,7 +101,7 @@ unit esp32;
|
|||||||
ReadChar:=true;
|
ReadChar:=true;
|
||||||
ACh:=getchar;
|
ACh:=getchar;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
OpenIO(Input, @WriteChar, @ReadChar, fmInput, nil);
|
OpenIO(Input, @WriteChar, @ReadChar, fmInput, nil);
|
||||||
OpenIO(Output, @WriteChar, @ReadChar, fmOutput, nil);
|
OpenIO(Output, @WriteChar, @ReadChar, fmOutput, nil);
|
||||||
|
Loading…
Reference in New Issue
Block a user