Add initial rdk-brcm-mips Change-Id: I552af9ca8c468aeeb89d0d3b98f88e81d96f8d88
diff --git a/src/third_party/starboard/rdk/brcm/mips/architecture.gypi b/src/third_party/starboard/rdk/brcm/mips/architecture.gypi new file mode 100644 index 0000000..256f880 --- /dev/null +++ b/src/third_party/starboard/rdk/brcm/mips/architecture.gypi
@@ -0,0 +1,41 @@ +# Copyright 2020 Comcast Cable Communications Management, LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright 2017 The Cobalt Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{ + 'target_defaults': { + 'target_conditions': [ + ['_toolset=="target"', { + 'cflags!': [ + '-march=armv7-a', + ], + }], + ], + }, +}
diff --git a/src/third_party/starboard/rdk/brcm/mips/atomic_public.h b/src/third_party/starboard/rdk/brcm/mips/atomic_public.h new file mode 100644 index 0000000..0bd7577 --- /dev/null +++ b/src/third_party/starboard/rdk/brcm/mips/atomic_public.h
@@ -0,0 +1,37 @@ +// Copyright 2020 Comcast Cable Communications Management, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// SPDX-License-Identifier: Apache-2.0 + +// +// Copyright 2016 The Cobalt Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef THIRD_PARTY_STARBOARD_RDK_BRCM_MIPS_ATOMIC_PUBLIC_H_ +#define THIRD_PARTY_STARBOARD_RDK_BRCM_MIPS_ATOMIC_PUBLIC_H_ + +#include "third_party/starboard/rdk/shared/atomic_public.h" + +#endif // THIRD_PARTY_STARBOARD_RDK_BRCM_MIPS_ATOMIC_PUBLIC_H_
diff --git a/src/third_party/starboard/rdk/brcm/mips/configuration_constants.cc b/src/third_party/starboard/rdk/brcm/mips/configuration_constants.cc new file mode 100644 index 0000000..1fe08af --- /dev/null +++ b/src/third_party/starboard/rdk/brcm/mips/configuration_constants.cc
@@ -0,0 +1,163 @@ +// Copyright 2020 Comcast Cable Communications Management, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright 2019 The Cobalt Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file defines all configuration constants for a platform. + +#include "starboard/configuration_constants.h" + +#if SB_API_VERSION >= 12 + +// Determines the threshhold of allocation size that should be done with mmap +// (if available), rather than allocated within the core heap. +const size_t kSbDefaultMmapThreshold = 256 * 1024U; + +// The current platform's maximum length of the name of a single directory +// entry, not including the absolute path. +const int32_t kSbFileMaxName = 64; + +// The current platform's maximum number of files that can be opened at the +// same time by one process. +const uint32_t kSbFileMaxOpen = 256; + +// The current platform's alternate file path component separator character. +// This is like SB_FILE_SEP_CHAR, except if your platform supports an alternate +// character, then you can place that here. For example, on windows machines, +// the primary separator character is probably '\', but the alternate is '/'. +const char kSbFileAltSepChar = '/'; + +// The string form of SB_FILE_ALT_SEP_CHAR. +const char* kSbFileAltSepString = "/"; + +// The current platform's maximum length of an absolute path. +const uint32_t kSbFileMaxPath = 4096; + +// The current platform's file path component separator character. This is the +// character that appears after a directory in a file path. For example, the +// absolute canonical path of the file "/path/to/a/file.txt" uses '/' as a path +// component separator character. +const char kSbFileSepChar = '/'; + +// The string form of SB_FILE_SEP_CHAR. +const char* kSbFileSepString = "/"; + +// Allow ac3 and ec3 support +const bool kSbHasAc3Audio = true; + +// Specifies whether this platform has webm/vp9 support. This should be set to +// non-zero on platforms with webm/vp9 support. +const bool kSbHasMediaWebmVp9Support = true; + +// On default Linux desktop, you must be a superuser in order to set real time +// scheduling on threads. +const bool kSbHasThreadPrioritySupport = false; + +// Determines the alignment that allocations should have on this platform. +const size_t kSbMallocAlignment = 16; + +// The maximum number of thread local storage keys supported by this platform. +const uint32_t kSbMaxThreadLocalKeys = 512; + +// The maximum length of a name for a thread, including the NULL-terminator. +const int32_t kSbMaxThreadNameLength = 16; + +// Defines the path where memory debugging logs should be written to. +const char* kSbMemoryLogPath = "/tmp/starboard"; + +// The maximum audio bitrate the platform can decode. The following value +// equals to 5M bytes per seconds which is more than enough for compressed +// audio. +const uint32_t kSbMediaMaxAudioBitrateInBitsPerSecond = 40 * 1024 * 1024; + +// The maximum video bitrate the platform can decode. The following value +// equals to 25M bytes per seconds which is more than enough for compressed +// video. +const uint32_t kSbMediaMaxVideoBitrateInBitsPerSecond = 200 * 1024 * 1024; + +// Specify the number of video frames to be cached during playback. A large +// value leads to more stable fps but also causes the app to use more memory. +const uint32_t kSbMediaMaximumVideoFrames = 12; + +// The encoded video frames are compressed in different ways, their decoding +// time can vary a lot. Occasionally a single frame can take longer time to +// decode than the average time per frame. The player has to cache some frames +// to account for such inconsistency. The number of frames being cached are +// controlled by the following two macros. +// +// Specify the number of video frames to be cached before the playback starts. +// Note that set this value too large may increase the playback start delay. +const uint32_t kSbMediaMaximumVideoPrerollFrames = 4; + +// Specifies how video frame buffers must be aligned on this platform. +const uint32_t kSbMediaVideoFrameAlignment = 256; + +// The memory page size, which controls the size of chunks on memory that +// allocators deal with, and the alignment of those chunks. This doesn't have to +// be the hardware-defined physical page size, but it should be a multiple of +// it. +const size_t kSbMemoryPageSize = 4096; + +// Specifies the network receive buffer size in bytes, set via +// SbSocketSetReceiveBufferSize(). +// +// Setting this to 0 indicates that SbSocketSetReceiveBufferSize() should +// not be called. Use this for OSs (such as Linux) where receive buffer +// auto-tuning is better. +// +// On some platforms, this may affect max TCP window size which may +// dramatically affect throughput in the presence of latency. +// +// If your platform does not have a good TCP auto-tuning mechanism, +// a setting of (128 * 1024) here is recommended. +const uint32_t kSbNetworkReceiveBufferSize = 0; + +// Defines the maximum number of simultaneous threads for this platform. Some +// platforms require sharing thread handles with other kinds of system handles, +// like mutexes, so we want to keep this managable. +const uint32_t kSbMaxThreads = 90; + +// The current platform's search path component separator character. When +// specifying an ordered list of absolute paths of directories to search for a +// given reason, this is the character that appears between entries. For +// example, the search path of "/etc/search/first:/etc/search/second" uses ':' +// as a search path component separator character. +const char kSbPathSepChar = ':'; + +// The string form of SB_PATH_SEP_CHAR. +const char* kSbPathSepString = ":"; + +// Specifies the preferred byte order of color channels in a pixel. Refer to +// starboard/configuration.h for the possible values. EGL/GLES platforms should +// generally prefer a byte order of RGBA, regardless of endianness. +const int kSbPreferredRgbaByteOrder = SB_PREFERRED_RGBA_BYTE_ORDER_RGBA; + +// The maximum number of users that can be signed in at the same time. +const uint32_t kSbUserMaxSignedIn = 1; + +#endif // SB_API_VERSION >= 12
diff --git a/src/third_party/starboard/rdk/brcm/mips/configuration_public.h b/src/third_party/starboard/rdk/brcm/mips/configuration_public.h new file mode 100644 index 0000000..e9276c4 --- /dev/null +++ b/src/third_party/starboard/rdk/brcm/mips/configuration_public.h
@@ -0,0 +1,312 @@ +// +// Copyright 2020 Comcast Cable Communications Management, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright 2017 The Cobalt Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The Starboard configuration for a rdk implementation designed to be +// built on rdk platforms. + +#ifndef THIRD_PARTY_STARBOARD_RDK_BRCM_MIPS_CONFIGURATION_PUBLIC_H_ +#define THIRD_PARTY_STARBOARD_RDK_BRCM_MIPS_CONFIGURATION_PUBLIC_H_ + +// --- Architecture Configuration -------------------------------------------- + +// Some platforms will not align variables on the stack with an alignment +// greater than 16 bytes. Platforms where this is the case should define the +// following quirk. +#define SB_HAS_QUIRK_DOES_NOT_STACK_ALIGN_OVER_16_BYTES 1 +#define SB_HAS_QUIRK_DOES_NOT_ALIGN_FIELDS_IN_HEAP_OVER_16_BYTES 1 + +// Some platforms do not have thread affinity support. Platforms where this is +// the case should define the following quirk. +#undef SB_HAS_QUIRK_THREAD_AFFINITY_UNSUPPORTED + +// Some platforms the mapped GL buffer memory is slow to read from. Platforms +// where this is the case should define the following quirk. +#undef SB_HAS_QUIRK_GL_MAP_BUFFER_MEMORY_IS_SLOW_TO_READ + +// --- System Header Configuration ------------------------------------------- + +// Any system headers listed here that are not provided by the platform will be +// emulated in starboard/types.h. + +// Whether the current platform provides the standard header stdarg.h. +#define SB_HAS_STDARG_H 1 + +// Whether the current platform provides the standard header stdbool.h. +#define SB_HAS_STDBOOL_H 1 + +// Whether the current platform provides the standard header stddef.h. +#define SB_HAS_STDDEF_H 1 + +// Whether the current platform provides the standard header stdint.h. +#define SB_HAS_STDINT_H 1 + +// Whether the current platform provides the standard header inttypes.h. +#define SB_HAS_INTTYPES_H 1 + +// Whether the current platform provides the standard header sys/types.h. +#define SB_HAS_SYS_TYPES_H 1 + +// Whether the current platform provides the standard header wchar.h. +#define SB_HAS_WCHAR_H 1 + +// Whether the current platform provides the standard header limits.h. +#define SB_HAS_LIMITS_H 1 + +// Whether the current platform provides the standard header float.h. +#define SB_HAS_FLOAT_H 1 + +// Whether the current platform provides ssize_t. +#define SB_HAS_SSIZE_T 1 + +// Type detection for wchar_t. +#if defined(__WCHAR_MAX__) && \ + (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff) +#define SB_IS_WCHAR_T_UTF32 1 +#elif defined(__WCHAR_MAX__) && \ + (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff) +#define SB_IS_WCHAR_T_UTF16 1 +#endif + +// Chrome only defines these two if ARMEL or MIPSEL are defined. +#if defined(__ARMEL__) +// Chrome has an exclusion for iOS here, we should too when we support iOS. +#define SB_IS_WCHAR_T_UNSIGNED 1 +#elif defined(__MIPSEL__) +#define SB_IS_WCHAR_T_SIGNED 1 +#endif + +// Some platforms have memset predefined in system headers. Platforms where this +// is the case should define the following quirk. +#undef SB_HAS_QUIRK_MEMSET_IN_SYSTEM_HEADERS + +// This quirk is used to switch the headers included in +// starboard/shared/linux/socket_get_interface_address.cc for darwin system +// headers. It may be removed at some point in favor of a different solution. +#undef SB_HAS_QUIRK_SOCKET_BSD_HEADERS + +// Some platforms don't support gmtime_r. Platforms where this is the case +// should define the following quirk. +#undef SB_HAS_QUIRK_NO_GMTIME_R + +// --- Compiler Configuration ------------------------------------------------ + +// The platform's annotation for forcing a C function to be inlined. +#define SB_C_FORCE_INLINE __inline__ __attribute__((always_inline)) + +// The platform's annotation for marking a C function as suggested to be +// inlined. +#define SB_C_INLINE inline + +// The platform's annotation for marking a C function as forcibly not +// inlined. +#define SB_C_NOINLINE __attribute__((noinline)) + +// The platform's annotation for marking a symbol as exported outside of the +// current shared library. +#define SB_EXPORT_PLATFORM __attribute__((visibility("default"))) + +// The platform's annotation for marking a symbol as imported from outside of +// the current linking unit. +#define SB_IMPORT_PLATFORM + +// On some platforms the __GNUC__ is defined even though parts of the +// functionality are missing. Setting this to non-zero allows disabling missing +// functionality encountered. +#undef SB_HAS_QUIRK_COMPILER_SAYS_GNUC_BUT_ISNT + +// On some compilers, the frontend has a quirk such that #ifdef cannot +// correctly detect __has_feature is defined, and an example error you get is: +#undef SB_HAS_QUIRK_HASFEATURE_NOT_DEFINED_BUT_IT_IS + +// --- Extensions Configuration ---------------------------------------------- + +// Do not use <unordered_map> and <unordered_set> for the hash table types. +#define SB_HAS_STD_UNORDERED_HASH 1 + +// GCC/Clang doesn't define a long long hash function, except for Android and +// Game consoles. +#define SB_HAS_LONG_LONG_HASH 0 + +// GCC/Clang doesn't define a string hash function, except for Game Consoles. +#define SB_HAS_STRING_HASH 0 + +// Desktop Linux needs a using statement for the hash functions. +#define SB_HAS_HASH_USING 0 + +// Set this to 1 if hash functions for custom types can be defined as a +// hash_value() function. Otherwise, they need to be placed inside a +// partially-specified hash struct template with an operator(). +#define SB_HAS_HASH_VALUE 0 + +// Set this to 1 if use of hash_map or hash_set causes a deprecation warning +// (which then breaks the build). +#define SB_HAS_HASH_WARNING 1 + +// The location to include hash_map on this platform. +#define SB_HASH_MAP_INCLUDE <ext/hash_map> + +// C++'s hash_map and hash_set are often found in different namespaces depending +// on the compiler. +#define SB_HASH_NAMESPACE __gnu_cxx + +// The location to include hash_set on this platform. +#define SB_HASH_SET_INCLUDE <ext/hash_set> + +// Define this to how this platform copies varargs blocks. +#define SB_VA_COPY(dest, source) va_copy(dest, source) + +// --- Filesystem Configuration ---------------------------------------------- + +// Some operating systems constantly return zero values for creation, access +// and modification time for files and directories. When this quirk is defined, +// we need to ignore corresponded time values in applications as well as take +// this fact into account in unit tests. +#undef SB_HAS_QUIRK_FILESYSTEM_ZERO_FILEINFO_TIME + +// On some platforms the file system stores access times at a coarser +// granularity than other times. When this quirk is defined, we assume the +// access time is of 1 day precision. +#undef SB_HAS_QUIRK_FILESYSTEM_COARSE_ACCESS_TIME + +// On some platforms the file system cannot access extremely long file names. +// We do not need this feature on stub. +#undef SB_HAS_QUIRK_HASH_FILE_NAME + +// --- Graphics Configuration ------------------------------------------------ + +// Specifies whether this platform supports a performant accelerated blitter +// API. The basic requirement is a scaled, clipped, alpha-blended blit. +#define SB_HAS_BLITTER 0 + +// Indicates whether or not the given platform supports bilinear filtering. +// This can be checked to enable/disable renderer tests that verify that this is +// working properly. +#define SB_HAS_BILINEAR_FILTERING_SUPPORT 1 + +// Indicates whether or not the given platform supports rendering of NV12 +// textures. These textures typically originate from video decoders. +#define SB_HAS_NV12_TEXTURE_SUPPORT 0 + +// Whether the current platform should frequently flip their display buffer. +// If this is not required (e.g. SB_MUST_FREQUENTLY_FLIP_DISPLAY_BUFFER is set +// to 0), then optimizations where the display buffer is not flipped if the +// scene hasn't changed are enabled. +#undef SB_MUST_FREQUENTLY_FLIP_DISPLAY_BUFFER + +// --- Media Configuration --------------------------------------------------- + +// After a seek is triggerred, the default behavior is to append video frames +// from the last key frame before the seek time and append audio frames from the +// seek time because usually all audio frames are key frames. On platforms that +// cannot decode video frames without displaying them, this will cause the video +// being played without audio for several seconds after seeking. When the +// following macro is defined, the app will append audio frames start from the +// timestamp that is before the timestamp of the video key frame being appended. +#undef SB_HAS_QUIRK_SEEK_TO_KEYFRAME + +// The implementation is allowed to support kSbMediaAudioSampleTypeInt16 only +// when this macro is defined. +#define SB_HAS_QUIRK_SUPPORT_INT16_AUDIO_SAMPLES 1 + +// dlmalloc will use the ffs intrinsic if available. Platforms on which this is +// not available should define the following quirk. +#undef SB_HAS_QUIRK_NO_FFS + +// Specifies whether this platform updates audio frames asynchronously. In such +// case an extra parameter will be added to |SbAudioSinkConsumeFramesFunc| to +// indicate the absolute time that the consumed audio frames are reported. +// Check document for |SbAudioSinkConsumeFramesFunc| in audio_sink.h for more +// details. +#define SB_HAS_ASYNC_AUDIO_FRAMES_REPORTING 0 + +// Specifies the stack size for threads created inside media stack. Set to 0 to +// use the default thread stack size. Set to non-zero to explicitly set the +// stack size for media stack threads. +#define SB_MEDIA_THREAD_STACK_SIZE 0U + +// --- Decoder-only Params --- + +// Specifies how media buffers must be aligned on this platform as some +// decoders may have special requirement on the alignment of buffers being +// decoded. +#define SB_MEDIA_BUFFER_ALIGNMENT 128U + +// --- Memory Configuration -------------------------------------------------- + +// Whether this platform has and should use an MMAP function to map physical +// memory to the virtual address space. +#define SB_HAS_MMAP 1 + +// Whether this platform can map executable memory. Implies SB_HAS_MMAP. This is +// required for platforms that want to JIT. +#define SB_CAN_MAP_EXECUTABLE_MEMORY 1 + +// Whether this platform has and should use an growable heap (e.g. with sbrk()) +// to map physical memory to the virtual address space. +#define SB_HAS_VIRTUAL_REGIONS 0 + +// Specifies the alignment for IO Buffers, in bytes. Some low-level network APIs +// may require buffers to have a specific alignment, and this is the place to +// specify that. +#define SB_NETWORK_IO_BUFFER_ALIGNMENT 16 + +// --- Network Configuration ------------------------------------------------- + +// Specifies whether this platform supports IPV6. +#define SB_HAS_IPV6 1 + +// Specifies whether this platform supports pipe. +#define SB_HAS_PIPE 1 + +// --- Timing API ------------------------------------------------------------ + +// Whether this platform has an API to retrieve how long the current thread +// has spent in the executing state. +#define SB_HAS_TIME_THREAD_NOW 1 + +// --- Platform Specific Audits ---------------------------------------------- + +#define SB_HAS_NATIVE_AUDIO 1 +#define GST_HAS_HDR_SUPPORT 1 + +#if !defined(__GNUC__) +#error "Rdk builds need a GCC-like compiler (for the moment)." +#endif + +#define SB_PLATFORM_FRIENDLY_NAME "RDK" +#define SB_PLATFORM_OPERATOR_NAME "Unknown" +#define SB_PLATFORM_MODEL_YEAR 2021 +#define SB_PLATFORM_MODEL_NAME "RDKReference" +#define SB_PLATFORM_FIRMWARE_VERSION_STRING "1.0.0" +#define SB_PLATFORM_CHIPSET_MODEL_NUMBER_STRING "BCM7268" +#define SB_PLATFORM_MANUFACTURER_NAME "Broadcom" + +#endif // THIRD_PARTY_STARBOARD_RDK_BRCM_MIPS_CONFIGURATION_PUBLIC_H_
diff --git a/src/third_party/starboard/rdk/brcm/mips/gyp_configuration.gypi b/src/third_party/starboard/rdk/brcm/mips/gyp_configuration.gypi new file mode 100644 index 0000000..44b8c32 --- /dev/null +++ b/src/third_party/starboard/rdk/brcm/mips/gyp_configuration.gypi
@@ -0,0 +1,216 @@ +# Copyright 2020 Comcast Cable Communications Management, LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright 2016 The Cobalt Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +{ + 'includes': [ + '<(DEPTH)/starboard/sabi/sabi.gypi', + '../../shared/libraries.gypi', + 'architecture.gypi', + ], + 'variables': { + 'target_arch': 'mipsel', + 'target_os': 'linux', + + 'sysroot%': '/', + 'gl_type': 'system_gles2', + 'has_ocdm%': '0', + + # This is to create cobalt shared library + 'final_executable_type': 'shared_library', + + 'platform_libraries': [ + '<@(common_libs)', + ], + + 'linker_flags_host': [ '-pthread' ], + + # Define platform specific compiler and linker flags. + # Refer to base.gypi for a list of all available variables. + 'compiler_flags_host': [ + '-O2', + ], + 'compiler_flags': [ + '-fvisibility=hidden', + # Force char to be signed. + '-fsigned-char', + # Disable strict aliasing. + '-fno-strict-aliasing', + + '-fno-delete-null-pointer-checks', + + # To support large files + '-D_FILE_OFFSET_BITS=64', + + # Suppress some warnings that will be hard to fix. + '-Wno-unused-local-typedefs', + '-Wno-unused-result', + '-Wno-unused-function', + '-Wno-deprecated-declarations', + '-Wno-missing-field-initializers', + '-Wno-extra', + '-Wno-comment', # Talk to my lawyer. + '-Wno-narrowing', + '-Wno-unknown-pragmas', + '-Wno-type-limits', # TODO: We should actually look into these. + # It's OK not to use some input parameters. Note that the order + # matters: Wall implies Wunused-parameter and Wno-unused-parameter + # has no effect if specified before Wall. + '-Wno-unused-parameter', + '-Wno-expansion-to-defined', + '-Wno-implicit-fallthrough', + + # Specify the sysroot with all your include dependencies. + '--sysroot=<(sysroot)', + ], + 'linker_flags': [ + '<@(common_linker_flags)', + '--sysroot=<(sysroot)', + # Cleanup unused sections + '-Wl,-gc-sections', + # We don't wrap these symbols, but this ensures that they aren't + # linked in. + # '-Wl,--wrap=malloc', + '-Wl,--wrap=calloc', + # '-Wl,--wrap=realloc', + # '-Wl,--wrap=memalign', + '-Wl,--wrap=reallocalign', + # '-Wl,--wrap=free', + '-Wl,--wrap=strdup', + '-Wl,--wrap=malloc_usable_size', + '-Wl,--wrap=malloc_stats_fast', + '-Wl,--wrap=__cxa_demangle', + ], + 'compiler_flags_debug': [ + '-O0', + ], + 'compiler_flags_cc_debug': [ + '-frtti', + ], + 'compiler_flags_devel': [ + '-O2', + ], + 'compiler_flags_cc_devel': [ + '-frtti', + ], + 'compiler_flags_qa': [ + '-Wno-unused-but-set-variable', + ], + 'compiler_flags_qa_size': [ + '-Os', + ], + 'compiler_flags_qa_speed': [ + '-O2', + ], + 'compiler_flags_cc_qa': [ + '-frtti', + '-fno-exceptions', + ], + 'compiler_flags_gold': [ + '-Wno-unused-but-set-variable', + ], + 'compiler_flags_gold_size': [ + '-Os', + ], + 'compiler_flags_gold_speed': [ + '-O2', + ], + 'compiler_flags_cc_gold': [ + '-frtti', + '-fno-exceptions', + ], + 'conditions': [ + ['cobalt_fastbuild==0', { + 'compiler_flags_debug': [ + # '-g', + ], + 'compiler_flags_devel': [ + # '-g', + ], + 'compiler_flags_qa': [ + '-g1', + ], + 'compiler_flags_gold': [ + '-g1', + ], + }], + ], + }, + + 'target_defaults': { + 'defines': [ + # Cobalt on Linux flag + 'COBALT_LINUX', + '__STDC_FORMAT_MACROS', # so that we get PRI* + # Enable GNU extensions to get prototypes like ffsl. + '_GNU_SOURCE=1', + ], + 'cflags_c': [ + '-std=c11', + ], + 'cflags_cc': [ + '-Wno-literal-suffix', + '-Wno-deprecated-copy', + '-Wno-invalid-offsetof', + '-Wno-ignored-qualifiers', + '-Wno-pessimizing-move', + ], + 'default_configuration': 'rdk-brcm-mips', + 'configurations': { + 'rdk-brcm-mips_debug': { + 'inherit_from': ['debug_base'], + }, + 'rdk-brcm-mips_devel': { + 'inherit_from': ['devel_base'], + }, + 'rdk-brcm-mips_qa': { + 'inherit_from': ['qa_base'], + }, + 'rdk-brcm-mips_gold': { + 'inherit_from': ['gold_base'], + }, + }, # end of configurations + 'target_conditions': [ + ['sb_pedantic_warnings==1', { + 'cflags': [ + '-Wall', + '-Wextra', + '-Wunreachable-code', + '-Wno-maybe-uninitialized', + # Turn warnings into errors. + # '-Werror', + ], + },{ + 'cflags': [ + # Do not warn for implicit type conversions that may change a value. + '-Wno-conversion', + ], + }], + ], + }, # end of target_defaults +}
diff --git a/src/third_party/starboard/rdk/brcm/mips/gyp_configuration.py b/src/third_party/starboard/rdk/brcm/mips/gyp_configuration.py new file mode 100644 index 0000000..1b75b7f --- /dev/null +++ b/src/third_party/starboard/rdk/brcm/mips/gyp_configuration.py
@@ -0,0 +1,138 @@ +# Copyright 2020 Comcast Cable Communications Management, LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright 2017 The Cobalt Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Starboard RDK Linux platform configuration.""" + +import os + +from starboard.build import platform_configuration +from starboard.tools import build +from starboard.tools.toolchain import ar +from starboard.tools.toolchain import bash +from starboard.tools.toolchain import clang +from starboard.tools.toolchain import clangxx +from starboard.tools.toolchain import cp +from starboard.tools.toolchain import touch + +class RDKPlatformConfig(platform_configuration.PlatformConfiguration): + """Starboard RDK Linux platform configuration.""" + + def __init__(self, platform): + super(RDKPlatformConfig, self).__init__(platform) + + self.has_ocdm = os.environ.get('COBALT_HAS_OCDM', '0') + self.sabi_json_path = 'third_party/starboard/rdk/brcm/mips/sabi/sabi-v12.json' + self.sysroot = os.path.realpath(os.environ.get('PKG_CONFIG_SYSROOT_DIR', '/')) + self.AppendApplicationConfigurationPath(os.path.dirname(__file__)) + self.AppendApplicationConfigurationPath(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "shared"))) + + def GetBuildFormat(self): + """Returns the desired build format.""" + # The comma means that ninja and qtcreator_ninja will be chained and use the + # same input information so that .gyp files will only have to be parsed + # once. + return 'ninja,qtcreator_ninja' + + def GetVariables(self, configuration): + variables = super(RDKPlatformConfig, self).GetVariables(configuration) + variables.update({ + 'clang': 0, + 'sysroot': self.sysroot, + 'has_ocdm': self.has_ocdm, + 'cobalt_v8_enable_embedded_builtins': 0, + }) + variables.update({ + 'cobalt_font_package': 'limited', + 'javascript_engine': 'v8', + }) + return variables + + def GetEnvironmentVariables(self): + env_variables = {} + env_variables.update({ + 'CC': os.environ['CC'], + 'CXX': os.environ['CXX'], + 'LD': os.environ['CXX'], + 'CC_host': 'gcc -m32', + 'CXX_host': 'g++ -m32', + }) + return env_variables + + def GetLauncherPath(self): + """Gets the path to the launcher module for this platform.""" + return os.path.dirname(__file__) + + def GetGeneratorVariables(self, config_name): + del config_name + generator_variables = { + 'qtcreator_session_name_prefix': 'cobalt', + } + return generator_variables + + def GetPathToSabiJsonFile(self): + return self.sabi_json_path + + def GetTargetToolchain(self, **kwargs): + environment_variables = self.GetEnvironmentVariables() + cc_path = environment_variables['CC'] + cxx_path = environment_variables['CXX'] + + return [ + clang.CCompiler(path=cc_path), + clang.CxxCompiler(path=cxx_path), + clang.AssemblerWithCPreprocessor(path=cc_path), + ar.StaticThinLinker(), + ar.StaticLinker(), + clangxx.ExecutableLinker(path=cxx_path, write_group=True), + clangxx.SharedLibraryLinker(path=cxx_path), + cp.Copy(), + touch.Stamp(), + bash.Shell(), + ] + + def GetHostToolchain(self, **kwargs): + environment_variables = self.GetEnvironmentVariables() + cc_path = environment_variables['CC_host'] + cxx_path = environment_variables['CXX_host'] + + return [ + clang.CCompiler(path=cc_path), + clang.CxxCompiler(path=cxx_path), + clang.AssemblerWithCPreprocessor(path=cc_path), + ar.StaticThinLinker(), + ar.StaticLinker(), + clangxx.ExecutableLinker(path=cxx_path, write_group=True), + clangxx.SharedLibraryLinker(path=cxx_path), + cp.Copy(), + touch.Stamp(), + bash.Shell(), + ] + +def CreatePlatformConfig(): + return RDKPlatformConfig('rdk-brcm-mips')
diff --git a/src/third_party/starboard/rdk/brcm/mips/sabi/sabi-v12.json b/src/third_party/starboard/rdk/brcm/mips/sabi/sabi-v12.json new file mode 100644 index 0000000..97fa174 --- /dev/null +++ b/src/third_party/starboard/rdk/brcm/mips/sabi/sabi-v12.json
@@ -0,0 +1,31 @@ +{ + "variables": { + "sb_api_version": 12, + "target_arch": "mipsel", + "mips_arch_variant": "r1", + "mips_fpu_mode": "fp32", + "mips_use_msa": 0, + "word_size": 32, + "endianness": "little", + "signedness_of_char": "signed", + "signedness_of_enum": "signed", + "alignment_char": 1, + "alignment_double": 8, + "alignment_float": 4, + "alignment_int": 4, + "alignment_llong": 8, + "alignment_long": 4, + "alignment_pointer": 4, + "alignment_short": 2, + "size_of_char": 1, + "size_of_double": 8, + "size_of_enum": 4, + "size_of_float": 4, + "size_of_int": 4, + "size_of_llong": 8, + "size_of_long": 4, + "size_of_pointer": 4, + "size_of_short": 2 + } +} +
diff --git a/src/third_party/starboard/rdk/brcm/mips/starboard_platform.gyp b/src/third_party/starboard/rdk/brcm/mips/starboard_platform.gyp new file mode 100644 index 0000000..b53a527 --- /dev/null +++ b/src/third_party/starboard/rdk/brcm/mips/starboard_platform.gyp
@@ -0,0 +1,90 @@ +# Copyright 2020 Comcast Cable Communications Management, LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +#* you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright 2016 The Cobalt Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +{ + 'includes': [ + '../../shared/sources.gypi' + ], + 'variables': { + 'sb_pedantic_warnings': 1, + }, + 'targets': [ + { + 'target_name': 'starboard_base_symbolize', + 'type': 'static_library', + 'sources': [ + '<(DEPTH)/base/third_party/symbolize/demangle.cc', + '<(DEPTH)/base/third_party/symbolize/symbolize.cc', + ], + 'cflags': [ + # TODO: examine/upgrade code to see if these can be removed. + # Prelimenary investigation suggests that a rebase of the library + # will get rid of some or all of the warnings. + '-Wno-sign-compare', + '-Wno-unused-parameter', + ], + }, + { + 'target_name': 'starboard_platform', + 'type': 'static_library', + 'sources': [ + '<@(sources)', + '<(DEPTH)/starboard/raspi/shared/system_gles2.cc', + '<(DEPTH)/third_party/starboard/rdk/brcm/mips/configuration_constants.cc', + '<(DEPTH)/starboard/shared/starboard/media/media_get_audio_output_count_single_audio_output.cc', + '<(DEPTH)/starboard/shared/starboard/media/media_get_audio_configuration_5_1.cc', + 'atomic_public.h', + 'thread_types_public.h', + ], + 'sources!': [ + '<(DEPTH)/starboard/shared/gles/system_gles2.cc', + ], + 'cflags': [ + '-Wno-reorder', + '-Wno-sign-compare', + # Generated by many starboard implementation files. + '-Wno-unused-parameter', + '-Wno-unused-variable', + ], + 'defines': [ + # This must be defined when building Starboard, and must not when + # building Starboard client code. + 'STARBOARD_IMPLEMENTATION', + '<@(common_defines)' + ], + 'dependencies': [ + '<(DEPTH)/starboard/common/common.gyp:common', +# '<(DEPTH)/third_party/dlmalloc/dlmalloc.gyp:dlmalloc', + '<(DEPTH)/third_party/libevent/libevent.gyp:libevent', + '<@(dependencies)', + 'starboard_base_symbolize', + ], + }, + ], +}
diff --git a/src/third_party/starboard/rdk/brcm/mips/thread_types_public.h b/src/third_party/starboard/rdk/brcm/mips/thread_types_public.h new file mode 100644 index 0000000..66fc21c --- /dev/null +++ b/src/third_party/starboard/rdk/brcm/mips/thread_types_public.h
@@ -0,0 +1,39 @@ +// +// Copyright 2020 Comcast Cable Communications Management, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright 2016 The Cobalt Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Includes threading primitive types and initializers. + +#ifndef THIRD_PARTY_STARBOARD_RDK_MIPS_THREAD_TYPES_PUBLIC_H_ +#define THIRD_PARTY_STARBOARD_RDK_MIPS_THREAD_TYPES_PUBLIC_H_ + +#include "starboard/shared/pthread/types_public.h" + +#endif // THIRD_PARTY_STARBOARD_RDK_MIPS_THREAD_TYPES_PUBLIC_H_