Import of the watch repository from Pebble

This commit is contained in:
Matthieu Jeanson 2024-12-12 16:43:03 -08:00 committed by Katharine Berry
commit 3b92768480
10334 changed files with 2564465 additions and 0 deletions

View file

@ -0,0 +1,80 @@
# Tintin Native SDK Generator
This script exports white-listed functions, `typedef`s and `#define`s in tintin source tree so that they can be used by native-watch apps.
>
> ### Note:
>
> It is *not* possible to add additional publicly exposed functions to
> an already released firmware/SDK combination.
>
> This is because the generated `src/fw/pebble.auto.c` file needs
> to have been compiled into the firmware with which the SDK will be
> used.
>
> If you just expose a new function in `exported_symbols.json`,
> generate a new SDK and compile an app that uses the new function
> then the watch will crash when that code is executed on a firmware
> without that function exposed.
>
> You will need to generate and release a new firmware alongside the
> new SDK build that has the newly exposed function.
>
The script generates 3 files required to build native watchapps:
+ `sdk/include/pebble.h` -- Header file containing the typedefs, defines and function prototypes for normal apps
+ `sdk/include/pebble_worker.h` -- Header file containing the typedefs, defines and function prototypes for workers
+ `sdk/lib/pebble.a` -- Static library containing trampolines to call the exported functions in Flash.
+ `src/fw/pebble.auto.c` -- C file containing `g_pbl_system_table`, a table of function pointers used by the trampolines to find an exported function's address in Flash.
## Running the generator
The running of the generator has now been integrated into the build, so there is no need to run it separately.
If for whatever reason, you need to run the generator by hand, run `% tools/generate_native_sdk/generate_pebble_native_sdk_files.py --help`, and it's simple enough to follow.
## Configuration
The symbols exported by the SDK generator are defined in the `exported_symbols.json` config file.
The format of the config file is as follows:
[
{
"revision" : "<exported symbols revision number>",
"version" : "x.x",
"files" : [
<Files to parse/search>
],
"exports" : [
<Symbols to export>
]
}
]
Each exported symbol in the `exports` table is formatted as follows:
{
"type" : "<Export type",
"name" : "<Symbol name>",
"sortName" : "<sort order>",
"addedRevision" : "<Revision number>"
}
`Export type` type can be any of `function`, `define`, `type`, or `group`. A `group` type has the following structure:
{
"type : "group",
"name" : "<Group Name>",
"exports" : [
<Symbols to export>
]
}
*NB:* The generator sorts the order of the `functions` in order of addedRevision, and then alphabetically within a revision using sortName (if specified) or name. The `types` fields are left in the order in which they are entered in the types table. As well, Be sure to specify any typedefs with dependencies on other typedefs after their dependencies in the `types` list.
### Important!
When adding new functions, make sure to bump up the `revision` field, and use that value as the new functions' `addedRevision` field. This guarantees that new versions of TintinOS are backwards compatible when compiled against older `libpebble.a`. Seriously, ***make sure to do this***!!.
## Bugs
+ The script doesn't check the the resulting `pebble.h` file will compile, that is left as an exercise to the reader.
+ The script's error reporting is a little funky/unfriendly in places
+ The script does not do any checking of the function revision numbers, beyond a simple check that the file's revision is not lower than any function's.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,151 @@
# Copyright 2024 Google 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.
import json
import logging
import os
INTERNAL_REVISION = 999
class Export(object):
def __init__(self, v, app_only, worker_only, deprecated):
self.name = v['name']
self.type = v['type']
self.comment = None
self.app_only = v.get('appOnly', app_only)
self.worker_only = v.get('workerOnly', worker_only)
self.include_after = v.get('includeAfter', [])
self.deprecated = deprecated or v.get('deprecated', False)
def complete(self):
return True
class FullExport(Export):
def __init__(self, v, app_only, worker_only, deprecated):
super(FullExport, self).__init__(v, app_only, worker_only, deprecated)
self.full_definition = None
def complete(self):
return self.full_definition is not None
class FunctionExport(FullExport):
def __init__(self, v, app_only, worker_only, deprecated):
super(FunctionExport, self).__init__(v, app_only, worker_only, deprecated)
self.removed = False
self.skip_definition = v.get('skipDefinition', False)
self.added_revision = int(v['addedRevision'])
self.sort_name = v.get('sortName', self.name)
if v.get('removed', False):
self.removed = True
else:
self.impl_name = v.get('implName', self.name)
def complete(self):
if self.removed or self.skip_definition:
return True
return super(FunctionExport, self).complete()
class Group(object):
def __init__(self, export, parent_group, app_only, worker_only, current_revision, deprecated):
self.name = export['name']
self.parent_group = parent_group
self.app_only = export.get('appOnly', app_only)
self.worker_only = export.get('workerOnly', worker_only)
self.deprecated = export.get('deprecated', False) or deprecated
self.exports = parse_exports_list(export['exports'], current_revision, self, self.app_only,
self.worker_only, self.deprecated)
self.comment = None
self.display_name = None
def group_stack(self):
stack = [self.name,]
parent_iter = self.parent_group
while parent_iter is not None:
stack.insert(0, parent_iter.name)
parent_iter = parent_iter.parent_group
return stack
def qualified_name(self):
return self.group_stack.join('_')
def parse_exports_list(export_definition_list, current_revision, parent_group=None, app_only=False,
worker_only=False, deprecated=False):
exports = []
for e in export_definition_list:
# Functions marked internal must be assigned a revision number to be sorted later
if e.get('internal', False):
if 'addedRevision' in e:
raise Exception('Internal symbol %s should not have an addedRevision property'
% e['name'])
else:
e['addedRevision'] = INTERNAL_REVISION
if 'addedRevision' in e:
added_revision = int(e['addedRevision'])
if added_revision > current_revision:
logging.warn("Omitting '%s' from SDK export because its revision "
"(%u) is higher than the current revision (%u)" %
(e['name'], added_revision, current_revision))
continue
if e['type'] == 'group':
exports.append(Group(e, parent_group, app_only, worker_only, current_revision,
deprecated))
elif e['type'] == 'forward_struct':
exports.append(Export(e, app_only, worker_only, deprecated))
elif e['type'] == 'function':
exports.append(FunctionExport(e, app_only, worker_only, deprecated))
elif e['type'] == 'type' or e['type'] == 'define':
exports.append(FullExport(e, app_only, worker_only, deprecated))
else:
raise Exception('Unknown type "%s" in export "%s"' % (e['type'], e['name']))
return exports
def parse_export_file(filename, internal_sdk_build):
with open(filename, 'r') as f:
shim_defs = json.load(f)
file_revision = int(shim_defs['revision'])
if file_revision >= INTERNAL_REVISION - 12:
raise Exception('File revision at %d is approaching INTERNAL_REVISION at %d' %
(file_revision, INTERNAL_REVISION))
current_revision = INTERNAL_REVISION if internal_sdk_build else file_revision
exports = parse_exports_list(shim_defs['exports'], current_revision)
return shim_defs['files'], exports
def walk_tree(exports_tree, func, include_groups = False):
""" Call func on every Export in our tree """
for e in exports_tree:
if isinstance(e, Group):
if include_groups:
func(e)
walk_tree(e.exports, func, include_groups)
else:
func(e)

View file

@ -0,0 +1,128 @@
# Copyright 2024 Google 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.
import re
import sys
block_comment_re = re.compile(r"""(^//!.*$(\n)?)+""", flags=re.MULTILINE)
addtogroup_start_re = re.compile(r"""//!\s+@addtogroup\s+(?P<name>\S+)(\s+(?P<display_name>.+))?$""")
block_start_re = re.compile(r"""//!\s+@{""")
block_end_re = re.compile(r"""//!\s+@}""")
define_block_comment_re = re.compile(r"""(?P<block_comment>(^//!.*$(\n)?)+)#define\s+(?P<define_name>[A-Za-z0-9_]+)""", flags=re.MULTILINE)
def find_group(group_stack, groups):
for g in groups:
if g.group_stack() == group_stack:
return g
return None
def add_group_comment(group_comment, group_stack, groups):
for g in groups:
if g.group_stack() == group_stack:
g.comment = group_comment.strip()
break
def scan_file_content_for_groups(content, groups):
group_stack = []
in_group_description = False
group_comment = ''
for match in block_comment_re.finditer(content):
comment_block = match.group(0).strip()
for line in comment_block.splitlines():
result = addtogroup_start_re.search(line)
if result is not None:
group_stack.append(result.group('name'))
if result.group('display_name') is not None:
g = find_group(group_stack, groups)
if g is not None:
g.display_name = result.group('display_name')
in_group_description = True
elif block_start_re.search(line) is not None:
in_group_description = False
group_comment.strip()
if len(group_comment) > 0:
g = find_group(group_stack, groups)
if g is not None:
g.comment = group_comment.strip()
group_comment = ''
elif block_end_re.search(line) is not None:
if len(group_stack) == 0:
raise Exception("Unbalanced groups!")
group_stack.pop()
elif in_group_description:
group_comment += line + '\n'
if len(group_stack) != 0:
raise Exception("Unbalanced groups!")
def scan_file_content_for_defines(content, defines):
for match in define_block_comment_re.finditer(content):
for d in defines:
if d.name == match.group('define_name'):
d.comment = match.group('block_comment').strip()
break
def parse_file(filename, groups, defines):
with open(filename) as f:
content = f.read()
scan_file_content_for_groups(content, groups)
scan_file_content_for_defines(content, defines)
def extract_comments(filenames, groups, defines):
for f in filenames:
parse_file(f, groups, defines)
def test_handle_macro():
test_input = """
//! This is a documented MACRO
#define FOO(x) BAR(x);
//! This is a documented define
#define BRAD "awesome"
//! This is a multiline
//! documented define.
#define TEST "nosetests"
"""
class TestDefine(object):
def __init__(self, name):
self.name = name
self.comment = None
defines = [ TestDefine("FOO"), TestDefine("BRAD"), TestDefine("TEST"), TestDefine("Other") ]
scan_file_content_for_defines(test_input, defines)
from nose.tools import eq_
eq_(defines[0].comment, "//! This is a documented MACRO")
eq_(defines[1].comment, "//! This is a documented define")
eq_(defines[2].comment, "//! This is a multiline\n//! documented define.")
assert defines[3].comment is None
if __name__ == '__main__':
parse_file(sys.argv[1], [], [])

View file

@ -0,0 +1,97 @@
# Copyright 2024 Google 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.
import functools
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../'))
import parse_c_decl
from parse_c_decl import clang
def extract_exported_functions(node, functions=[], types=[], defines=[]):
def update_matching_export(exports, node):
spelling = parse_c_decl.get_node_spelling(node)
for e in exports:
impl_name = e.impl_name if hasattr(e, 'impl_name') else ""
definition_name = impl_name if impl_name else e.name
if spelling == definition_name:
# Found a matching node! Before we update our export make sure this attribute is larger
# than the one we may already have. This is to handle the case where we have typedef and
# a struct as part of the same definition, we want to make sure we get the outer typedef.
definition = parse_c_decl.get_string_from_file(node.extent)
if e.full_definition is None or len(definition) > len(e.full_definition):
if node.kind == clang.cindex.CursorKind.MACRO_DEFINITION:
e.full_definition = "#define " + definition
else:
e.full_definition = definition
# Update the exports with comments / definition info from both the
# 'implName' and 'name'. Keep whatever is longer and does not start
# with @internal (meaning the whole docstring is internal).
if spelling == e.name or (impl_name and spelling == impl_name):
comment = parse_c_decl.get_comment_string_for_decl(node)
if comment is not None and not comment.startswith("//! @internal"):
if e.comment is None or len(comment) > len(e.comment):
e.comment = comment
return None
if node.kind == clang.cindex.CursorKind.FUNCTION_DECL:
update_matching_export(functions, node)
elif node.kind == clang.cindex.CursorKind.STRUCT_DECL or \
node.kind == clang.cindex.CursorKind.ENUM_DECL or \
node.kind == clang.cindex.CursorKind.TYPEDEF_DECL:
update_matching_export(types, node)
elif node.kind == clang.cindex.CursorKind.MACRO_DEFINITION:
update_matching_export(defines, node)
def extract_symbol_info(filenames, functions, types, defines, output_dir, internal_sdk_build=False,
compiler_flags=None):
# Parse all the headers at the same time since that is much faster than
# parsing each one individually
all_headers_file = os.path.join(output_dir, "all_sdk_headers.h")
with open(all_headers_file, 'w') as outfile:
for f in filenames:
outfile.write('#include "%s"\n' % f)
parse_c_decl.parse_file(all_headers_file, filenames,
functools.partial(extract_exported_functions,
functions=functions,
types=types,
defines=defines),
internal_sdk_build=internal_sdk_build,
compiler_flags=compiler_flags)
if __name__ == '__main__':
parse_c_decl.dump_tree = True
class Export(object):
def __init__(self, name):
self.name = name
self.full_definition = None
self.comment = None
#clang.cindex.Config.library_file = "/home/brad/src/llvmbuild/Debug+Asserts/lib/libclang.so"
extract_symbol_info((sys.argv[1],), [], [], [])

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,47 @@
/*
* Copyright 2024 Google 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.
*/
#ifndef _FAKE_DEFINES_H
#define _FAKE_DEFINES_H
#define NULL 0
#define BUFSIZ 1024
#define FOPEN_MAX 20
#define FILENAME_MAX 1024
#ifndef SEEK_SET
#define SEEK_SET 0 /* set file offset to offset */
#endif
#ifndef SEEK_CUR
#define SEEK_CUR 1 /* set file offset to current plus offset */
#endif
#ifndef SEEK_END
#define SEEK_END 2 /* set file offset to EOF plus offset */
#endif
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#define RAND_MAX 32767
#define INT_MAX 32767
/* C99 stdbool.h defines */
#define __bool_true_false_are_defined 1
#define false 0
#define true 1
#endif

View file

@ -0,0 +1,129 @@
/*
* Copyright 2024 Google 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.
*/
#ifndef _FAKE_TYPEDEFS_H
#define _FAKE_TYPEDEFS_H
typedef int size_t;
typedef int __builtin_va_list;
typedef int __gnuc_va_list;
typedef int __int8_t;
typedef int __uint8_t;
typedef int __int16_t;
typedef int __uint16_t;
typedef int __int_least16_t;
typedef int __uint_least16_t;
typedef int __int32_t;
typedef int __uint32_t;
typedef int __int_least32_t;
typedef int __uint_least32_t;
typedef int _LOCK_T;
typedef int _LOCK_RECURSIVE_T;
typedef int _off_t;
typedef int __dev_t;
typedef int __uid_t;
typedef int __gid_t;
typedef int _off64_t;
typedef int _fpos_t;
typedef int _ssize_t;
typedef int wint_t;
typedef int _mbstate_t;
typedef int _flock_t;
typedef int _iconv_t;
typedef int __ULong;
typedef int __FILE;
typedef int ptrdiff_t;
typedef int wchar_t;
typedef int __off_t;
typedef int __pid_t;
typedef int __loff_t;
typedef int u_char;
typedef int u_short;
typedef int u_int;
typedef int u_long;
typedef int ushort;
typedef int uint;
typedef int clock_t;
typedef int time_t;
typedef int daddr_t;
typedef int caddr_t;
typedef int ino_t;
typedef int off_t;
typedef int dev_t;
typedef int uid_t;
typedef int gid_t;
typedef int pid_t;
typedef int key_t;
typedef int ssize_t;
typedef int mode_t;
typedef int nlink_t;
typedef int fd_mask;
typedef int _types_fd_set;
typedef int clockid_t;
typedef int timer_t;
typedef int useconds_t;
typedef int suseconds_t;
typedef int FILE;
typedef int fpos_t;
typedef int cookie_read_function_t;
typedef int cookie_write_function_t;
typedef int cookie_seek_function_t;
typedef int cookie_close_function_t;
typedef int cookie_io_functions_t;
typedef int div_t;
typedef int ldiv_t;
typedef int lldiv_t;
typedef int sigset_t;
typedef int _sig_func_ptr;
typedef int sig_atomic_t;
typedef int __tzrule_type;
typedef int __tzinfo_type;
typedef int mbstate_t;
typedef int sem_t;
typedef int pthread_t;
typedef int pthread_attr_t;
typedef int pthread_mutex_t;
typedef int pthread_mutexattr_t;
typedef int pthread_cond_t;
typedef int pthread_condattr_t;
typedef int pthread_key_t;
typedef int pthread_once_t;
typedef int pthread_rwlock_t;
typedef int pthread_rwlockattr_t;
typedef int pthread_spinlock_t;
typedef int pthread_barrier_t;
typedef int pthread_barrierattr_t;
/* C99 integer types */
typedef int int8_t;
typedef int uint8_t;
typedef int int16_t;
typedef int uint16_t;
typedef int int32_t;
typedef int uint32_t;
typedef int int64_t;
typedef int uint64_t;
/* C99 stdbool.h bool type. _Bool is built-in in C99 */
typedef _Bool bool;
typedef int va_list;
/* pointer types -> these are optional in sdk implementations, but tintin seems to have them */
typedef int intptr_t;
typedef int uintptr_t;
#endif

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,18 @@
/*
* Copyright 2024 Google 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.
*/
#include "_fake_defines.h"
#include "_fake_typedefs.h"

View file

@ -0,0 +1,175 @@
# Copyright 2024 Google 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.
import exports
import os
def writeline(f, line=''):
f.write(line + '\n')
def strip_internal_comments(comment_string):
""" Takes a multiline comment string and strips out the parts of the comment after an @internal keyword"""
result = []
for line in comment_string.splitlines():
if '@internal' in line:
# Skip the rest
break
result.append(line)
return '\n'.join(result)
def strip_internal_subcomments(string):
""" Takes a multiline comment string and strips out the parts of the comment after an @internal keyword"""
result = []
in_internal_comment = False
for line in string.splitlines():
if '@internal' in line and line.lstrip().startswith("//!"):
in_internal_comment = True
elif in_internal_comment:
if not line.lstrip().startswith("//!"):
in_internal_comment = False
result.append(line)
else:
result.append(line)
return '\n'.join(result)
def rename_full_definition(e):
if hasattr(e, 'impl_name'):
return e.full_definition.replace(e.impl_name, e.name, 1)
else:
return e.full_definition
def make_app_header(exports_tree, output_filename, header_type, inject_text):
output_filename_dir = os.path.dirname(output_filename)
if not os.path.exists(output_filename_dir):
os.makedirs(output_filename_dir)
""" header_type can be either "app", "worker" or "both" """
with open(output_filename, 'w') as f:
writeline(f, '#pragma once')
writeline(f)
if inject_text is not None:
f.write(inject_text)
writeline(f)
writeline(f, '#include <locale.h>')
writeline(f, '#include <stdlib.h>')
writeline(f, '#include <stdint.h>')
writeline(f, '#include <stdio.h>')
writeline(f, '#include <stdbool.h>')
writeline(f, '#include <string.h>')
writeline(f, '#include <time.h>')
writeline(f)
writeline(f, '#include "pebble_warn_unsupported_functions.h"')
if header_type == 'app':
writeline(f, '#include "pebble_sdk_version.h"')
else:
writeline(f, '#include "pebble_worker_sdk_version.h"')
writeline(f)
writeline(f, '#ifndef __FILE_NAME__')
writeline(f, '#define __FILE_NAME__ __FILE__')
writeline(f, '#endif')
writeline(f)
def format_export(e):
skip = (header_type == 'app' and e.worker_only) or \
(header_type == 'worker' and e.app_only) or \
(header_type == 'worker_only' and not e.worker_only) or \
e.deprecated
if isinstance(e, exports.Group):
if not skip:
line = '//! @addtogroup %s' % e.name
if e.display_name is not None:
line += ' %s' % e.display_name
writeline(f, line)
if e.comment is not None:
writeline(f, strip_internal_comments(e.comment))
writeline(f, '//! @{')
writeline(f)
format_export_list(e.exports)
if not skip:
writeline(f, '//! @} // group %s' % e.name)
writeline(f)
return
elif e.type == 'forward_struct':
if skip:
return
writeline(f, 'struct ' + e.name + ';')
writeline(f, 'typedef struct ' + e.name + ' ' + e.name + ';')
writeline(f)
elif e.type == 'function':
if skip:
return
if not e.removed and not e.skip_definition and not e.deprecated:
if e.comment is not None:
writeline(f, strip_internal_comments(e.comment))
writeline(f, rename_full_definition(e).strip() + ';')
writeline(f)
elif e.type == 'define':
if skip:
return
if e.comment is not None:
writeline(f, strip_internal_comments(e.comment))
writeline(f, e.full_definition)
writeline(f)
elif e.type == 'type':
if skip:
return
if e.comment is not None:
writeline(f, strip_internal_comments(e.comment))
writeline(f, strip_internal_subcomments(e.full_definition + ';'))
writeline(f)
else:
raise Exception("Unknown type: %s", e.type)
if not skip and e.include_after:
for header in e.include_after:
writeline(f, '#include "{}"'.format(header))
writeline(f, "") # space out these headers nicely.
def format_export_list(export_list):
for e in export_list:
format_export(e)
format_export_list(exports_tree)
import unittest
class TestStripInternalComments(unittest.TestCase):
def test_non_internal(self):
comment = "//! This is a comment\n//! It looks normal"
self.assertEqual(strip_internal_comments(comment), comment) # unchanged
def test_internal_line(self):
comment = "//! This is a comment\n//! @internal This is internal"
self.assertEqual(strip_internal_comments(comment), "//! This is a comment")
def test_internal_block(self):
comment = "//! This is a comment\n//! @internal This is internal//! More internal"
self.assertEqual(strip_internal_comments(comment), "//! This is a comment")
def test_all_internal(self):
comment = "//! @internal This is internal\n//! More internal"
self.assertEqual(strip_internal_comments(comment), "")
def test_trailing_newline_non_internal(self):
comment = "//! This is a comment\n//! It looks normal\n"
self.assertEqual(strip_internal_comments(comment), "//! This is a comment\n//! It looks normal")
def test_trailing_newline_internal_block(self):
comment = "//! This is a comment\n//! @internal This is internal//! More internal"
self.assertEqual(strip_internal_comments(comment), "//! This is a comment")
if __name__ == '__main__':
unittest.main()

View file

@ -0,0 +1,55 @@
# Copyright 2024 Google 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.
DEFINE_PREFIX = '_PBL_API_EXISTS_'
MACRO_NAME = 'PBL_API_EXISTS'
def generate_app_sdk_version_header(out_file_path, functions):
with open(out_file_path, 'w') as out_file:
out_file.write("""//! @file pebble_sdk_version.h
//! This file implements the {} macro for checking the presence of a given
//! API. This allows developers to target multiple SDKs using the same codebase by only
//! compiling code on SDKs that support the functions they're attempting to use.\n"""
.format(MACRO_NAME))
out_file.write('\n')
for func in functions:
if not func.removed and not func.skip_definition and not func.deprecated:
out_file.write('#define {}{}\n'.format(DEFINE_PREFIX, func.name))
out_file.write('\n')
out_file.write('//! @addtogroup Misc\n')
out_file.write('//! @{\n')
out_file.write('\n')
out_file.write('//! @addtogroup Compatibility Compatibility Macros\n')
out_file.write('//! @{\n')
out_file.write('\n')
out_file.write("""//! Evaluates to true if a given function is available in this SDK
//! For example: `#if {0}(app_event_loop)` will evaluate to true because
//! app_event_loop is a valid pebble API function, where
//! `#if {0}(spaceship_event_loop)` will evaluate to false because that function
//! does not exist (yet).
//! Use this to build apps that are valid when built with different SDK versions that support
//! different levels of functionality.
""".format(MACRO_NAME))
out_file.write('#define {}(x) defined({}##x)\n'.format(MACRO_NAME, DEFINE_PREFIX))
out_file.write('\n')
out_file.write('//! @} // end addtogroup Compatibility\n')
out_file.write('\n')
out_file.write('//! @} // end addtogroup Misc\n')

View file

@ -0,0 +1,121 @@
# Copyright 2024 Google 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.
import os.path
import subprocess
import tempfile
SHIM_PREAMBLE = """
.syntax unified
.thumb
"""
# We generate one of these trampolines for each function we export. This is a stub function
# that pretty much just sets us up to call 'jump_to_pbl_function', defined in the SHIM_FOOTER
# string.
SHIM_TEMPLATE = """
.section ".text.%(function_name)s"
.align 2
.thumb_func
.global %(function_name)s
.type %(function_name)s STT_FUNC
%(function_name)s:
push {r0, r1, r2, r3} @ Stack the original parameters. Remember that the caller
@ thinks they're calling a C function, not this shim function.
@ We don't want to touch these.
ldr r1, =%(offset)d @ Load up the index into the jump table array
b jump_to_pbl_function @ See below...
"""
# This section defines the second part of the trampoline function. We only jump to it from
# the functions we define in SHIM_TEMPLATE. The SHIM_TEMPLATE function jumps to us after
# setting up the offset in the jump table in r1.
SHIM_FOOTER = """
.section ".text"
.type jump_to_pbl_function function
jump_to_pbl_function:
adr r3, pbl_table_addr
ldr r0, [r3] @ r0 now holds the base address of the jump table
add r0, r0, r1 @ add the offset to address the function pointer to the exported function
ldr r2, [r0] @ r2 now holds the address of the exported function
mov r12, r2 @ r12 aka intra-procedure scratch register. We're allowed to
@ muck with this and not restore it
pop {r0, r1, r2, r3} @ Restore the original parameters to the exported C function
bx r12 @ And finally jump! Don't use branch and link, we want to
@ return to the original call site, not this shim
@ This pbl_table_addr variable will get compiled into our app binary. As part of our build process
@ the address of this variable will get poked into the PebbleProcessInfo meta data struct. Then, when
@ we load the app from flash we change the value of the variable to point the jump table exported
@ by the OS.
.align
pbl_table_addr:
.long 0xA8A8A8A8
"""
def gen_shim_asm(functions):
output = []
output.append(SHIM_PREAMBLE)
for idx, fun in enumerate(functions):
if not fun.removed:
output.append(SHIM_TEMPLATE % {'function_name': fun.name, 'offset': idx * 4})
output.append(SHIM_FOOTER)
return '\n'.join(output)
class CompilationFailedError(Exception):
pass
def build_shim(shim_s, dest_dir):
shim_a = os.path.join(dest_dir, 'libpebble.a')
# Delete any existing archive, otherwise `ar` will append/insert to it:
if os.path.exists(shim_a):
os.remove(shim_a)
shim_o = tempfile.NamedTemporaryFile(suffix='pebble.o').name
gcc_process = subprocess.Popen(['arm-none-eabi-gcc',
'-mcpu=cortex-m3',
'-mthumb',
'-fPIC',
'-c',
'-o',
shim_o,
shim_s],
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
output = gcc_process.communicate()
if (gcc_process.returncode != 0):
print(output[1])
raise CompilationFailedError()
ar_process = subprocess.Popen(['arm-none-eabi-ar',
'rcs',
shim_a,
shim_o],
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
output = ar_process.communicate()
if (ar_process.returncode != 0):
print(output[1])
raise CompilationFailedError()
def make_app_shim_lib(functions, sdk_lib_dir):
temp_asm_file = tempfile.NamedTemporaryFile(suffix='pbl_shim.s').name
with open(temp_asm_file, 'w') as shim_s:
shim_s.write(gen_shim_asm(functions))
build_shim(temp_asm_file, sdk_lib_dir)

View file

@ -0,0 +1,51 @@
# Copyright 2024 Google 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.
import os.path
FUNCTION_PTR_FILE = 'pebble.auto.c'
def gen_function_pointer_array(functions):
output = []
# Include headers for the standard functions
output.append('#include <stdlib.h>')
output.append('#include <stdio.h>')
output.append('#include <string.h>')
output.append('')
for f in functions:
if not f.removed and (not f.skip_definition or f.impl_name != f.name):
output.append('extern void %s();' % f.impl_name)
output.append('')
output.append('const void* const g_pbl_system_tbl[] = {')
function_ptrs = []
for f in functions:
if not f.removed:
function_ptrs.append('&%s' % f.impl_name)
else:
function_ptrs.append('0')
output.extend( (' %s,' % f for f in function_ptrs) )
output.append('};')
output.append('')
return '\n'.join(output)
def make_fw_shims(functions, pbl_output_src_dir):
with open(os.path.join(pbl_output_src_dir, 'fw', FUNCTION_PTR_FILE), 'w') as fptr_c:
fptr_c.write(gen_function_pointer_array(functions))

View file

@ -0,0 +1,52 @@
# Copyright 2024 Google 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.
import json
import os.path
DESCRIPTION_FILE = 'pebble_api.json'
# TODO: Add SDK version, defines, enums, etc.
# Only contains an ordered list of functions for now.
def gen_json_api_description(functions):
""" Generates a json-serializable `dict` with the API description. """
output = {
"_pebble_api_description": {
"file_version": 1,
}
}
json_functions = []
for f in functions:
json_f = {
"name": f.name,
"deprecated": f.deprecated,
"removed": f.removed,
"addedRevision": f.added_revision,
}
json_functions.append(json_f)
output['functions'] = json_functions
return output
def make_json_api_description(functions, pbl_output_src_dir):
descr_path = os.path.join(pbl_output_src_dir, 'fw', DESCRIPTION_FILE)
with open(descr_path, 'w') as descr_file:
json.dump(gen_json_api_description(functions),
descr_file,
sort_keys=True,
indent=4,
separators=(',', ': '))

View file

@ -0,0 +1,188 @@
#!/usr/bin/env python
# Copyright 2024 Google 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.
from __future__ import with_statement
from __future__ import print_function
import os
import os.path as path
import shutil
import argparse
from generate_app_header import make_app_header
from generate_app_shim import make_app_shim_lib
from generate_fw_shim import make_fw_shims
from generate_json_api_description import make_json_api_description
from generate_app_sdk_version_header import generate_app_sdk_version_header
from extract_symbol_info import extract_symbol_info
from extract_comments import extract_comments
import exports
# When this file is called by waf using `python generate_pebble_native_sdk_files.py ...`, we
# need to append the parent directory to the system PATH because relative imports won't work
try:
from ..pebble_sdk_platform import pebble_platforms, maybe_import_internal
except ValueError:
os.sys.path.append(path.dirname(path.dirname(__file__)))
from pebble_sdk_platform import pebble_platforms, maybe_import_internal
SRC_DIR = 'src'
INCLUDE_DIR = 'include'
LIB_DIR = 'lib'
PEBBLE_APP_H_TEXT = """\
#include "pebble_fonts.h"
#include "message_keys.auto.h"
#include "src/resource_ids.auto.h"
#define PBL_APP_INFO(...) _Pragma("message \\"\\n\\n \\
*** PBL_APP_INFO has been replaced with appinfo.json\\n \\
Try updating your project with `pebble convert-project`\\n \\
Visit our developer guides to learn more about appinfo.json:\\n \\
http://developer.getpebble.com/guides/pebble-apps/\\n \\""); \\
_Pragma("GCC error \\"PBL_APP_INFO has been replaced with appinfo.json\\"");
#define PBL_APP_INFO_SIMPLE PBL_APP_INFO
"""
def generate_shim_files(shim_def_path, pbl_src_dir, pbl_output_src_dir, sdk_include_dir,
sdk_lib_dir, platform_name, internal_sdk_build=False):
if internal_sdk_build:
try:
from .. import pebble_sdk_platform_internal
except ValueError:
os.sys.path.append(path.dirname(path.dirname(__file__)))
import pebble_sdk_platform_internal
try:
platform_info = pebble_platforms.get(platform_name)
except KeyError:
raise Exception("Unsupported platform: %s" % platform_name)
files, exports_tree = exports.parse_export_file(shim_def_path, internal_sdk_build)
files = [ os.path.join(pbl_src_dir, f) for f in files ]
functions = []
exports.walk_tree(exports_tree, lambda e: functions.append(e) if e.type == 'function' else None)
types = []
exports.walk_tree(exports_tree, lambda e: types.append(e) if e.type == 'type' else None)
defines = []
exports.walk_tree(exports_tree, lambda e: defines.append(e) if e.type == 'define' else None)
groups = []
exports.walk_tree(exports_tree, lambda e: groups.append(e) if isinstance(e, exports.Group) else None, include_groups=True)
compiler_flags = ["-D{}".format(d) for d in platform_info["DEFINES"]]
freertos_port_name = "ARM_CM3_PEBBLE" if platform_name == "aplite" else "ARM_CM4_PEBBLE"
compiler_flags.extend(["-I{}/fw/vendor/FreeRTOS/Source/{}".format(pbl_src_dir, p) for p in
["include",
"portable/GCC/{}".format(freertos_port_name)]])
extract_symbol_info(files, functions, types, defines, pbl_output_src_dir,
internal_sdk_build=internal_sdk_build,
compiler_flags=compiler_flags)
extract_comments(files, groups, defines)
# Make sure we found all the exported items
def check_complete(e):
if not e.complete():
raise Exception("""Missing export: %s %s.
Hint: Add appropriate headers to the \"files\" array in exported_symbols.json""" % (e, str(e.__dict__)))
exports.walk_tree(exports_tree, check_complete)
pebble_app_h_text_to_inject = PEBBLE_APP_H_TEXT + \
'\n'.join(platform_info['ADDITIONAL_TEXT_LINES_FOR_PEBBLE_H'])
# Build pebble.h and pebble_worker.h for our apps to include
for type_name_prefix in [('app', 'pebble.h', pebble_app_h_text_to_inject),
('worker', 'pebble_worker.h', None),
('worker_only', 'doxygen/pebble_worker.h', None)]:
sdk_header_filename = path.join(sdk_include_dir, type_name_prefix[1])
make_app_header(exports_tree, sdk_header_filename, type_name_prefix[0], type_name_prefix[2])
def function_export_compare_func(x, y):
if (x.added_revision != y.added_revision):
return cmp(x.added_revision, y.added_revision)
return cmp(x.sort_name, y.sort_name)
sorted_functions = sorted(functions, cmp=function_export_compare_func)
# Build libpebble.a for our apps to compile against
make_app_shim_lib(sorted_functions, sdk_lib_dir)
# Build pebble.auto.c to build into our firmware
make_fw_shims(sorted_functions, pbl_output_src_dir)
# Build .json API description, used as input for static analysis tools:
make_json_api_description(sorted_functions, pbl_output_src_dir)
for filename, functions in (('pebble_sdk_version.h',
(f for f in functions if not f.worker_only)),
('pebble_worker_sdk_version.h',
(f for f in functions if not f.app_only))):
generate_app_sdk_version_header(path.join(sdk_include_dir, filename), functions)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Auto-generate the Pebble native SDK files')
parser.add_argument("--sdk-dir", dest="sdk_dir",
help="root of the SDK dir",
metavar="SDKDIR",
required=True)
parser.add_argument("config")
parser.add_argument("src_dir")
parser.add_argument("output_dir")
parser.add_argument("platform_name")
parser.add_argument("--internal-sdk-build", action="store_true", help="build internal SDK")
options = parser.parse_args()
shim_config = path.normpath(path.abspath(options.config))
pbl_src_dir = path.normpath(path.abspath(options.src_dir))
pbl_output_src_dir = path.normpath(path.abspath(options.output_dir))
sdk_include_dir = path.join(path.abspath(options.sdk_dir), INCLUDE_DIR)
sdk_lib_dir = path.join(path.abspath(options.sdk_dir), LIB_DIR)
if not path.isdir(pbl_src_dir):
raise RuntimeError("'%s' does not exist" % pbl_src_dir)
for d in (sdk_include_dir, sdk_lib_dir):
if not path.isdir(d):
os.makedirs(d)
shutil.copy(path.join(pbl_src_dir, 'fw', 'process_management', 'pebble_process_info.h'),
path.join(sdk_include_dir, 'pebble_process_info.h'))
shutil.copy(path.join(pbl_src_dir, 'fw/applib/graphics', 'gcolor_definitions.h'),
path.join(sdk_include_dir, 'gcolor_definitions.h'))
# Copy unsupported function warnings header to SDK
shutil.copy(path.join(pbl_src_dir, 'fw', 'applib', 'pebble_warn_unsupported_functions.h'),
path.join(sdk_include_dir, 'pebble_warn_unsupported_functions.h'))
generate_shim_files(
shim_config,
pbl_src_dir,
pbl_output_src_dir,
sdk_include_dir,
sdk_lib_dir,
options.platform_name,
internal_sdk_build=options.internal_sdk_build)