Skip to content

Commit

Permalink
Merge branch 'wip/ppc-lynx178' into 'master'
Browse files Browse the repository at this point in the history
ppc-lynx: add light runtime support

See merge request eng/toolchain/bb-runtimes!144
  • Loading branch information
Helflym committed Nov 28, 2024
2 parents 4f467ed + 6397a57 commit cecd163
Show file tree
Hide file tree
Showing 12 changed files with 339 additions and 49 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ ifeq ($(TARGET),$(filter $(TARGET),ppc-pikeos5))
TARGETS=ppc-pikeos5
endif

ifeq ($(TARGET),$(filter $(TARGET),ppc-lynx178))
TGT=powerpc-xcoff-lynxos178
TARGETS=ppc-lynx178
endif

ifeq ($(TARGETS), none)
ifeq ($(TARGET),)
$(error Error: TARGET is not defined)
Expand Down
5 changes: 5 additions & 0 deletions build_rts.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@

from freertos import ArmV7AFP_FreeRTOS

from lynx import PPCLynx

import argparse
import os
import subprocess
Expand Down Expand Up @@ -326,6 +328,9 @@ def build_configs(target):
t = Aarch64QNX()
elif target == "arm-qnx":
t = ARMQNX()
# LynxOS
elif target == "ppc-lynx178":
t = PPCLynx()
else:
print("Error: undefined target %s" % target)
sys.exit(2)
Expand Down
11 changes: 10 additions & 1 deletion gen_rts_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,16 @@ def main():
)
parser.add_argument(
"--source-profile",
choices=["bb", "deos", "freertos", "linux", "pikeos", "vx7r2cert", "qnx"],
choices=[
"bb",
"deos",
"freertos",
"linux",
"lynx",
"pikeos",
"vx7r2cert",
"qnx",
],
default="bb",
help="platform specific source selections",
)
Expand Down
2 changes: 1 addition & 1 deletion linux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class Linux(DFBBTarget):
def __init__(self):
super().__init__()
self.add_gnat_sources("src/s-macres__native.adb")
self.add_gnat_sources("src/s-macres__libc.adb")
self.add_gnarl_sources("linux/adaint.c")

def has_libc(self, profile):
Expand Down
50 changes: 50 additions & 0 deletions lynx/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from support.bsp_sources.target import Target
from support.bsp_sources.archsupport import ArchSupport


class Lynx(Target):
def __init__(self):
super().__init__()
self.add_gnat_sources("src/s-macres__libc.adb", "lynx/stdio_symbols.c")

def has_libc(self, profile):
return True

@property
def has_single_precision_fpu(self):
return True

@property
def has_double_precision_fpu(self):
return True

@property
def is_os_target(self):
return True

@property
def has_command_line_arguments(self):
return True

@property
def is_legacy_format(self):
return True


class PPCLynx(Lynx):
def __init__(self):
super().__init__()

@property
def target(self):
return "ppc-lynx178"

@property
def name(self):
return "lynx"

@property
def system_ads(self):
return {
"light": "system-lynxos178-ppc.ads",
}
55 changes: 55 additions & 0 deletions lynx/stdio_symbols.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/****************************************************************************
* *
* GNAT RUN-TIME COMPONENTS *
* *
* S T D I O S Y M B O L S *
* *
* C Implementation File *
* *
* Copyright (C) 2024-2024, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
* ware Foundation; either version 3, or (at your option) any later ver- *
* sion. GNAT is distributed in the hope that it will be useful, but WITH- *
* OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* As a special exception under Section 7 of GPL version 3, you are granted *
* additional permissions described in the GCC Runtime Library Exception, *
* version 3.1, as published by the Free Software Foundation. *
* *
* You should have received a copy of the GNU General Public License and *
* a copy of the GCC Runtime Library Exception along with this program; *
* see the files COPYING3 and COPYING.RUNTIME respectively. If not, see *
* <http://www.gnu.org/licenses/>. *
* *
* GNAT was originally developed by the GNAT team at New York University. *
* Extensive contributions were provided by Ada Core Technologies Inc. *
* *
****************************************************************************/

#include <stdio.h>

/*
* stdin, stdout and stderr are C defines and must be exposed for
* a-textio__ppclynx178.adb.
*/

FILE *
__gnat_constant_stdin (void)
{
return stdin;
}

FILE *
__gnat_constant_stdout (void)
{
return stdout;
}

FILE *
__gnat_constant_stderr (void)
{
return stderr;
}
2 changes: 1 addition & 1 deletion qnx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class QNX(Target):
def __init__(self):
super(QNX, self).__init__()
self.add_gnat_sources("src/s-macres__qnx.adb")
self.add_gnat_sources("src/s-macres__libc.adb")

@property
def has_command_line_arguments(self):
Expand Down
File renamed without changes.
45 changes: 0 additions & 45 deletions src/s-macres__native.adb

This file was deleted.

Loading

0 comments on commit cecd163

Please sign in to comment.