"
+}
+```
+
+A `group` nests further `exports` under a `name`. Functions support
+additional flags (`internal`, `removed`, `deprecated`, `appOnly`,
+`workerOnly`, `implName`, `skipDefinition`) — see existing entries and
+`tools/generate_native_sdk/exports.py` for their meaning.
+
+Notes:
+
+- Functions are sorted by `addedRevision`, then alphabetically (by `sortName`
+ if present, else `name`) within a revision. This ordering is the ABI — it
+ is why new functions must use a new revision: it guarantees new firmware
+ stays backwards compatible with apps compiled against an older
+ `libpebble.a`.
+- `types` are emitted in the order listed; put typedefs after the typedefs
+ they depend on (`includeAfter` is the escape hatch for ordering
+ exceptions).
+- The generator errors out on exports it cannot find in the parsed headers
+ and on inconsistent revision numbers, but it does not verify that the
+ resulting `pebble.h` compiles — review its output.
diff --git a/docs/index.md b/docs/index.md
index a4cd2bd47b..968667e979 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,7 +1,9 @@
```{raw} html
```
+
# PebbleOS documentation
+
```{raw} html
```
@@ -68,18 +70,17 @@ Browse the PebbleOS sources!
:::
:::{grid-item-card}
-:link: reference/external
+:link: reference/index
:link-type: doc
📖 Reference
^^^
-Learn more about PebbleOS: podcasts, developer documents and more!
+Look things up: protocol specifications, podcasts, developer documents and more!
:::
::::
-
```{toctree}
:hidden:
:caption: 🛠️ Development
@@ -88,6 +89,14 @@ development/options.md
development/building_fw.md
development/qemu.md
development/moddable.md
+development/sdk_export.md
+development/contributing.md
+```
+
+```{toctree}
+:hidden:
+:caption: 🏛️ Architecture
+architecture/index.md
```
```{toctree}
@@ -98,6 +107,6 @@ boards/index.md
```{toctree}
:hidden:
-:caption: 📖 Reference
-reference/external.md
+:caption: 📖 Reference
+reference/index.md
```
diff --git a/docs/legacy/battery_state.dot b/docs/legacy/battery_state.dot
deleted file mode 100644
index 1b905732bb..0000000000
--- a/docs/legacy/battery_state.dot
+++ /dev/null
@@ -1,65 +0,0 @@
-digraph G {
- compound=true;
- Initialized [label=<Initialized (0)
q is unknown>];
- PreStandby [label=<PreStandby (8)
q < 2 mAh>];
- Standby [label=<Standby (9)
q < 2 mAh (unless manually entered)>];
-
- /* Charging flow */
- subgraph cluster0 {
- {rank=same;
- FullPlugged [label=<FullPlugged (4)
q ~= 130mAh>, group="charging"];
- O1[style=invis];
- }
- {rank=same;
- HighCharging [label=<HighCharging (5)
25 mAh <= q < 130 mAh>, group="charging"];
- O2[style=invis];
- }
- {rank=same;
- LowCharging [label=<LowCharging (6)
5 mAh <= q < 25 mAh>, group="charging"];
- O3[style=invis];
- }
- {rank=same;
- CriticalCharging [label=<CriticalCharging (7)
q < 5 mAh>, group="charging"];
- O4[style=invis];
- }
-
- CriticalCharging -> LowCharging [label=">3.2V", constraint=false, weight=100];
- LowCharging -> HighCharging [label=">3.8V", constraint=false, weight=100];
- HighCharging -> FullPlugged [color=green, constraint=false, weight=100];
-
- edge[style=invis];
- O1->O2->O3->O4;
-
- color=blue;
- }
-
- subgraph cluster1 {
- FullDischarging [label=<FullDischarging (1)
q > 30mAh (~125h)>, group="discharging"];
- LowDischarging [label=<LowDischarging (2)
5 mAh <= q < 30mAh (~31h)>, group="discharging"];
- CriticalDischarging [label=<CriticalDischarging (3)
2 mAh <= q < 5 mAh (~3h)>, group="discharging"];
-
- FullDischarging -> LowDischarging [label="<=3.7V"];
- LowDischarging -> CriticalDischarging [label="<=3.3V"];
- CriticalDischarging -> PreStandby [label="<=3.1V"];
-
- color=red;
- }
-
- Initialized -> FullDischarging [color=red, lhead=cluster1];
- Initialized -> FullPlugged [color=blue, lhead=cluster0, constraint=false];
-
-
- FullPlugged -> FullDischarging [color=red]
- CriticalCharging -> PreStandby [color=red, weight=0.1];
- HighCharging -> FullDischarging [color=red, constraint=false, weight=0.1];
- LowCharging -> FullDischarging [color=red, constraint=false, weight=0.1];
-
- FullDischarging -> LowCharging [color=blue, weight=0.01];
- FullDischarging -> HighCharging [color=blue, constraint=false, weight=0.1];
- LowDischarging -> LowCharging [color=blue, constraint=false, weight=0.1];
- CriticalDischarging -> LowCharging [color=blue, constraint=false, weight=0.1];
-
-
- PreStandby -> CriticalCharging [color=blue, weight=0.1];
- PreStandby -> Standby [label="30s timeout", weight=0.1];
-}
diff --git a/docs/legacy/docstring-help.md b/docs/legacy/docstring-help.md
deleted file mode 100644
index 91705e9d3c..0000000000
--- a/docs/legacy/docstring-help.md
+++ /dev/null
@@ -1,11 +0,0 @@
-Doxygen pro tips
----
-
-- Define top-level groups and other doxygen constructs in `docs/common.dox`.
-- The main page can be found in `docs/mainpage_sdk.dox`
-- Use \ref to create a cross reference in the documentation to another group, function, struct, or any kind of symbol, for example: `Use \ref app_event_loop() to do awesome shit.` will create a clickable link to the documentation of app_event_loop. Don't forget to add the () parens if the symbol is a function! Using angle brackets like doesn't seem to work reliably, nor does the automatic detection of symbols.
-- Use the directive `@internal` to indicate that a piece of documentation is internal and should not be included in the public SDK documentation. You can add the @internal halfway, so that the first part of your docstrings will be included in the public SDK documentation, and the part after the @internal directive will also get included in our internal docs.
-- Use `@param param_name Description of param` to document a function parameter.
-- Use `@return Description of return value` to document the return value of a function.
-- If you need to add a file or directory that doxygen should index, add its path to `INPUT` in the Doxyfile-SDK configuration file.
-- If you want to make a cross-reference to an external doc page (the conceptual pages on developer.getpebble.com), create an .html file in /docs/external_refs, containing only a link to the page. Then use `\htmlinclude my_ref.html` to include that link in the docs. This extra level of indirection will make it easy to relocate external pages later on.
diff --git a/docs/legacy/legacy_flash_imaging.txt b/docs/legacy/legacy_flash_imaging.txt
deleted file mode 100644
index 17d6f6466c..0000000000
--- a/docs/legacy/legacy_flash_imaging.txt
+++ /dev/null
@@ -1,85 +0,0 @@
-SPI Flash Imaging Using The Serial Console
-==========================================
-
-NOTE: This document describes the original method of flash imaging
-over the serial console. It is no longer used and has been superseded by
-newer, faster methods.
-
-By default the serial console is in logging mode, where log messages
-are echoed to the screen as they are issued. To enter the serial
-prompt, send a CTRL-C character to the serial console. The prompt
-looks like a single right angle bracket ('>'). Commands may be typed
-at this prompt and executed using the enter key.
-
-There are several commands available that can be used to manipulate
-the SPI flash contents.
-
-dump flash
-=============================
-
-This command will dump a section of SPI flash. The address must be specified
-in hex with a leading '0x'. The length is in bytes.
-
-Ex:
-
->dump flash 0x200000 128
-[00:26:38.263] ../src/core/console/prompt.c:115> Data at address 0x200000
-[00:26:38.271] ../src/core/util/hexdump.c:11> 0000 0c 00 00 00 74 bf 03 00 32 9a 8a 4b 90 81 00 20 ....t... 2..K...
-[00:26:38.283] ../src/core/util/hexdump.c:11> 0010 2d a0 01 08 7d a0 01 08 19 93 01 08 7d a0 01 08 -...}... ....}...
-[00:26:38.294] ../src/core/util/hexdump.c:11> 0020 7d a0 01 08 7d a0 01 08 00 00 00 00 00 00 00 00 }...}... ........
-[00:26:38.307] ../src/core/util/hexdump.c:11> 0030 00 00 00 00 00 00 00 00 01 8a 01 08 7d a0 01 08 ........ ....}...
-[00:26:38.319] ../src/core/util/hexdump.c:11> 0040 00 00 00 00 9d 8a 01 08 d9 8a 01 08 7d a0 01 08 ........ ....}...
-[00:26:38.332] ../src/core/util/hexdump.c:11> 0050 7d a0 01 08 7d a0 01 08 7d c9 01 08 7d a0 01 08 }...}... }...}...
-[00:26:38.343] ../src/core/util/hexdump.c:11> 0060 7d a0 01 08 29 59 01 08 3b 59 01 08 4d 59 01 08 }...)Y.. ;Y..MY..
-[00:26:38.355] ../src/core/util/hexdump.c:11> 0070 5f 59 01 08 7d a0 01 08 7d a0 01 08 7d a0 01 08 _Y..}... }...}...
->
-
-erase flash
-==============================
-
-This command will erase a section of SPI flash in 64k chunks. The address must be
-specified in hex with a leading '0x'. The address must be 64k aligned. The length
-is in bytes, and will be rounded up to the next 64k boundary. 'OK' will be echoed to
-the console once the erase operation is complete.
-
-Ex:
-
->erase flash 0x0 128
-Erasing 64k flash sectors starting at address 0x0 for 128 bytes (rounded up to 65536 bytes)
-OK
->
-
-write flash
-=====================
-
-This command allows a user to write bytes to SPI flash. Please ensure
-the region being written to has already been erased. The address must
-be specified in hex with a leading '0x'.
-
-Bytes must be written using base64 encoding. The base64 characters are
-not echoed back to the console as they are written. Bytes are written
-to flash in chunks of 1024 base64 characters, corresponding to 768
-decoded bytes. The watch will echo a '#' character to acknowledge
-receipt of a chunk, followed by echoing 'OK' when the watch is ready
-to receive the next chunk. The end of the final chunk is indicated by
-sending a CTRL-D character (EOF). The current chunk will be flushed to
-SPI flash upon receiving an EOF character. Remember to pad the final
-chunk with '=' characters if it's not a multiple of 3 bytes, as per
-the base64 encoding standard. To exit the 'write flash' mode without
-flushing the current chunk, enter a CTRL-C character.
-
-If a chunk is malformed due to invalid characters or incorrect
-padding, 'Decoding Error' will be printed to the serial port and the
-normal serial prompt will return. Note that any previous chunks that
-were well formed have already been written to SPI flash.
-
-Ex:
-
->write flash 0x0
-Flash imaging mode, CTRL-D to stop
-#OK
->
-
-(NB: Your base64 data is not echoed back when writing to flash. The #OK will show up
-when a chunk is complete or CTRL-D is used.)
-
diff --git a/docs/legacy/porting-bluetooth.md b/docs/legacy/porting-bluetooth.md
deleted file mode 100644
index 1a953587f5..0000000000
--- a/docs/legacy/porting-bluetooth.md
+++ /dev/null
@@ -1,179 +0,0 @@
-# Porting a new Bluetooth stack into PebbleOS
-
-## Build notes
-
-Unlike many other things in the build, a platform textually selects a
-Bluetooth controller using the `waf` environment variable,
-`conf.env.bt_controller`. This ends up pulling in a whole sublibrary
-(essentially), in `src/bluetooth-fw`. This is somewhat cleaner than the
-rest of the driver stack, but it is a change from what you might expect from
-the respect of PebbleOS!
-
-## API surface
-
-A Bluetooth driver exports 70-ish APIs, and has a handful of callbacks that
-it needs to trigger at appropriate times. I group these below in terms of
-API families that one should implement, roughly in order of how critical it
-is to implement them to get anything at all working.
-
-### Power and identity
-
-* bt_driver_init
-* bt_driver_start
-* bt_driver_stop
-* bt_driver_power_down_controller_on_boot
-* bt_driver_id_set_local_device_name
-* bt_driver_id_copy_local_identity_address
-* bt_driver_id_copy_chip_info_string
-* bt_driver_id_generate_private_resolvable_address
-* bt_driver_supports_bt_classic
-* bt_driver_set_local_address
-
-* bt_driver_comm_schedule_send_next_job -- you probably just want to have
- these run on KernelMain, unless you have your own thread that sends should
- happen from. copy from qemu
-* bt_driver_comm_is_current_task_send_next_task
-
-### Advertising
-
-* bt_driver_advert_advertising_disable
-* bt_driver_advert_client_get_tx_power
-* bt_driver_advert_set_advertising_data
-* bt_driver_advert_advertising_enable
-
-
-### GAP
-
-* bt_driver_gap_le_disconnect
-* bt_driver_gap_le_device_name_request
-* bt_driver_gap_le_device_name_request_all
-* bt_driver_le_connection_parameter_update
-* bt_driver_handle_le_connection_handle_update_address_and_irk
-* bt_driver_handle_peer_version_info_event
-* bt_driver_handle_le_connection_complete_event
-* bt_driver_handle_le_disconnection_complete_event
-* bt_driver_handle_le_encryption_change_event
-* bt_driver_handle_le_conn_params_update_event
-
-
-### Pairing and pairing service
-
-Bond database in-memory is managed by the controller. Bond database in
-flash is managed by the OS.
-
-* bt_driver_cb_pairing_confirm_handle_request -- a GAP LE connection wants
- to bond, post message to UI to say so
-* bt_driver_pairing_confirm -- UI agrees to do it
-* bt_driver_cb_pairing_confirm_handle_completed -- bond is complete, from
- BLE controller
-* bt_driver_handle_host_added_bonding -- OS has booted, add bond from
- in-flash database to in-controller database (make sure to kill these in
- bt_driver_stop when reinitting)
-* bt_driver_handle_host_removed_bonding -- user requested bond remove from
- UI
-* bt_driver_cb_handle_create_bonding -- controller has exchanged keys and
- would like OS to store a bond in flash
-
-### Pebble Pairing Service
-
-Pebble Pairing Service is an internal GATT service managed not by the OS but
-by the controller (done in firmware on Dialog, obviously done as a Bluetopia
-client on TI). Implicit in this API is an init that actually sets up the
-Pebble Pairing Service, called within BLE stack!
-
-See at least one implementation:
-https://github.com/pebble-dev/RebbleOS/blob/master/hw/drivers/nrf52_bluetooth/nrf52_bluetooth_ppogatt.c#L352-L417
-
-* bt_driver_pebble_pairing_service_handle_status_change
-* bt_driver_cb_pebble_pairing_service_handle_connection_parameter_write
-* bt_driver_cb_pebble_pairing_service_handle_ios_app_termination_detected
-
-### GATT server / client shim
-
-* bt_driver_gatt_respond_read_subscription
-* bt_driver_gatt_send_changed_indication
-* bt_driver_gatt_start_discovery_range
-* bt_driver_gatt_stop_discovery
-* bt_driver_gatt_handle_discovery_abandoned
-* bt_driver_cb_gatt_client_discovery_handle_indication
-* bt_driver_cb_gatt_client_discovery_complete
-* bt_driver_cb_gatt_client_operations_handle_response
-* bt_driver_cb_gatt_service_changed_server_confirmation
-* bt_driver_cb_gatt_service_changed_server_subscribe
-* bt_driver_cb_gatt_service_changed_server_read_subscription
-* bt_driver_cb_gatt_client_discovery_handle_service_changed
-* bt_driver_gatt_write_without_response
-* bt_driver_gatt_write
-* bt_driver_gatt_read
-* bt_driver_cb_gatt_handle_connect
-* bt_driver_cb_gatt_handle_disconnect
-* bt_driver_cb_gatt_handle_mtu_update
-* bt_driver_cb_gatt_handle_notification
-* bt_driver_cb_gatt_handle_indication
-* bt_driver_cb_gatt_handle_buffer_empty
-
-### Heart rate monitor
-
-The controller implements the GATT functionality for the heart rate monitor,
-rather than the OS. Not implemented on TI.
-
-* bt_driver_is_hrm_service_supported
-* bt_driver_cb_hrm_service_update_subscription
-* bt_driver_hrm_service_handle_measurement
-
-### Scanning
-
-Scanning was only used by APIs that never became public.
-
-* bt_driver_start_le_scan
-* bt_driver_stop_le_scan
-* bt_driver_cb_le_scan_handle_report
-
-### Bluetooth Classic
-
-These apply only to Bluetooth Classic and are no-ops on BLE.
-
-* bt_driver_classic_disconnect
-* bt_driver_classic_is_connected
-* bt_driver_classic_copy_connected_address
-* bt_driver_classic_copy_connected_device_name
-* bt_driver_classic_update_connectability
-* bt_driver_reconnect_pause
-* bt_driver_reconnect_resume
-* bt_driver_reconnect_try_now
-* bt_driver_reconnect_reset_interval
-* bt_driver_reconnect_notify_platform_bitfield
-* bt_driver_le_pairability_set_enabled -- not implemented even on Dialog
-* bt_driver_classic_pairability_set_enabled
-* sys_app_comm_get_sniff_interval
-
-### Analytics
-
-* bt_driver_analytics_get_connection_quality
-* bt_driver_analytics_collect_ble_parameters
-* bt_driver_analytics_external_collect_chip_specific_parameters
-* bt_driver_analytics_external_collect_bt_chip_heartbeat
-* bt_driver_analytics_get_conn_event_stats
-* bluetooth_analytics_handle_ble_pairing_request (callback)
-
-
-### Factory test mode / debugging.
-
-Implemented both by classic and BLE. Used for factory test. Probably
-needs to exist for production test in the future, but
-
-* bt_driver_test_selftest -- implemented
-* hc_endpoint_logging_set_level -- not implemented on TI
-* hc_endpoint_logging_get_level -- not implemented on TI
-* bt_driver_core_dump -- not implemented on TI
-* bt_driver_test_start
-* bt_driver_test_enter_hci_passthrough
-* bt_driver_test_handle_hci_passthrough_character
-* bt_driver_test_enter_rf_test_mode
-* bt_driver_test_set_spoof_address
-* bt_driver_test_stop
-
-Some drivers also have:
-
-* bt_driver_start_unmodulated_tx
-* bt_driver_stop_unmodulated_tx
diff --git a/docs/legacy/tasks.txt b/docs/legacy/tasks.txt
deleted file mode 100644
index 2b5ed8b536..0000000000
--- a/docs/legacy/tasks.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-FreeRTOS lets us create tasks, which are independant threads of execution. We create a few ourselves, and more are created internally by FreeRTOS. We have pre-emption enabled in our FreeRTOS configuration, so we must be mindful of which other tasks are mucking with the same data. This document describes the tasks that exist in our system.
-
-FreeRTOS Tasks
-==============
-Tasks defined internally by FreeRTOS.
-
-"Tmr Svc" - The timer task
---------------------------
-Timers that are registered using our timer infrastructure are executed on this task. This is a FreeRTOS subsystem that we've wrapped with the goodies in fw/timers.h.
-
-"IDLE" - The idle task
-----------------------
-This is a special task used by the FreeRTOS scheduler. It's defined at it's own priority level which is at the lowest priority. If no other task is ready to run, either due to waiting on a semaphore or waiting using vTaskDelay (or something like that), the idle task is chosen to run instead.
-
-We have modified FreeRTOS such that if we're in the idle task, we enter a lower power mode, either sleep or stop. Stop mode is special in that peripheral clocks are shut down when we go into stop and are not automatically turned back on when we leave stop mode. This means we have to go through and turn them all back on. This is what the `register_stop_mode_resume_callback` function does. It allows individual drivers to register callbacks that are called when we leave stop from the idle thread. This comes with a caveat though. Since the idle thread only ever runs when there's nothing else to run, the scheduler assumes that there is always a task to run. This means that if the idle task is stopped or delayed for any reason, the scheduler will explode. Therefore you are not permitted to do operations that may stop the task's execution from within the resume callback.
-
-Pebble Tasks
-============
-
-"main" - The main task
-----------------------
-The first task in our system. Runs the all the driver initialization code, and then gets taken over by the main launcher loop. The launcher event queue is then serviced forever in a loop.
-
-"system_task" - The system task
--------------------------------
-A lower priority task that services callbacks from a worker queue. If you are doing something that may take more than a few milliseconds, it makes sense to delegate it to this queue. For example, flash writes and reads during firmware updates are done on this task.
-
-"app" - The application task
-----------------------------
-This task is created for the currently running app. No task is created for the launcher "app", as it's not a real app and just uses the main task. This task's lifetime is limited to the lifetime of the app.
-
-???
-
-Open Questions
-==============
-
-Which tasks are allowed to manipulate the window state? What if the launcher wants to push a notification window at the same time as an app pushes it's own window?
diff --git a/docs/make.bat b/docs/make.bat
deleted file mode 100644
index 0dc6bc3e50..0000000000
--- a/docs/make.bat
+++ /dev/null
@@ -1,49 +0,0 @@
-:: Copyright 2025 Core Devices 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.
-
-@ECHO OFF
-
-pushd %~dp0
-
-REM Command file for Sphinx documentation
-
-if "%SPHINXBUILD%" == "" (
- set SPHINXBUILD=sphinx-build
-)
-set SOURCEDIR=.
-set BUILDDIR=_build
-
-%SPHINXBUILD% >NUL 2>NUL
-if errorlevel 9009 (
- echo.
- echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
- echo.installed, then set the SPHINXBUILD environment variable to point
- echo.to the full path of the 'sphinx-build' executable. Alternatively you
- echo.may add the Sphinx directory to PATH.
- echo.
- echo.If you don't have Sphinx installed, grab it from
- echo.https://www.sphinx-doc.org/
- exit /b 1
-)
-
-if "%1" == "" goto help
-
-%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
-goto end
-
-:help
-%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
-
-:end
-popd
diff --git a/docs/reference/index.md b/docs/reference/index.md
new file mode 100644
index 0000000000..e5f473a2f4
--- /dev/null
+++ b/docs/reference/index.md
@@ -0,0 +1,37 @@
+# Reference
+
+Lookup material: the firmware C API reference, external talks and documents
+about PebbleOS, and specifications for the protocols used by the firmware
+and its tooling.
+
+## C API reference
+
+The Doxygen-generated reference for the firmware sources (applib, services,
+kernel, drivers) is published alongside this site:
+
+PebbleOS API reference
+
+## External resources
+
+Podcasts, presentations and developer documents from the Pebble community.
+
+```{toctree}
+:maxdepth: 1
+
+external.md
+```
+
+## PULSEv2 protocol suite
+
+PULSE is the serial protocol spoken between the firmware and the host
+tooling (`./pbl console`, flash imaging, `tools/pulse/`). These pages
+specify the wire format and its transports.
+
+```{toctree}
+:maxdepth: 1
+
+pulse2/pulse2.md
+pulse2/reliable-transport.md
+pulse2/flash-imaging.md
+pulse2/history.md
+```
diff --git a/docs/legacy/pulse2/flash-imaging.md b/docs/reference/pulse2/flash-imaging.md
similarity index 100%
rename from docs/legacy/pulse2/flash-imaging.md
rename to docs/reference/pulse2/flash-imaging.md
diff --git a/docs/legacy/pulse2/history.md b/docs/reference/pulse2/history.md
similarity index 100%
rename from docs/legacy/pulse2/history.md
rename to docs/reference/pulse2/history.md
diff --git a/docs/legacy/pulse2/pulse2.md b/docs/reference/pulse2/pulse2.md
similarity index 89%
rename from docs/legacy/pulse2/pulse2.md
rename to docs/reference/pulse2/pulse2.md
index 6f6c73d9ab..5d34d0273a 100644
--- a/docs/legacy/pulse2/pulse2.md
+++ b/docs/reference/pulse2/pulse2.md
@@ -78,9 +78,9 @@ A summary of the frame structure is shown below. This figure does not
include octets inserted for transparency. The fields are transmitted
from left to right.
-Flag | Protocol | Information | FCS | Flag
------|----------|-------------|----------|-----
-0x55 | 2 octets | * | 4 octets | 0x55
+| Flag | Protocol | Information | FCS | Flag |
+| ---- | -------- | ----------- | -------- | ---- |
+| 0x55 | 2 octets | * | 4 octets | 0x55 |
#### Flag field
@@ -152,9 +152,9 @@ Best-effort delivery with very little overhead, similar to PULSEv1.
#### Packet format
-Application Protocol | Length | Information
----------------------|----------|------------
- 2 octets | 2 octets | *
+| Application Protocol | Length | Information |
+| -------------------- | ------ | ----------- |
+| 2 octets | 2 octets | * |
All multibyte fields are in big-endian byte order.
@@ -177,15 +177,15 @@ silently discarded.
BECP is exactly the same as the Link Control Protocol with the following
exceptions:
-* Exactly one BECP packet is encapsulated in the Information field of
+- Exactly one BECP packet is encapsulated in the Information field of
Link Layer frames where the Protocol field indicates type 0xBA29 hex.
-* Only codes 1 through 7 (Configure-Request, Configure-Ack,
+- Only codes 1 through 7 (Configure-Request, Configure-Ack,
Configure-Nak, Configure-Reject, Terminate-Request, Terminate-Ack and
Code-Reject) are used. Other codes should be treated as unrecognized
and should result in Code-Rejects.
-* A distinct set of configure options are used. There are currently no
+- A distinct set of configure options are used. There are currently no
options defined.
#### Sending BEAT packets
@@ -203,9 +203,9 @@ is no NCP, no options, no negotiation.
#### Packet format
-Application Protocol | Length | Information
----------------------|----------|------------
- 2 octets | 2 octets | *
+| Application Protocol | Length | Information |
+| -------------------- | ------ | ----------- |
+| 2 octets | 2 octets | * |
All multibyte fields are in big-endian byte order.
@@ -236,15 +236,15 @@ packets.
**Information command packets**
- Control | Application Protocol | Length | Information
----------|----------------------|----------|------------
-2 octets | 2 octets | 2 octets | *
+| Control | Application Protocol | Length | Information |
+| -------- | -------------------- | -------- | ----------- |
+| 2 octets | 2 octets | 2 octets | * |
**Supervisory commands and responses**
- Control |
----------|
-2 octets |
+| Control |
+| -------- |
+| 2 octets |
##### Control field
@@ -289,15 +289,15 @@ discarded.
TRCP is exactly the same as the Link Control Protocol with the following
exceptions:
-* Exactly one TRCP packet is encapsulated in the Information field of
+- Exactly one TRCP packet is encapsulated in the Information field of
Link Layer frames where the Protocol field indicates type 0xBA33 hex.
-* Only codes 1 through 7 (Configure-Request, Configure-Ack,
+- Only codes 1 through 7 (Configure-Request, Configure-Ack,
Configure-Nak, Configure-Reject, Terminate-Request, Terminate-Ack and
Code-Reject) are used. Other codes should be treated as unrecognized
and should result in Code-Rejects.
-* A distinct set of configure options are used. There are currently no
+- A distinct set of configure options are used. There are currently no
options defined.
The `V(S)` and `V(R)` state variables shall be reset to zero when the
@@ -361,9 +361,9 @@ context of the encapsulated transport protocol.
#### Packet format
- Code | Information
---------|------------
-1 octet | *
+| Code | Information |
+| ------- | ----------- |
+| 1 octet | * |
#### Defined codes
@@ -395,25 +395,23 @@ A PCMP packet has been received with a Code field which is unknown to
the recipient. The Information field must be filled with the Code field
copied from the received packet.
-----
+---
Useful Links
------------
-* [The design document for PULSEv2](https://docs.google.com/a/pulse-dev.net/document/d/1ZlSRz5-BSQDsmutLhUjiIiDfVXTcI53QmrqENJXuCu4/edit?usp=sharing),
+- [The design document for PULSEv2](https://docs.google.com/a/pulse-dev.net/document/d/1ZlSRz5-BSQDsmutLhUjiIiDfVXTcI53QmrqENJXuCu4/edit?usp=sharing),
which includes a draft of this documentation along with a lot of
notes about the design decisions.
-* [Python implementation of PULSEv2](https://github.com/pebble/pulse2)
-* [Wireshark plugin for dissecting PULSEv2 packet captures](https://github.com/pebble/pulse2-wireshark-plugin)
-* [RFC 1661 - The Point to Point Protocol (PPP)](https://tools.ietf.org/html/rfc1661)
-* [RFC 1662 - PPP in HDLC-like Framing](https://tools.ietf.org/html/rfc1662)
-* [RFC 1663 - PPP Reliable Transmission](https://tools.ietf.org/html/rfc1663)
-* [RFC 1570 - PPP LCP Extensions](https://tools.ietf.org/html/rfc1570)
-* [RFC 2153 - PPP Vendor Extensions](https://tools.ietf.org/html/rfc2153)
-* [RFC 3772 - Point-to-Point Protocol (PPP) Vendor Protocol](https://tools.ietf.org/html/rfc3772)
-* [PPP Consistent Overhead Byte Stuffing (COBS)](https://tools.ietf.org/html/draft-ietf-pppext-cobs)
-* [ITU-T Recommendation X.25](https://www.itu.int/rec/T-REC-X.25-199610-I/en)
-* [Digital Data Communications Message Protocol](http://www.ibiblio.org/pub/historic-linux/early-ports/Mips/doc/DEC/ddcmp-4.1.txt)
-
+- [Python implementation of PULSEv2](https://github.com/coredevices/PebbleOS/tree/main/tools/libs/pulse2)
+- [RFC 1661 - The Point to Point Protocol (PPP)](https://tools.ietf.org/html/rfc1661)
+- [RFC 1662 - PPP in HDLC-like Framing](https://tools.ietf.org/html/rfc1662)
+- [RFC 1663 - PPP Reliable Transmission](https://tools.ietf.org/html/rfc1663)
+- [RFC 1570 - PPP LCP Extensions](https://tools.ietf.org/html/rfc1570)
+- [RFC 2153 - PPP Vendor Extensions](https://tools.ietf.org/html/rfc2153)
+- [RFC 3772 - Point-to-Point Protocol (PPP) Vendor Protocol](https://tools.ietf.org/html/rfc3772)
+- [PPP Consistent Overhead Byte Stuffing (COBS)](https://tools.ietf.org/html/draft-ietf-pppext-cobs)
+- [ITU-T Recommendation X.25](https://www.itu.int/rec/T-REC-X.25-199610-I/en)
+- [Digital Data Communications Message Protocol](http://www.ibiblio.org/pub/historic-linux/early-ports/Mips/doc/DEC/ddcmp-4.1.txt)
diff --git a/docs/legacy/pulse2/reliable-transport.md b/docs/reference/pulse2/reliable-transport.md
similarity index 100%
rename from docs/legacy/pulse2/reliable-transport.md
rename to docs/reference/pulse2/reliable-transport.md
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 465cc011b3..5691cd8899 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1,4 +1,4 @@
-sphinx~=8.2
-myst-parser~=4.0
-sphinx-book-theme~=1.1
-sphinx-design~=0.6
+sphinx~=9.1
+myst-parser~=5.1
+sphinx-book-theme~=1.4
+sphinx-design~=0.7
diff --git a/gdb.cmd b/gdb.cmd
deleted file mode 100644
index 8a693c6a03..0000000000
--- a/gdb.cmd
+++ /dev/null
@@ -1,2 +0,0 @@
-target remote localhost:3333
-monitor reset halt
diff --git a/include/bluetooth/bonding_sync.h b/include/bluetooth/bonding_sync.h
index e486714a86..f89493ad4e 100644
--- a/include/bluetooth/bonding_sync.h
+++ b/include/bluetooth/bonding_sync.h
@@ -52,6 +52,7 @@ void bt_driver_handle_host_added_cccd(const BleCCCD *cccd);
void bt_driver_handle_host_removed_cccd(const BleCCCD *cccd);
//! Called by the BT driver after succesfully pairing a new device.
+//! @param bonding The newly created bonding.
//! @param addr The address that is used to refer to the connection. This is used to associate
//! the bonding with the GAPLEConnection.
extern void bt_driver_cb_handle_create_bonding(const BleBonding *bonding,
diff --git a/include/bluetooth/gatt.h b/include/bluetooth/gatt.h
index cd7e2010ea..990489d694 100644
--- a/include/bluetooth/gatt.h
+++ b/include/bluetooth/gatt.h
@@ -132,7 +132,7 @@ extern void bt_driver_cb_gatt_handle_mtu_update(const GattDeviceMtuUpdateEvent *
extern void bt_driver_cb_gatt_handle_notification(const GattServerNotifIndicEvent *event);
-//! @NOTE: The indication is unconditionally confirmed within the bt_driver as soon as one is
+//! @note The indication is unconditionally confirmed within the bt_driver as soon as one is
//! received.
extern void bt_driver_cb_gatt_handle_indication(const GattServerNotifIndicEvent *event);
diff --git a/include/bluetooth/init.h b/include/bluetooth/init.h
index 7f206975bf..aa00f1fe33 100644
--- a/include/bluetooth/init.h
+++ b/include/bluetooth/init.h
@@ -26,7 +26,6 @@ void bt_driver_init(void);
bool bt_driver_start(BTDriverConfig *config);
//! Stops the Bluetooth stack.
-//! @return True if the stack stopped successfully.
void bt_driver_stop(void);
//! Powers down the BT controller if has yet to be used
diff --git a/include/bluetooth/pebble_bt.h b/include/bluetooth/pebble_bt.h
index 2ca0b2e1bf..886fa1642b 100644
--- a/include/bluetooth/pebble_bt.h
+++ b/include/bluetooth/pebble_bt.h
@@ -6,7 +6,8 @@
#include
#include "pbl/util/uuid.h"
-//! @file This file contains Pebble-specific Bluetooth identifiers (numbers, UUIDs, etc.)
+//! @file
+//! This file contains Pebble-specific Bluetooth identifiers (numbers, UUIDs, etc.)
//! Also see https://pebbletechnology.atlassian.net/wiki/display/DEV/Pebble+GATT+Services
//! Our Bluetooth-SIG-Registered 16-bit UUID:
diff --git a/include/bluetooth/pebble_pairing_service.h b/include/bluetooth/pebble_pairing_service.h
index f8571a9a97..a35a4aa6c2 100644
--- a/include/bluetooth/pebble_pairing_service.h
+++ b/include/bluetooth/pebble_pairing_service.h
@@ -218,6 +218,7 @@ extern void bt_driver_cb_pebble_pairing_service_handle_ios_app_termination_detec
//! Indicate to the FW that the Connection Parameters characteristic has been written to with a new
//! values.
+//! @param device The device that wrote to the characteristic.
//! @param conn_params The value as written to the Connection Parameters characteristic. The BT
//! driver lib is expected to validate any written values and only call this function with valid
//! values.
diff --git a/src/fw/drivers/accel.h b/include/pbl/drivers/accel.h
similarity index 96%
rename from src/fw/drivers/accel.h
rename to include/pbl/drivers/accel.h
index 5c9a28092a..df5fc77528 100644
--- a/src/fw/drivers/accel.h
+++ b/include/pbl/drivers/accel.h
@@ -102,9 +102,9 @@ uint32_t accel_get_sampling_interval(void);
//! Set the max number of samples the driver may batch.
//!
-//! @param n Maximum number of samples the driver can batch
+//! @param num_samples Maximum number of samples the driver can batch
//!
-//! When n=0, the accelerometer driver must not call accel_cb_new_sample().
+//! When num_samples=0, the accelerometer driver must not call accel_cb_new_sample().
//!
//! When n=1, the accelerometer driver must call accel_cb_new_sample() for
//! each sample as soon as the hardware has acquired it.
@@ -215,12 +215,15 @@ extern void accel_cb_shake_detected(IMUCoordinateAxis axis, int32_t direction);
//! negative axis
extern void accel_cb_double_tap_detected(IMUCoordinateAxis axis, int32_t direction);
+//! Callback to be invoked from a thread context to perform offloaded driver work.
+typedef void (*AccelOffloadCallback)(void);
+
//! Function called by driver when it needs to offload work from an ISR context.
//! It is up to the implementer to decide how this should work
//!
//! @param cb The callback to be invoked from a thread context
-//! @param data Data to be passed to the callback, NULL if none
-typedef void (*AccelOffloadCallback)(void);
+//! @param should_context_switch Set to true if a context switch should be
+//! performed when returning from the ISR
extern void accel_offload_work_from_isr(AccelOffloadCallback cb, bool *should_context_switch);
//! Function called by driver when it needs to offload work.
diff --git a/src/fw/drivers/ambient_light.h b/include/pbl/drivers/ambient_light.h
similarity index 100%
rename from src/fw/drivers/ambient_light.h
rename to include/pbl/drivers/ambient_light.h
diff --git a/src/fw/drivers/audio.h b/include/pbl/drivers/audio.h
similarity index 100%
rename from src/fw/drivers/audio.h
rename to include/pbl/drivers/audio.h
diff --git a/src/fw/drivers/backlight.h b/include/pbl/drivers/backlight.h
similarity index 100%
rename from src/fw/drivers/backlight.h
rename to include/pbl/drivers/backlight.h
diff --git a/src/fw/drivers/backlight/aw9364e.h b/include/pbl/drivers/backlight/aw9364e.h
similarity index 100%
rename from src/fw/drivers/backlight/aw9364e.h
rename to include/pbl/drivers/backlight/aw9364e.h
diff --git a/src/fw/drivers/backlight/pwm.h b/include/pbl/drivers/backlight/pwm.h
similarity index 100%
rename from src/fw/drivers/backlight/pwm.h
rename to include/pbl/drivers/backlight/pwm.h
diff --git a/src/fw/drivers/battery.h b/include/pbl/drivers/battery.h
similarity index 98%
rename from src/fw/drivers/battery.h
rename to include/pbl/drivers/battery.h
index f5254080a4..5185a92825 100644
--- a/src/fw/drivers/battery.h
+++ b/include/pbl/drivers/battery.h
@@ -90,6 +90,7 @@ typedef struct ADCVoltageMonitorReading {
ADCVoltageMonitorReading battery_read_voltage_monitor(void);
//! Convert a ADCVoltageMonitorReading into a single mV reading using a given dividing ratio.
+//! @param reading The voltage monitor reading to convert.
//! @param numerator The numerator to multiply the result by.
//! @param denominator The denominator to divide the result by.
uint32_t battery_convert_reading_to_millivolts(ADCVoltageMonitorReading reading,
diff --git a/src/fw/drivers/button.h b/include/pbl/drivers/button.h
similarity index 100%
rename from src/fw/drivers/button.h
rename to include/pbl/drivers/button.h
diff --git a/src/fw/drivers/button_id.h b/include/pbl/drivers/button_id.h
similarity index 100%
rename from src/fw/drivers/button_id.h
rename to include/pbl/drivers/button_id.h
diff --git a/src/fw/drivers/clocksource.h b/include/pbl/drivers/clocksource.h
similarity index 100%
rename from src/fw/drivers/clocksource.h
rename to include/pbl/drivers/clocksource.h
diff --git a/src/fw/drivers/debounced_button.h b/include/pbl/drivers/debounced_button.h
similarity index 100%
rename from src/fw/drivers/debounced_button.h
rename to include/pbl/drivers/debounced_button.h
diff --git a/src/fw/drivers/display/display.h b/include/pbl/drivers/display/display.h
similarity index 100%
rename from src/fw/drivers/display/display.h
rename to include/pbl/drivers/display/display.h
diff --git a/src/fw/drivers/display/sf32lb/display_jdi.h b/include/pbl/drivers/display/sf32lb/display_jdi.h
similarity index 100%
rename from src/fw/drivers/display/sf32lb/display_jdi.h
rename to include/pbl/drivers/display/sf32lb/display_jdi.h
diff --git a/src/fw/drivers/display/sharp_ls013b7dh01/sharp_ls013b7dh01.h b/include/pbl/drivers/display/sharp_ls013b7dh01/sharp_ls013b7dh01.h
similarity index 100%
rename from src/fw/drivers/display/sharp_ls013b7dh01/sharp_ls013b7dh01.h
rename to include/pbl/drivers/display/sharp_ls013b7dh01/sharp_ls013b7dh01.h
diff --git a/src/fw/drivers/exti.h b/include/pbl/drivers/exti.h
similarity index 100%
rename from src/fw/drivers/exti.h
rename to include/pbl/drivers/exti.h
diff --git a/src/fw/drivers/flash.h b/include/pbl/drivers/flash.h
similarity index 99%
rename from src/fw/drivers/flash.h
rename to include/pbl/drivers/flash.h
index d6f37ca813..3c5a14ac5a 100644
--- a/src/fw/drivers/flash.h
+++ b/include/pbl/drivers/flash.h
@@ -193,7 +193,7 @@ uint32_t flash_calculate_legacy_defective_checksum(uint32_t flash_addr,
//! to increase the internal reference counter that prevents flash peripheral from powering down.
void flash_use(void);
-//! Convenience for \ref flash_release_many(1)
+//! Convenience for \ref flash_release_many with num_locks = 1
void flash_release(void);
//! Call this after you finished accessing external flash
diff --git a/src/fw/drivers/flash/flash_impl.h b/include/pbl/drivers/flash/flash_impl.h
similarity index 99%
rename from src/fw/drivers/flash/flash_impl.h
rename to include/pbl/drivers/flash/flash_impl.h
index 58319d8e7a..b3704cc2a1 100644
--- a/src/fw/drivers/flash/flash_impl.h
+++ b/include/pbl/drivers/flash/flash_impl.h
@@ -7,7 +7,7 @@
#include
#include
-#include "drivers/flash.h"
+#include
#include "system/status_codes.h"
//! Flash Low-Level API
diff --git a/src/fw/drivers/flash/flash_internal.h b/include/pbl/drivers/flash/flash_internal.h
similarity index 100%
rename from src/fw/drivers/flash/flash_internal.h
rename to include/pbl/drivers/flash/flash_internal.h
diff --git a/src/fw/drivers/flash/qspi_flash.h b/include/pbl/drivers/flash/qspi_flash.h
similarity index 94%
rename from src/fw/drivers/flash/qspi_flash.h
rename to include/pbl/drivers/flash/qspi_flash.h
index 317913cc11..54d8ba6d77 100644
--- a/src/fw/drivers/flash/qspi_flash.h
+++ b/include/pbl/drivers/flash/qspi_flash.h
@@ -6,11 +6,13 @@
#include
#include
-#include "drivers/flash/qspi_flash_definitions.h"
-#include "drivers/flash/qspi_flash_part_definitions.h"
+#include
+#include
#include "system/status_codes.h"
//! Initialize the QSPI flash
+//! @param dev The QSPI flash device to initialize
+//! @param part The description of the QSPI flash part
//! @param coredump_mode If true, don't use anything that might not be available mid-crash, such
//! as FreeRTOS calls or other system services.
void qspi_flash_init(QSPIFlash *dev, QSPIFlashPart *part, bool coredump_mode);
diff --git a/src/fw/drivers/flash/qspi_flash_definitions.h b/include/pbl/drivers/flash/qspi_flash_definitions.h
similarity index 96%
rename from src/fw/drivers/flash/qspi_flash_definitions.h
rename to include/pbl/drivers/flash/qspi_flash_definitions.h
index 8ec67ec4a9..53674ad5a5 100644
--- a/src/fw/drivers/flash/qspi_flash_definitions.h
+++ b/include/pbl/drivers/flash/qspi_flash_definitions.h
@@ -6,7 +6,7 @@
#include
#include "board/board.h"
-#include "drivers/qspi.h"
+#include
#include "qspi_flash_part_definitions.h"
typedef struct QSPIFlashState {
diff --git a/src/fw/drivers/flash/qspi_flash_part_definitions.h b/include/pbl/drivers/flash/qspi_flash_part_definitions.h
similarity index 98%
rename from src/fw/drivers/flash/qspi_flash_part_definitions.h
rename to include/pbl/drivers/flash/qspi_flash_part_definitions.h
index 4fae76748b..e4479160cc 100644
--- a/src/fw/drivers/flash/qspi_flash_part_definitions.h
+++ b/include/pbl/drivers/flash/qspi_flash_part_definitions.h
@@ -6,7 +6,7 @@
#include
#include
-#include "drivers/flash.h"
+#include
typedef enum JESD216Dw15QerType {
JESD216_DW15_QER_NONE = 0,
diff --git a/src/fw/drivers/gpio.h b/include/pbl/drivers/gpio.h
similarity index 100%
rename from src/fw/drivers/gpio.h
rename to include/pbl/drivers/gpio.h
diff --git a/src/fw/drivers/hrm.h b/include/pbl/drivers/hrm.h
similarity index 100%
rename from src/fw/drivers/hrm.h
rename to include/pbl/drivers/hrm.h
diff --git a/src/fw/drivers/hrm/gh3x2x.h b/include/pbl/drivers/hrm/gh3x2x.h
similarity index 94%
rename from src/fw/drivers/hrm/gh3x2x.h
rename to include/pbl/drivers/hrm/gh3x2x.h
index 215162ce9f..557e1c443a 100644
--- a/src/fw/drivers/hrm/gh3x2x.h
+++ b/include/pbl/drivers/hrm/gh3x2x.h
@@ -3,9 +3,9 @@
#pragma once
#include
-#include "drivers/exti.h"
-#include "drivers/gpio.h"
-#include "drivers/i2c.h"
+#include
+#include
+#include
#include "applib/app_timer.h"
#ifdef CONFIG_BOARD_OBELIX
diff --git a/src/fw/drivers/hrm/stub.h b/include/pbl/drivers/hrm/stub.h
similarity index 89%
rename from src/fw/drivers/hrm/stub.h
rename to include/pbl/drivers/hrm/stub.h
index 631ac78340..784558db52 100644
--- a/src/fw/drivers/hrm/stub.h
+++ b/include/pbl/drivers/hrm/stub.h
@@ -3,7 +3,7 @@
#pragma once
-#include "drivers/hrm.h"
+#include
typedef struct HRMDeviceState {
bool enabled;
diff --git a/src/fw/drivers/i2c.h b/include/pbl/drivers/i2c.h
similarity index 100%
rename from src/fw/drivers/i2c.h
rename to include/pbl/drivers/i2c.h
diff --git a/src/fw/drivers/i2c/definitions.h b/include/pbl/drivers/i2c/definitions.h
similarity index 98%
rename from src/fw/drivers/i2c/definitions.h
rename to include/pbl/drivers/i2c/definitions.h
index c29b7e0b36..3e1c32e8bf 100644
--- a/src/fw/drivers/i2c/definitions.h
+++ b/include/pbl/drivers/i2c/definitions.h
@@ -3,7 +3,7 @@
#pragma once
-#include "drivers/rtc.h"
+#include
#include "pbl/os/mutex.h"
#include "freertos_types.h"
diff --git a/src/fw/drivers/i2c/hal.h b/include/pbl/drivers/i2c/hal.h
similarity index 100%
rename from src/fw/drivers/i2c/hal.h
rename to include/pbl/drivers/i2c/hal.h
diff --git a/src/fw/drivers/i2c/nrf5.h b/include/pbl/drivers/i2c/nrf5.h
similarity index 100%
rename from src/fw/drivers/i2c/nrf5.h
rename to include/pbl/drivers/i2c/nrf5.h
diff --git a/src/fw/drivers/i2c/sf32lb.h b/include/pbl/drivers/i2c/sf32lb.h
similarity index 100%
rename from src/fw/drivers/i2c/sf32lb.h
rename to include/pbl/drivers/i2c/sf32lb.h
diff --git a/src/fw/drivers/imu/lis2dw12/lis2dw12.h b/include/pbl/drivers/imu/lis2dw12/lis2dw12.h
similarity index 95%
rename from src/fw/drivers/imu/lis2dw12/lis2dw12.h
rename to include/pbl/drivers/imu/lis2dw12/lis2dw12.h
index 40285f87a2..1f595c3340 100644
--- a/src/fw/drivers/imu/lis2dw12/lis2dw12.h
+++ b/include/pbl/drivers/imu/lis2dw12/lis2dw12.h
@@ -6,8 +6,8 @@
#include
#include
-#include "drivers/accel.h"
-#include "drivers/rtc.h"
+#include
+#include
#include "pbl/services/regular_timer.h"
#define LIS2DW12_FIFO_SIZE 32
diff --git a/src/fw/drivers/imu/lsm6dso/lsm6dso.h b/include/pbl/drivers/imu/lsm6dso/lsm6dso.h
similarity index 95%
rename from src/fw/drivers/imu/lsm6dso/lsm6dso.h
rename to include/pbl/drivers/imu/lsm6dso/lsm6dso.h
index 79531d28c9..fe68059c40 100644
--- a/src/fw/drivers/imu/lsm6dso/lsm6dso.h
+++ b/include/pbl/drivers/imu/lsm6dso/lsm6dso.h
@@ -6,8 +6,8 @@
#include
#include
-#include "drivers/accel.h"
-#include "drivers/rtc.h"
+#include
+#include
#include "pbl/services/regular_timer.h"
// Accelerometer sample size (X, Y, Z, 16-bit each)
@@ -38,6 +38,7 @@ typedef struct LSM6DSOState {
uint8_t wk_ths_curr;
bool recovery_pending;
bool wu_active;
+ bool int1_requeued;
} LSM6DSOState;
typedef struct LSM6DSOConfig {
diff --git a/src/fw/drivers/imu/mmc5603nj/mmc5603nj.h b/include/pbl/drivers/imu/mmc5603nj/mmc5603nj.h
similarity index 100%
rename from src/fw/drivers/imu/mmc5603nj/mmc5603nj.h
rename to include/pbl/drivers/imu/mmc5603nj/mmc5603nj.h
diff --git a/src/fw/drivers/imu/mmc5603nj/registers.h b/include/pbl/drivers/imu/mmc5603nj/registers.h
similarity index 100%
rename from src/fw/drivers/imu/mmc5603nj/registers.h
rename to include/pbl/drivers/imu/mmc5603nj/registers.h
diff --git a/src/fw/drivers/mag.h b/include/pbl/drivers/mag.h
similarity index 100%
rename from src/fw/drivers/mag.h
rename to include/pbl/drivers/mag.h
diff --git a/src/fw/drivers/mcu.h b/include/pbl/drivers/mcu.h
similarity index 100%
rename from src/fw/drivers/mcu.h
rename to include/pbl/drivers/mcu.h
diff --git a/src/fw/drivers/mcu_reboot_reason.h b/include/pbl/drivers/mcu_reboot_reason.h
similarity index 100%
rename from src/fw/drivers/mcu_reboot_reason.h
rename to include/pbl/drivers/mcu_reboot_reason.h
diff --git a/src/fw/drivers/mic.h b/include/pbl/drivers/mic.h
similarity index 100%
rename from src/fw/drivers/mic.h
rename to include/pbl/drivers/mic.h
diff --git a/src/fw/drivers/mic/nrf5/pdm_definitions.h b/include/pbl/drivers/mic/nrf5/pdm_definitions.h
similarity index 98%
rename from src/fw/drivers/mic/nrf5/pdm_definitions.h
rename to include/pbl/drivers/mic/nrf5/pdm_definitions.h
index 25377be3ab..00a4218716 100644
--- a/src/fw/drivers/mic/nrf5/pdm_definitions.h
+++ b/include/pbl/drivers/mic/nrf5/pdm_definitions.h
@@ -4,7 +4,7 @@
#pragma once
#include "board/board.h"
-#include "drivers/mic.h"
+#include
#include "pbl/os/mutex.h"
#include "pbl/util/circular_buffer.h"
diff --git a/src/fw/drivers/mic/qemu/mic_definitions.h b/include/pbl/drivers/mic/qemu/mic_definitions.h
similarity index 94%
rename from src/fw/drivers/mic/qemu/mic_definitions.h
rename to include/pbl/drivers/mic/qemu/mic_definitions.h
index 7b38283e97..c1503f134c 100644
--- a/src/fw/drivers/mic/qemu/mic_definitions.h
+++ b/include/pbl/drivers/mic/qemu/mic_definitions.h
@@ -3,7 +3,7 @@
#pragma once
-#include "drivers/mic.h"
+#include
#include "pbl/services/new_timer/new_timer.h"
#include
diff --git a/src/fw/drivers/mic/sf32lb52/pdm_definitions.h b/include/pbl/drivers/mic/sf32lb52/pdm_definitions.h
similarity index 98%
rename from src/fw/drivers/mic/sf32lb52/pdm_definitions.h
rename to include/pbl/drivers/mic/sf32lb52/pdm_definitions.h
index a537898ac0..519855228a 100644
--- a/src/fw/drivers/mic/sf32lb52/pdm_definitions.h
+++ b/include/pbl/drivers/mic/sf32lb52/pdm_definitions.h
@@ -4,7 +4,7 @@
#pragma once
#include "board/board.h"
-#include "drivers/mic.h"
+#include
#include
#include
diff --git a/src/fw/drivers/mpu.h b/include/pbl/drivers/mpu.h
similarity index 100%
rename from src/fw/drivers/mpu.h
rename to include/pbl/drivers/mpu.h
diff --git a/src/fw/drivers/otp.h b/include/pbl/drivers/otp.h
similarity index 100%
rename from src/fw/drivers/otp.h
rename to include/pbl/drivers/otp.h
diff --git a/src/fw/drivers/pmic.h b/include/pbl/drivers/pmic.h
similarity index 100%
rename from src/fw/drivers/pmic.h
rename to include/pbl/drivers/pmic.h
diff --git a/src/fw/drivers/pmic/npm1300.h b/include/pbl/drivers/pmic/npm1300.h
similarity index 100%
rename from src/fw/drivers/pmic/npm1300.h
rename to include/pbl/drivers/pmic/npm1300.h
diff --git a/src/fw/drivers/pressure.h b/include/pbl/drivers/pressure.h
similarity index 100%
rename from src/fw/drivers/pressure.h
rename to include/pbl/drivers/pressure.h
diff --git a/src/fw/drivers/pwm.h b/include/pbl/drivers/pwm.h
similarity index 100%
rename from src/fw/drivers/pwm.h
rename to include/pbl/drivers/pwm.h
diff --git a/src/fw/drivers/qemu/qemu_accel.h b/include/pbl/drivers/qemu/qemu_accel.h
similarity index 100%
rename from src/fw/drivers/qemu/qemu_accel.h
rename to include/pbl/drivers/qemu/qemu_accel.h
diff --git a/src/fw/drivers/qemu/qemu_battery.h b/include/pbl/drivers/qemu/qemu_battery.h
similarity index 100%
rename from src/fw/drivers/qemu/qemu_battery.h
rename to include/pbl/drivers/qemu/qemu_battery.h
diff --git a/src/fw/drivers/qemu/qemu_serial.h b/include/pbl/drivers/qemu/qemu_serial.h
similarity index 99%
rename from src/fw/drivers/qemu/qemu_serial.h
rename to include/pbl/drivers/qemu/qemu_serial.h
index cc08bdb197..7f024a3440 100644
--- a/src/fw/drivers/qemu/qemu_serial.h
+++ b/include/pbl/drivers/qemu/qemu_serial.h
@@ -9,7 +9,7 @@
#include "applib/accel_service.h"
#include "applib/compass_service.h"
#include "applib/preferred_content_size.h"
-#include "drivers/button_id.h"
+#include
#include "pbl/util/attributes.h"
// The QEMU protocols implemented
diff --git a/src/fw/drivers/qemu/qemu_serial_private.h b/include/pbl/drivers/qemu/qemu_serial_private.h
similarity index 100%
rename from src/fw/drivers/qemu/qemu_serial_private.h
rename to include/pbl/drivers/qemu/qemu_serial_private.h
diff --git a/src/fw/drivers/qemu/qemu_settings.h b/include/pbl/drivers/qemu/qemu_settings.h
similarity index 100%
rename from src/fw/drivers/qemu/qemu_settings.h
rename to include/pbl/drivers/qemu/qemu_settings.h
diff --git a/src/fw/drivers/qspi.h b/include/pbl/drivers/qspi.h
similarity index 87%
rename from src/fw/drivers/qspi.h
rename to include/pbl/drivers/qspi.h
index 09a429214e..316b35e360 100644
--- a/src/fw/drivers/qspi.h
+++ b/include/pbl/drivers/qspi.h
@@ -6,7 +6,7 @@
#include
#include
-#include "drivers/qspi_definitions.h"
+#include
//! Memory mapped region for the QSPI controller
#define QSPI_MMAP_BASE_ADDRESS ((uintptr_t) 0x90000000)
@@ -21,32 +21,39 @@ void qspi_use(QSPIPort *dev);
void qspi_release(QSPIPort *dev);
//! Perform an indirect read operation
+//! @param dev The QSPI port to use
//! @param instruction The instruction to issue
//! @param dummy_cycles How many cycles to wait before reading data
//! @param buffer The buffer to read into
//! @param length The number of bytes to read
+//! @param is_ddr Whether to use DDR (double data rate) mode
void qspi_indirect_read_no_addr(QSPIPort *dev, uint8_t instruction, uint8_t dummy_cycles,
void *buffer, uint32_t length, bool is_ddr);
//! Perform an indirect read operation with an address
+//! @param dev The QSPI port to use
//! @param instruction The instruction to issue
//! @param addr The address to read from
//! @param dummy_cycles How many cycles to wait before reading data
//! @param buffer The buffer to read into
//! @param length The number of bytes to read
+//! @param is_ddr Whether to use DDR (double data rate) mode
void qspi_indirect_read(QSPIPort *dev, uint8_t instruction, uint32_t addr, uint8_t dummy_cycles,
void *buffer, uint32_t length, bool is_ddr);
//! Performs an indirect read operation with DMA
+//! @param dev The QSPI port to use
//! @param instruction The instruction to issue
//! @param start_addr The address to read from
//! @param dummy_cycles How many cycles to wait before reading data
//! @param buffer The buffer to read into
//! @param length The number of bytes to read
+//! @param is_ddr Whether to use DDR (double data rate) mode
void qspi_indirect_read_dma(QSPIPort *dev, uint8_t instruction, uint32_t start_addr,
uint8_t dummy_cycles, void *buffer, uint32_t length, bool is_ddr);
//! Perform an indirect write operation
+//! @param dev The QSPI port to use
//! @param instruction The instruction to issue
//! @param buffer The buffer to write from or NULL if no data should be written
//! @param length The number of bytes to write or 0 if no data should be written
@@ -54,6 +61,7 @@ void qspi_indirect_write_no_addr(QSPIPort *dev, uint8_t instruction, const void
uint32_t length);
//! Perform an indirect write operation with an address
+//! @param dev The QSPI port to use
//! @param instruction The instruction to issue
//! @param addr The address to write to
//! @param buffer The buffer to write from or NULL if no data should be written
@@ -62,10 +70,12 @@ void qspi_indirect_write(QSPIPort *dev, uint8_t instruction, uint32_t addr, cons
uint32_t length);
//! Perform an indirect write operation in single SPI mode (not quad SPI)
+//! @param dev The QSPI port to use
//! @param instruction The instruction to issue
void qspi_indirect_write_no_addr_1line(QSPIPort *dev, uint8_t instruction);
//! Perform an automatic poll operation which will wait for the specified bits to be set/cleared
+//! @param dev The QSPI port to use
//! @param instruction The instruction to issue
//! @param bit_mask The bit(s) to poll on (wait for)
//! @param should_be_set Whether the bits should be set or cleared (true / false respectively)
@@ -74,10 +84,12 @@ bool qspi_poll_bit(QSPIPort *dev, uint8_t instruction, uint8_t bit_mask, bool sh
uint32_t timeout_us);
//! Puts the QSPI in memory-mapped mode
+//! @param dev The QSPI port to use
//! @param instruction The instruction to issue
//! @param addr address of data that will be accessed via memory mapping
//! @param dummy_cycles How many cycles to wait before we can start reading the mapped memory
//! @param length length of data that will be accessed via memory mapping
+//! @param is_ddr Whether to use DDR (double data rate) mode
void qspi_mmap_start(QSPIPort *dev, uint8_t instruction, uint32_t addr, uint8_t dummy_cycles,
uint32_t length, bool is_ddr);
diff --git a/src/fw/drivers/qspi_definitions.h b/include/pbl/drivers/qspi_definitions.h
similarity index 100%
rename from src/fw/drivers/qspi_definitions.h
rename to include/pbl/drivers/qspi_definitions.h
diff --git a/src/fw/drivers/rng.h b/include/pbl/drivers/rng.h
similarity index 100%
rename from src/fw/drivers/rng.h
rename to include/pbl/drivers/rng.h
diff --git a/src/fw/drivers/rtc.h b/include/pbl/drivers/rtc.h
similarity index 96%
rename from src/fw/drivers/rtc.h
rename to include/pbl/drivers/rtc.h
index 9198ab9dd7..0bd5b81a3b 100644
--- a/src/fw/drivers/rtc.h
+++ b/include/pbl/drivers/rtc.h
@@ -56,7 +56,8 @@ void rtc_set_time_tm(struct tm* time_tm);
void rtc_get_time_tm(struct tm* time_tm);
// FIXME: PBL-41066 this should just return a uint64_t
-//! @return millisecond port of the current second.
+//! @param[out] out_seconds The current time in seconds.
+//! @param[out] out_ms Millisecond portion of the current second.
void rtc_get_time_ms(time_t* out_seconds, uint16_t* out_ms);
//! Saves the timezone_info to RTC registers
@@ -108,6 +109,7 @@ bool rtc_alarm_is_initialized(void);
///////////////////////////////////////////////////////////////////////////////
//! @param buffer Buffer used to write the string into. Must be at least TIME_STRING_BUFFER_SIZE
+//! @param t The time to convert.
const char* time_t_to_string(char* buffer, time_t t);
#ifdef CONFIG_SOC_NRF52
diff --git a/src/fw/drivers/sf32lb52/debounced_button_definitions.h b/include/pbl/drivers/sf32lb52/debounced_button_definitions.h
similarity index 100%
rename from src/fw/drivers/sf32lb52/debounced_button_definitions.h
rename to include/pbl/drivers/sf32lb52/debounced_button_definitions.h
diff --git a/src/fw/drivers/sf32lb52/rc10k.h b/include/pbl/drivers/sf32lb52/rc10k.h
similarity index 100%
rename from src/fw/drivers/sf32lb52/rc10k.h
rename to include/pbl/drivers/sf32lb52/rc10k.h
diff --git a/src/fw/drivers/speaker/nrf5/da7212_definitions.h b/include/pbl/drivers/speaker/nrf5/da7212_definitions.h
similarity index 97%
rename from src/fw/drivers/speaker/nrf5/da7212_definitions.h
rename to include/pbl/drivers/speaker/nrf5/da7212_definitions.h
index 902e4098b8..029793cf17 100644
--- a/src/fw/drivers/speaker/nrf5/da7212_definitions.h
+++ b/include/pbl/drivers/speaker/nrf5/da7212_definitions.h
@@ -4,7 +4,7 @@
#pragma once
#include "board/board.h"
-#include "drivers/audio.h"
+#include
#include "pbl/util/circular_buffer.h"
#include
diff --git a/src/fw/drivers/speaker/qemu/audio.h b/include/pbl/drivers/speaker/qemu/audio.h
similarity index 91%
rename from src/fw/drivers/speaker/qemu/audio.h
rename to include/pbl/drivers/speaker/qemu/audio.h
index b2413ebd7c..a64181374c 100644
--- a/src/fw/drivers/speaker/qemu/audio.h
+++ b/include/pbl/drivers/speaker/qemu/audio.h
@@ -5,7 +5,7 @@
#include
-#include "drivers/audio.h"
+#include
typedef struct AudioState {
AudioTransCB trans_cb;
diff --git a/src/fw/drivers/speaker/sf32lb52/audio_definitions.h b/include/pbl/drivers/speaker/sf32lb52/audio_definitions.h
similarity index 90%
rename from src/fw/drivers/speaker/sf32lb52/audio_definitions.h
rename to include/pbl/drivers/speaker/sf32lb52/audio_definitions.h
index 0f8339bf6f..b488e7d58e 100644
--- a/src/fw/drivers/speaker/sf32lb52/audio_definitions.h
+++ b/include/pbl/drivers/speaker/sf32lb52/audio_definitions.h
@@ -4,7 +4,7 @@
#pragma once
#include "board/board.h"
-#include "drivers/audio.h"
+#include
#include
#include
@@ -40,6 +40,9 @@ typedef struct AudioState {
uint8_t *circ_buffer_storage;
CircularBuffer circ_buffer;
AudioTransCB trans_cb;
+ //! Set while a prv_audio_trans_bg refill callback is queued on the system
+ //! task; the DMA ISR must not enqueue another until it has run.
+ volatile bool callback_pending;
uint8_t volume;
//! Raw (unaligned) pointer returned by kernel_malloc for the AUDCODEC DAC
//! DMA buffer. haudcodec->buf[] is bumped up to a cache-line boundary so
diff --git a/src/fw/drivers/speaker/sf32lb52/sf32lb_audio.h b/include/pbl/drivers/speaker/sf32lb52/sf32lb_audio.h
similarity index 100%
rename from src/fw/drivers/speaker/sf32lb52/sf32lb_audio.h
rename to include/pbl/drivers/speaker/sf32lb52/sf32lb_audio.h
diff --git a/src/fw/drivers/task_watchdog.h b/include/pbl/drivers/task_watchdog.h
similarity index 100%
rename from src/fw/drivers/task_watchdog.h
rename to include/pbl/drivers/task_watchdog.h
diff --git a/src/fw/drivers/temperature.h b/include/pbl/drivers/temperature.h
similarity index 100%
rename from src/fw/drivers/temperature.h
rename to include/pbl/drivers/temperature.h
diff --git a/src/fw/drivers/temperature/analog.h b/include/pbl/drivers/temperature/analog.h
similarity index 100%
rename from src/fw/drivers/temperature/analog.h
rename to include/pbl/drivers/temperature/analog.h
diff --git a/src/fw/drivers/touch/cst816/touch_sensor_definitions.h b/include/pbl/drivers/touch/cst816/touch_sensor_definitions.h
similarity index 100%
rename from src/fw/drivers/touch/cst816/touch_sensor_definitions.h
rename to include/pbl/drivers/touch/cst816/touch_sensor_definitions.h
diff --git a/src/fw/drivers/touch/touch_sensor.h b/include/pbl/drivers/touch/touch_sensor.h
similarity index 100%
rename from src/fw/drivers/touch/touch_sensor.h
rename to include/pbl/drivers/touch/touch_sensor.h
diff --git a/src/fw/drivers/uart.h b/include/pbl/drivers/uart.h
similarity index 96%
rename from src/fw/drivers/uart.h
rename to include/pbl/drivers/uart.h
index c49ac0dbc4..ad9462dcef 100644
--- a/src/fw/drivers/uart.h
+++ b/include/pbl/drivers/uart.h
@@ -23,10 +23,10 @@ typedef struct UARTRXErrorFlags {
};
} UARTRXErrorFlags;
-//! The type of function which can be called from within the UART ISR (@see \Ref
+//! The type of function which can be called from within the UART ISR (@see
//! uart_set_*_interrupt_handler)
//! @return Whether or not the ISR should context switch at the end instead of resuming the previous
-//! task (@see \Ref portEND_SWITCHING_ISR)
+//! task (@see portEND_SWITCHING_ISR)
typedef bool (*UARTRXInterruptHandler)(UARTDevice *dev, uint8_t data,
const UARTRXErrorFlags *err_flags);
typedef bool (*UARTTXInterruptHandler)(UARTDevice *dev);
@@ -75,6 +75,8 @@ uint8_t uart_read_byte(UARTDevice *dev);
//! Starts the use of DMA for receiving (the DMARequest must be configured)
//! @param[in] dev The UART device
+//! @param buffer The buffer into which received data is written
+//! @param length The size of the buffer in bytes
void uart_start_rx_dma(UARTDevice *dev, void *buffer, uint32_t length);
//! Stops the use of DMA for receiving (the DMARequest must be configured)
diff --git a/src/fw/drivers/uart/nrf5.h b/include/pbl/drivers/uart/nrf5.h
similarity index 97%
rename from src/fw/drivers/uart/nrf5.h
rename to include/pbl/drivers/uart/nrf5.h
index 3b759f88fa..fca60ed07d 100644
--- a/src/fw/drivers/uart/nrf5.h
+++ b/include/pbl/drivers/uart/nrf5.h
@@ -3,7 +3,7 @@
#pragma once
-#include "drivers/uart.h"
+#include
#include "board/board.h"
diff --git a/src/fw/drivers/uart/qemu.h b/include/pbl/drivers/uart/qemu.h
similarity index 95%
rename from src/fw/drivers/uart/qemu.h
rename to include/pbl/drivers/uart/qemu.h
index 0a6217be42..53216d5894 100644
--- a/src/fw/drivers/uart/qemu.h
+++ b/include/pbl/drivers/uart/qemu.h
@@ -7,7 +7,7 @@
#include
#include "board/board.h"
-#include "drivers/uart.h"
+#include
typedef struct UARTDeviceState {
UARTRXInterruptHandler rx_irq_handler;
diff --git a/src/fw/drivers/uart/sf32lb.h b/include/pbl/drivers/uart/sf32lb.h
similarity index 96%
rename from src/fw/drivers/uart/sf32lb.h
rename to include/pbl/drivers/uart/sf32lb.h
index 7b205157e1..de3c2148d5 100644
--- a/src/fw/drivers/uart/sf32lb.h
+++ b/include/pbl/drivers/uart/sf32lb.h
@@ -7,7 +7,7 @@
#include
#include "board/board.h"
-#include "drivers/uart.h"
+#include
typedef struct UARTState {
bool initialized;
diff --git a/src/fw/drivers/vibe.h b/include/pbl/drivers/vibe.h
similarity index 100%
rename from src/fw/drivers/vibe.h
rename to include/pbl/drivers/vibe.h
diff --git a/src/fw/drivers/vibe/vibe_aw86225.h b/include/pbl/drivers/vibe/vibe_aw86225.h
similarity index 100%
rename from src/fw/drivers/vibe/vibe_aw86225.h
rename to include/pbl/drivers/vibe/vibe_aw86225.h
diff --git a/src/fw/drivers/voltage_monitor.h b/include/pbl/drivers/voltage_monitor.h
similarity index 100%
rename from src/fw/drivers/voltage_monitor.h
rename to include/pbl/drivers/voltage_monitor.h
diff --git a/src/fw/drivers/watchdog.h b/include/pbl/drivers/watchdog.h
similarity index 91%
rename from src/fw/drivers/watchdog.h
rename to include/pbl/drivers/watchdog.h
index bbecc2543d..5c1afff9b5 100644
--- a/src/fw/drivers/watchdog.h
+++ b/include/pbl/drivers/watchdog.h
@@ -4,7 +4,7 @@
#pragma once
#include
-#include "drivers/mcu_reboot_reason.h"
+#include
void watchdog_init(void);
void watchdog_start(void);
diff --git a/include/logging/binary_logging.h b/include/pbl/logging/binary_logging.h
similarity index 99%
rename from include/logging/binary_logging.h
rename to include/pbl/logging/binary_logging.h
index 815ef0ef07..cffa1d2e37 100644
--- a/include/logging/binary_logging.h
+++ b/include/pbl/logging/binary_logging.h
@@ -3,7 +3,7 @@
#pragma once
-#include
+#include
/*
* This file defines the structures required for Binary Logging. Please see
* https://docs.google.com/document/d/1AyRGwr8CiilAViha56EiuRSZFiW0fWMcsTfzkNxByZ8
diff --git a/include/logging/log_hashing.h b/include/pbl/logging/log_hashing.h
similarity index 100%
rename from include/logging/log_hashing.h
rename to include/pbl/logging/log_hashing.h
diff --git a/src/fw/system/logging.h b/include/pbl/logging/logging.h
similarity index 99%
rename from src/fw/system/logging.h
rename to include/pbl/logging/logging.h
index 8d8fe22789..6b2c3f7c41 100644
--- a/src/fw/system/logging.h
+++ b/include/pbl/logging/logging.h
@@ -81,7 +81,7 @@ int pbl_log_get_bin_format(char* buffer, int buffer_len, const uint8_t log_level
#endif
#ifdef CONFIG_LOG_HASHED
- #include
+ #include
#endif
#if MEMFAULT && defined(CONFIG_LOG_HASHED) && __has_include("memfault/core/log.h")
diff --git a/include/pbl/os/mutex.h b/include/pbl/os/mutex.h
index b235b2a2f4..336d4d2e58 100644
--- a/include/pbl/os/mutex.h
+++ b/include/pbl/os/mutex.h
@@ -45,8 +45,8 @@ bool mutex_is_owned_recursive(PebbleRecursiveMutex *handle);
void mutex_unlock_recursive(PebbleRecursiveMutex *handle);
-//! @return true if the calling task owns the mutex
+//! Asserts that the calling task's ownership of the mutex matches \c is_held
void mutex_assert_held_by_curr_task(PebbleMutex *handle, bool is_held);
-//! @return true if the calling task owns the mutex
+//! Asserts that the calling task's ownership of the mutex matches \c is_held
void mutex_assert_recursive_held_by_curr_task(PebbleRecursiveMutex *handle, bool is_held);
diff --git a/include/pbl/services/accel_manager.h b/include/pbl/services/accel_manager.h
index 54a000af56..0fa94fd43b 100644
--- a/include/pbl/services/accel_manager.h
+++ b/include/pbl/services/accel_manager.h
@@ -55,7 +55,8 @@ int sys_accel_manager_set_sampling_rate(AccelManagerState *state, AccelSamplingR
//! Reconfigure an existing subscription to use a sampling rate that's the lowest the hardware
//! can support without introducing jitter and is at least min_rate_hz.
//!
-//! @param min_rate_hz The lowest desired sample rate in millihertz.
+//! @param state The subscription to reconfigure.
+//! @param min_rate_mHz The lowest desired sample rate in millihertz.
//! @return The resulting sample rate in millihertz. 0 if it's not possible to get a rate high
//! enough.
uint32_t accel_manager_set_jitterfree_sampling_rate(AccelManagerState *state,
diff --git a/include/pbl/services/activity/activity.h b/include/pbl/services/activity/activity.h
index 51ef574a6c..6ec19fbda4 100644
--- a/include/pbl/services/activity/activity.h
+++ b/include/pbl/services/activity/activity.h
@@ -326,21 +326,21 @@ typedef enum ActivationDelayInsightType ActivationDelayInsightType;
//! @return True if the activation delay insight has fired
bool activity_prefs_has_activation_delay_insight_fired(ActivationDelayInsightType type);
-//! @return Mark an activation delay insight as having fired
+//! Mark an activation delay insight as having fired
void activity_prefs_set_activation_delay_insight_fired(ActivationDelayInsightType type);
//! @return Which version of the health app was last opened
//! @note 0 is "never opened"
uint8_t activity_prefs_get_health_app_opened_version(void);
-//! @return Record that the health app has been opened at a given version
+//! Record that the health app has been opened at a given version
void activity_prefs_set_health_app_opened_version(uint8_t version);
//! @return Which version of the workout app was last opened
//! @note 0 is "never opened"
uint8_t activity_prefs_get_workout_app_opened_version(void);
-//! @return Record that the workout app has been opened at a given version
+//! Record that the workout app has been opened at a given version
void activity_prefs_set_workout_app_opened_version(uint8_t version);
//! Enable/disable activity insights
@@ -555,6 +555,8 @@ bool activity_test_send_fake_dls_records(void);
//! Used by test apps (running on firmware): Set the current step count
//! Useful for testing the health app
//! @param[in] new_steps the number of steps to set the current steps to
+//! @param[in] current_avg the value to set the current step average to
+//! @param[in] daily_avg the value to set the daily step average to
void activity_test_set_steps_and_avg(int32_t new_steps, int32_t current_avg, int32_t daily_avg);
//! Used by test apps (running on firmware): Set the past seven days of history
diff --git a/include/pbl/services/activity/activity_algorithm.h b/include/pbl/services/activity/activity_algorithm.h
index 8c22251306..a828190d94 100644
--- a/include/pbl/services/activity/activity_algorithm.h
+++ b/include/pbl/services/activity/activity_algorithm.h
@@ -152,7 +152,7 @@ bool activity_algorithm_set_user(uint32_t height_mm, uint32_t weight_g, Activity
//! Process accel samples
//! @param[in] data pointer to the accel samples
//! @param[in] num_samples number of samples to process
-//! @param[in] timestamp timestamp of the first sample in ms
+//! @param[in] timestamp_ms timestamp of the first sample in ms
void activity_algorithm_handle_accel(AccelRawData *data, uint32_t num_samples,
uint64_t timestamp_ms);
diff --git a/include/pbl/services/activity/activity_private.h b/include/pbl/services/activity/activity_private.h
index a12e3cd850..b1b29a905c 100644
--- a/include/pbl/services/activity/activity_private.h
+++ b/include/pbl/services/activity/activity_private.h
@@ -12,7 +12,7 @@
#include "pbl/services/data_logging/data_logging_service.h"
#include "pbl/services/settings/settings_file.h"
#include "system/hexdump.h"
-#include "system/logging.h"
+#include
#include "pbl/util/attributes.h"
#include
@@ -449,6 +449,10 @@ bool activity_test_reset(bool reset_settings, bool tracking_on,
// Load in the stored activities from our settings file
void activity_sessions_prv_init(SettingsFile *file, time_t utc_now);
+// Get the start of the sleep-day window (the ACTIVITY_LAST_SLEEP_MINUTE_OF_DAY local-time
+// cutoff) that now_utc belongs to
+time_t activity_sessions_prv_get_sleep_window_start_utc(time_t now_utc);
+
// Get the UTC time bounds for the current day
void activity_sessions_prv_get_sleep_bounds_utc(time_t now_utc, time_t *enter_utc,
time_t *exit_utc);
diff --git a/include/pbl/services/activity/health_util.h b/include/pbl/services/activity/health_util.h
index d90b70b450..4cfea06e38 100644
--- a/include/pbl/services/activity/health_util.h
+++ b/include/pbl/services/activity/health_util.h
@@ -48,6 +48,7 @@ GTextNodeText *health_util_create_text_node_with_text(const char *text, GFont fo
//! @param[in,out] buffer the string buffer to write to
//! @param buffer_size the size of the string buffer
//! @param duration_s the duration is seconds
+//! @param leading_zero whether to include a leading zero in the formatted string
//! @param i18n_owner i18n owner that must be called with i18n_free_all some time after usage
//! @return snprintf-style number of bytes needed to be written not including the null terminator
int health_util_format_hours_minutes_seconds(char *buffer, size_t buffer_size, int duration_s,
diff --git a/include/pbl/services/activity/insights_settings.h b/include/pbl/services/activity/insights_settings.h
index 39f262f3f2..782db0a37d 100644
--- a/include/pbl/services/activity/insights_settings.h
+++ b/include/pbl/services/activity/insights_settings.h
@@ -90,15 +90,15 @@ typedef struct PACKED ActivityInsightSettings {
//! Read a setting from the insights settings
-//! @param insights_name the name of the insight for which to get a setting
-//! @param[out] settings out an ActivityInsightSettings struct to which the data will be written
+//! @param insight_name the name of the insight for which to get a setting
+//! @param[out] settings_out an ActivityInsightSettings struct to which the data will be written
//! @returns true if the setting was found and the data is valid, false otherwise
//! @note if this function returns false, settings_out will be zeroed out.
bool activity_insights_settings_read(const char *insight_name,
ActivityInsightSettings *settings_out);
//! Write a setting to the insights settings (used for testing)
-//! @param insights_name the name of the insight for which to get a setting
+//! @param insight_name the name of the insight for which to get a setting
//! @param settings an ActivityInsightSettings struct which contains the data to be written
//! @returns true if the setting was successfully saved
bool activity_insights_settings_write(const char *insight_name,
diff --git a/include/pbl/services/activity/kraepelin/kraepelin_algorithm.h b/include/pbl/services/activity/kraepelin/kraepelin_algorithm.h
index 1c91214e67..04f9cd3a72 100644
--- a/include/pbl/services/activity/kraepelin/kraepelin_algorithm.h
+++ b/include/pbl/services/activity/kraepelin/kraepelin_algorithm.h
@@ -151,5 +151,6 @@ time_t kalg_activity_last_processed_time(KAlgState *state, KAlgActivityType acti
void kalg_get_sleep_stats(KAlgState *state, KAlgOngoingSleepStats *stats);
//! Tells the algorithm whether or not it should automatically track activities
+//! @param kalg_state the state structure passed into kalg_init
//! @param enable true to start tracking, false to stop tracking
void kalg_enable_activity_tracking(KAlgState *kalg_state, bool enable);
diff --git a/include/pbl/services/alarms/alarm.h b/include/pbl/services/alarms/alarm.h
index bdc702984c..81e2811ba2 100644
--- a/include/pbl/services/alarms/alarm.h
+++ b/include/pbl/services/alarms/alarm.h
@@ -78,7 +78,7 @@ void alarm_set_time(AlarmId id, int hour, int minute);
void alarm_set_kind(AlarmId id, AlarmKind kind);
//! @param id The alarm that should be updated
-//! @param scheduled_days[DAYS_PER_WEEK] A bool for each weekday (Sunday = index 0) enabled
+//! @param scheduled_days A bool for each weekday (Sunday = index 0) enabled
//! each weekday that is marked as true
void alarm_set_custom(AlarmId id, const bool scheduled_days[DAYS_PER_WEEK]);
@@ -109,7 +109,7 @@ bool alarm_get_info(AlarmId id, AlarmInfo *info_out);
AlarmId alarm_get_most_recent_id(void);
//! @param id The alarm for which the scheduled_days array should be updated for
-//! @param scheduled_days[DAYS_PER_WEEK] An empty bool array for each weekday (Sunday = index 0)
+//! @param scheduled_days An empty bool array for each weekday (Sunday = index 0)
//! that is to be updated. Alarms will run on each weekday that is marked as true
//! @return True if the alarm exists, False otherwise
bool alarm_get_custom_days(AlarmId id, bool scheduled_days[DAYS_PER_WEEK]);
@@ -184,7 +184,7 @@ const char *alarm_get_string_for_kind(AlarmKind kind, bool all_caps);
//! For an alarm of type custom, retrieve a string representing the days that the alarm is set for
//! Example: 1 day: ("Mondays", "Tuesdays"), multiple days: ("Mon,Sat,Sun", "Tue,Thu")
-//! @param [in] scheduled_days[DAYS_PER_WEEK] A bool for each weekday (Sunday = index 0) enabled
+//! @param [in] scheduled_days A bool for each weekday (Sunday = index 0) enabled
//! @param [out] alarm_day_text A character array that is to be updated with the days. It should
//! have a minimum of 28 bytes allocated
void alarm_get_string_for_custom(bool scheduled_days[DAYS_PER_WEEK], char *alarm_day_text);
diff --git a/include/pbl/services/analytics/analytics.def b/include/pbl/services/analytics/analytics.def
index b130f51893..7d5458414d 100644
--- a/include/pbl/services/analytics/analytics.def
+++ b/include/pbl/services/analytics/analytics.def
@@ -112,7 +112,6 @@ PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_health_tracking_enabled)
PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_health_hrm_enabled)
PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_health_hrm_measurement_interval)
PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_health_hrm_activity_tracking_enabled)
-PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_power_mode)
PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_motion_sensitivity)
PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_backlight_intensity_pct)
PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_backlight_timeout_s)
diff --git a/include/pbl/services/app_cache.h b/include/pbl/services/app_cache.h
index 4143bc3165..a10bcaeda1 100644
--- a/include/pbl/services/app_cache.h
+++ b/include/pbl/services/app_cache.h
@@ -9,7 +9,7 @@
#include
#include
-//! @file app_cache.c
+//! @file
//! AppCache
//!
//! The AppCache keeps track of a cache of the applications that have binaries that reside on the
diff --git a/include/pbl/services/app_inbox_service.h b/include/pbl/services/app_inbox_service.h
index ebba0360fe..8ae66b731c 100644
--- a/include/pbl/services/app_inbox_service.h
+++ b/include/pbl/services/app_inbox_service.h
@@ -60,8 +60,12 @@ void app_inbox_service_init(void);
////////////////////////////////////////////////////////////////////////////////////////////////////
// Owner / Receiver (App) API
+//! @param storage The buffer (in app space) used to store incoming messages.
//! @param storage_size The size of the buffer (in app space). Note that a header will be appended
//! to the data of sizeof(AppInboxMessageHeader) bytes.
+//! @param message_handler Handler called when a message has been received.
+//! @param dropped_handler Handler called when one or more messages have been dropped.
+//! @param tag Tag identifying the inbox service.
//! @note The event handler will be executed on the task that called this function.
//! @see app_inbox_create_and_register() for the applib invocation.
bool app_inbox_service_register(uint8_t *storage, size_t storage_size,
@@ -78,6 +82,7 @@ void app_inbox_service_unregister_all(void);
////////////////////////////////////////////////////////////////////////////////////////////////////
// Sender (Kernel) API
+//! @param tag Tag identifying the inbox service to write to.
//! @param required_free_length The length in bytes of the data that needs to be written. Note that
//! this should not include the size of the AppInboxMessageHeader. However, there must be at least
//! (required_free_length + sizeof(AppInboxMessageHeader)) bytes free in the buffer in order to
diff --git a/include/pbl/services/app_outbox_service.h b/include/pbl/services/app_outbox_service.h
index 7fa38b8448..d71a9e70c1 100644
--- a/include/pbl/services/app_outbox_service.h
+++ b/include/pbl/services/app_outbox_service.h
@@ -90,6 +90,9 @@ typedef void (*AppOutboxMessageHandler)(AppOutboxMessage *message);
bool app_outbox_service_is_message_cancelled(AppOutboxMessage *message);
//! Registers a consumer for a specific app outbox service tag.
+//! @param service_tag Tag of the app outbox service to register for.
+//! @param message_handler Callback invoked when a message is added.
+//! @param consumer_task The task on which `message_handler` is invoked.
//! @param consumer_data_size The additional space that will be allocated for context by the app
//! outbox service, on behalf of the consumer. The extra space will be appended to the message that
//! gets passed into `message_handler`.
@@ -101,6 +104,7 @@ void app_outbox_service_register(AppOutboxServiceTag service_tag,
//! Will invoke the sender's `sent_handler` with the status on the app task.
//! @param message Pointer to the message to be consumed. Note that this message will have been
//! free'd after this function returns and should not be used thereafter.
+//! @param status The status to report to the sender's `sent_handler`.
void app_outbox_service_consume_message(AppOutboxMessage *message, AppOutboxStatus status);
//! Closes the outbox.
diff --git a/include/pbl/services/blob_db/api.h b/include/pbl/services/blob_db/api.h
index b6b7310a07..b1795eb96b 100644
--- a/include/pbl/services/blob_db/api.h
+++ b/include/pbl/services/blob_db/api.h
@@ -144,6 +144,8 @@ void blob_db_get_dirty_dbs(uint8_t *ids, uint8_t *num_ids);
//! \param db_id the ID of the blob DB
//! \param key a pointer to the key data
//! \param key_len the lenght of the key, in bytes
+//! \param val a pointer to the value data
+//! \param val_len the length of the value, in bytes
status_t blob_db_insert(BlobDBId db_id,
const uint8_t *key, int key_len, const uint8_t *val, int val_len);
@@ -157,12 +159,18 @@ int blob_db_get_len(BlobDBId db_id,
//! Get the value of length val_len for a given key
//! \param db_id the ID of the blob DB
+//! \param key a pointer to the key data
+//! \param key_len the lenght of the key, in bytes
+//! \param val_out a buffer to store the value data
+//! \param val_len the length of the value, in bytes
//! See \ref BlobDBReadImpl
status_t blob_db_read(BlobDBId db_id,
const uint8_t *key, int key_len, uint8_t *val_out, int val_len);
//! Delete the key/val pair in a blob DB for a given key
//! \param db_id the ID of the blob DB
+//! \param key a pointer to the key data
+//! \param key_len the lenght of the key, in bytes
//! See \ref BlobDBDeleteImpl
status_t blob_db_delete(BlobDBId db_id,
const uint8_t *key, int key_len);
@@ -182,5 +190,7 @@ BlobDBDirtyItem *blob_db_get_dirty_list(BlobDBId db_id);
//! Mark an item in a blob DB as having been synced
//! \note This API is used upon receiving an ACK from the phone during sync
//! \param db_id the ID of the blob DB
+//! \param key a pointer to the key data
+//! \param key_len the lenght of the key, in bytes
//! \see BlobDBMarkSyncedImpl
status_t blob_db_mark_synced(BlobDBId db_id, uint8_t *key, int key_len);
diff --git a/include/pbl/services/blob_db/ios_notif_pref_db.h b/include/pbl/services/blob_db/ios_notif_pref_db.h
index 9816c0279e..fa166e3084 100644
--- a/include/pbl/services/blob_db/ios_notif_pref_db.h
+++ b/include/pbl/services/blob_db/ios_notif_pref_db.h
@@ -37,7 +37,7 @@ void ios_notif_pref_db_free_prefs(iOSNotifPrefs *prefs);
//! @param app_id The iOS app id to check. ex com.apple.MobileSMS
//! @param length The length of the app_id
//! @param attr_list AttributeList for the app
-//! @param attr_list ActionGroup for the app
+//! @param action_group ActionGroup for the app
status_t ios_notif_pref_db_store_prefs(const uint8_t *app_id, int length, AttributeList *attr_list,
TimelineItemActionGroup *action_group);
diff --git a/include/pbl/services/blob_db/pin_db.h b/include/pbl/services/blob_db/pin_db.h
index 9fa45d4ce5..0593b21c37 100644
--- a/include/pbl/services/blob_db/pin_db.h
+++ b/include/pbl/services/blob_db/pin_db.h
@@ -36,7 +36,7 @@ status_t pin_db_next_item_header(TimelineItem *next_item_out,
TimelineItemStorageFilterCallback filter);
//! Determines whether or not the timeline entry has expired based on its age
-//! @param pin_timestamp - the timestamp of the pin being removed
+//! @param pin_end_timestamp - the timestamp of the pin being removed
bool pin_db_has_entry_expired(time_t pin_end_timestamp);
diff --git a/include/pbl/services/blob_db/sync.h b/include/pbl/services/blob_db/sync.h
index e0d285eda9..34e6538d6f 100644
--- a/include/pbl/services/blob_db/sync.h
+++ b/include/pbl/services/blob_db/sync.h
@@ -37,6 +37,7 @@ status_t blob_db_sync_db(BlobDBId db_id);
//! @param db_id the BlobDBId of the database to sync
//! @param key the key to sync
//! @param key_len the length of the key to sync
+//! @param last_updated the last-updated timestamp of the record
status_t blob_db_sync_record(BlobDBId db_id, const void *key, int key_len, time_t last_updated);
//! Get the sync session for a given ID. Will NOT return sessions for individual records
diff --git a/include/pbl/services/blob_db/sync_util.h b/include/pbl/services/blob_db/sync_util.h
index 8dafda18c5..615793ee1e 100644
--- a/include/pbl/services/blob_db/sync_util.h
+++ b/include/pbl/services/blob_db/sync_util.h
@@ -11,9 +11,13 @@
// be very careful.
//! A settings file each callback which checks if the there are dirty records in the file
+//! @param file The settings file being iterated
+//! @param info Info about the current record
//! @param context The address of a bool which will get set
bool sync_util_is_dirty_cb(SettingsFile *file, SettingsRecordInfo *info, void *context);
//! A settings file each callback which builds a BlobDBDirtyItem list
+//! @param file The settings file being iterated
+//! @param info Info about the current record
//! @param context The address of an empty dirty list which will get built
bool sync_util_build_dirty_list_cb(SettingsFile *file, SettingsRecordInfo *info, void *context);
diff --git a/include/pbl/services/bluetooth/bluetooth_persistent_storage.h b/include/pbl/services/bluetooth/bluetooth_persistent_storage.h
index a18ab768b3..d5eadb1588 100644
--- a/include/pbl/services/bluetooth/bluetooth_persistent_storage.h
+++ b/include/pbl/services/bluetooth/bluetooth_persistent_storage.h
@@ -128,7 +128,7 @@ bool bt_persistent_storage_get_local_device_name(char *local_device_name_out, si
//! Stores the customized local device name
//! @param local_device_name The device name to store
-//! @param size The size of the string
+//! @param max_size The size of the string
void bt_persistent_storage_set_local_device_name(char *local_device_name, size_t max_size);
//! Retrieve the airplane mode setting
@@ -136,7 +136,7 @@ void bt_persistent_storage_set_local_device_name(char *local_device_name, size_t
bool bt_persistent_storage_get_airplane_mode_enabled(void);
//! Store the airplane mode setting
-//! @param the airplane mode state to be saved
+//! @param enable the airplane mode state to be saved
void bt_persistent_storage_set_airplane_mode_enabled(bool enable);
///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/include/pbl/services/bluetooth/local_id.h b/include/pbl/services/bluetooth/local_id.h
index 0b164ed7b4..c307884f69 100644
--- a/include/pbl/services/bluetooth/local_id.h
+++ b/include/pbl/services/bluetooth/local_id.h
@@ -12,6 +12,7 @@ void bt_local_id_configure_driver(void);
void bt_local_id_set_device_name(const char *device_name);
//! Copies the name of the local device into the given buffer.
+//! @param name_out Buffer into which the name is copied
//! @param is_le Only consumed if the device used is dual mode. If so,
// this changes the name returned
void bt_local_id_copy_device_name(char name_out[BT_DEVICE_NAME_BUFFER_SIZE], bool is_le);
diff --git a/include/pbl/services/comm_session/session.h b/include/pbl/services/comm_session/session.h
index 719f44a4ae..fadfdcfd2a 100644
--- a/include/pbl/services/comm_session/session.h
+++ b/include/pbl/services/comm_session/session.h
@@ -68,7 +68,7 @@ CommSession *comm_session_get_system_session(void);
//! @note It is possible that the session becomes disconnected at any point in time.
CommSession *comm_session_get_current_app_session(void);
-//! @param session_in_out[in, out] Pass in a pointer to session pointer to sanitize it. The current
+//! @param[in,out] session_in_out Pass in a pointer to session pointer to sanitize it. The current
//! *session value can be NULL, to "auto-select" the session for the currently running app.
//! After returning, if *session_in_out was non-NULL when passed in, it will be unchanged if the app
//! is permitted to use it. If not, it *session_in_out will be set to NULL.
@@ -107,7 +107,7 @@ void comm_session_reset(CommSession *session);
//! @param endpoint_id Which endpoint to send the pebble protocol message to.
//! @param data Pointer to the buffer with data to send
//! @param length The length of the data
-//! @param timeout The duration for how long the call is allowed to block. If the send buffer does
+//! @param timeout_ms The duration for how long the call is allowed to block. If the send buffer does
//! not have enough space available to enqueue the data, this function will block up to timeout_ms.
//! @return true if the data was successfully queued up for sending.
bool comm_session_send_data(CommSession *session, uint16_t endpoint_id,
diff --git a/include/pbl/services/comm_session/session_internal.h b/include/pbl/services/comm_session/session_internal.h
index a242725ec6..7d9579f5aa 100644
--- a/include/pbl/services/comm_session/session_internal.h
+++ b/include/pbl/services/comm_session/session_internal.h
@@ -3,7 +3,7 @@
#pragma once
-#include "drivers/rtc.h"
+#include
#include "session_receive_router.h"
#include "session_transport.h"
diff --git a/include/pbl/services/comm_session/session_send_buffer.h b/include/pbl/services/comm_session/session_send_buffer.h
index 67b1605308..bd17769560 100644
--- a/include/pbl/services/comm_session/session_send_buffer.h
+++ b/include/pbl/services/comm_session/session_send_buffer.h
@@ -33,7 +33,7 @@ SendBuffer * comm_session_send_buffer_begin_write(CommSession *session, uint16_t
//! Copies data into the send buffer of the session.
//! @note The caller must have called comm_session_send_buffer_begin_write() first.
//! @note bt_lock() may be held when making the call.
-//! @param session The session for which to enqueue data
+//! @param send_buffer The send buffer of the session for which to enqueue data
//! @param data Pointer to the data to enqueue
//! @param length Length of the data to enqueue
//! @return true if the data was successfully queued up for sending, or false if there was not
@@ -47,5 +47,5 @@ bool comm_session_send_buffer_write(SendBuffer *send_buffer, const uint8_t *data
//! to the session that was passed in the ..._begin_write() call.
//! @note The caller must have called comm_session_send_buffer_begin_write() first.
//! @note bt_lock() may be held when making the call.
-//! @param session The session for which to release the send buffer.
+//! @param send_buffer The send buffer to release.
void comm_session_send_buffer_end_write(SendBuffer *send_buffer);
diff --git a/include/pbl/services/comm_session/session_transport.h b/include/pbl/services/comm_session/session_transport.h
index 845281972f..c0c96311ff 100644
--- a/include/pbl/services/comm_session/session_transport.h
+++ b/include/pbl/services/comm_session/session_transport.h
@@ -107,10 +107,9 @@ typedef enum TransportDestination {
//! Called by a transport to open/create a Pebble Protocol session for it.
//! @param transport Opaque reference to the underlying serial transport
-//! @param send_next Function pointer to the implementation for the transport to send data
-//! @param is_system True if the transport is connected to the Pebble App (either using
-//! "com.getpebble.private" iAP protocol identifier on iOS, or directly connected to the Android
-//! Pebble App), false if it was directly connected to a 3rd party application.
+//! @param implementation Function pointers implementing the transport (e.g. to send data)
+//! @param destination Whether the transport carries Pebble Protocol for the "system", a 3rd
+//! party app, or both (see \ref TransportDestination).
//! @return True if the session was opened successfully, false if not
//! bt_lock() is expected to be taken by the caller!
CommSession * comm_session_open(Transport *transport, const TransportImplementation *implementation,
@@ -119,6 +118,7 @@ CommSession * comm_session_open(Transport *transport, const TransportImplementat
//! Called by the transport to indicate that the session associated with the given transport needs
//! to be closed and cleaned up.
//! bt_lock() is expected to be taken by the caller!
+//! @param session The session to close.
//! @param reason For analytics tracking.
void comm_session_close(CommSession *session, CommSessionCloseReason reason);
@@ -138,7 +138,8 @@ void comm_session_receive_router_write(CommSession *session,
size_t comm_session_send_queue_get_length(const CommSession *session);
//! Copies bytes from the send buffer into another buffer.
-//! @param start_off The offset into the send buffer
+//! @param session The session whose send queue to copy from
+//! @param start_offset The offset into the send buffer
//! @param length The number of bytes to copy
//! @param[out] data_out Pointer to the buffer into which to copy the data
//! @return The number of bytes copied
@@ -153,6 +154,7 @@ size_t comm_session_send_queue_copy(CommSession *session, uint32_t start_offset,
//! @note Internally, a non-contiguous buffer is used, so it is possible that there is more data
//! to read. To access the entire contents, call this function and comm_session_send_queue_consume()
//! repeatedly until it returns zero.
+//! @param session The session whose send queue to read from
//! @param data_out Pointer to the pointer to assign the read pointer to.
//! @return The number of bytes that can be read starting at the read pointer.
size_t comm_session_send_queue_get_read_pointer(const CommSession *session,
diff --git a/include/pbl/services/compositor/compositor.h b/include/pbl/services/compositor/compositor.h
index 41954b95ab..a73eead5a5 100644
--- a/include/pbl/services/compositor/compositor.h
+++ b/include/pbl/services/compositor/compositor.h
@@ -6,7 +6,7 @@
#include "applib/ui/property_animation.h"
#include "applib/ui/window.h"
-//! @file kernel/services/compositor.h
+//! @file
//! This file manages what's currently shown on the screen of your Pebble!
//! There are two main things that are managed by the compositor...
//!
@@ -16,13 +16,12 @@
//! animations requested by the window stack. The compositor will also draw in
//! the status bar when the app is in fullscreen, and the app will adjust its
//! framebuffer's destination frame vertically. The framebuffer is simply
-//! bitblt'ed into the appropriate position whenever compositor_flush is called.
+//! bitblt'ed into the appropriate position whenever the compositor flushes
+//! to the display.
//!
-//! @see \ref compositor_get_child_entity
-//! @see \ref compositor_set_entity_framebuffer
//! @see \ref compositor_transition
-//! @see \ref window_stack_animation_schedule
-//! @see \ref app_emit_render_ready_event
+//! @see \ref compositor_render_app
+//! @see \ref compositor_app_render_ready
//!
//! Modal Window
//! A modal window is a Window that can be rendered on top of an app without
@@ -30,7 +29,10 @@
//! we can trust its contents. The modal window is animated up and down the
//! screen when its pushed and popped. Since the window doesn't have a framebuffer
//! of its own, we render it to the main framebuffer on top of everything else
-//! whenever compositor_flush is called.
+//! whenever the compositor flushes to the display.
+//!
+//! @see \ref compositor_render_modal
+//! @see \ref compositor_modal_render_ready
//!
//! Transition direction, from the current position to the next.
diff --git a/include/pbl/services/compositor/default/compositor_slide_transitions.h b/include/pbl/services/compositor/default/compositor_slide_transitions.h
index 0d32dd14d0..4e4896e33c 100644
--- a/include/pbl/services/compositor/default/compositor_slide_transitions.h
+++ b/include/pbl/services/compositor/default/compositor_slide_transitions.h
@@ -8,3 +8,7 @@
const CompositorTransition *compositor_slide_transition_timeline_get(bool timeline_is_future,
bool timeline_is_destination,
bool timeline_is_empty);
+
+//! Full-screen vertical push into an app: the incoming app framebuffer slides in, pushing
+//! the current framebuffer out. With slide_up the app enters from the bottom.
+const CompositorTransition *compositor_slide_transition_app_get(bool slide_up);
diff --git a/include/pbl/services/data_logging/dls_private.h b/include/pbl/services/data_logging/dls_private.h
index 395c4b1a73..9c2d4afd37 100644
--- a/include/pbl/services/data_logging/dls_private.h
+++ b/include/pbl/services/data_logging/dls_private.h
@@ -4,7 +4,7 @@
#pragma once
#include "applib/data_logging.h"
-#include "drivers/rtc.h"
+#include
#include "flash_region/flash_region.h"
#include "kernel/pebble_tasks.h"
#include "pbl/os/mutex.h"
diff --git a/include/pbl/services/data_logging/dls_storage.h b/include/pbl/services/data_logging/dls_storage.h
index 4eacdcb791..2db82beecd 100644
--- a/include/pbl/services/data_logging/dls_storage.h
+++ b/include/pbl/services/data_logging/dls_storage.h
@@ -35,12 +35,12 @@ int32_t dls_storage_read(DataLoggingSession *logging_session, uint8_t *buffer, i
int32_t dls_storage_consume(DataLoggingSession *logging_session, int32_t num_bytes);
//! Move the data from the circular buffer in memory to flash.
-//! @param[in] logging_session session to write to
+//! @param[in] session session to write to
//! @return true on success, false on failure
bool dls_storage_write_session(DataLoggingSession *session);
//! Write data directly to logging session storage from a passed in buffer
-//! @param[in] logging_session session to write to
+//! @param[in] session session to write to
//! @param[in] data buffer to write from
//! @param[in] num_bytes number of bytes to write
//! @return true on success, false on failure
diff --git a/include/pbl/services/ecompass.h b/include/pbl/services/ecompass.h
index 8f631ef88b..cc01183ed1 100644
--- a/include/pbl/services/ecompass.h
+++ b/include/pbl/services/ecompass.h
@@ -76,5 +76,5 @@ extern void ecomp_corr_reset(void);
bool sys_ecompass_service_subscribed(void);
//! Populate the provided data struct with compass data from the service.
-//! @param data[out] The struct to populate
+//! @param[out] data The struct to populate
void sys_ecompass_get_last_heading(CompassHeadingData *data);
diff --git a/include/pbl/services/filesystem/app_file.h b/include/pbl/services/filesystem/app_file.h
index 2181c6ae9b..3686993f0a 100644
--- a/include/pbl/services/filesystem/app_file.h
+++ b/include/pbl/services/filesystem/app_file.h
@@ -24,6 +24,10 @@
//! Make an app-file name from the given app_id and suffix string.
//!
+//! @param buffer Buffer to write the file name into
+//! @param buffer_len Size of the buffer, in bytes
+//! @param app_id The app install id to make the file name for
+//! @param suffix The suffix string
//! @param suffix_len strlen(suffix)
//!
//! @note buffer_len must be > APP_FILE_NAME_PREFIX_LENGTH + suffix_len to fit
diff --git a/include/pbl/services/filesystem/pfs.h b/include/pbl/services/filesystem/pfs.h
index 71662f49f5..e9ed55d7d9 100644
--- a/include/pbl/services/filesystem/pfs.h
+++ b/include/pbl/services/filesystem/pfs.h
@@ -201,8 +201,7 @@ extern uint32_t pfs_crc_calculate_file(int fd, uint32_t offset, uint32_t num_byt
extern PFSFileListEntry *pfs_create_file_list(PFSFilenameTestCallback callback);
//! Delete a directory list returned by pfs_list_files
-//! @param callback - callback to be called for on filename
-//! @return - pointer to head node of linked list of names, or NULL if no names match
+//! @param list - pointer to head node of linked list of names
extern void pfs_delete_file_list(PFSFileListEntry *list);
//! Run each filename in the filesystem through the filter callback and delete all files that match
diff --git a/include/pbl/services/hrm/hrm_manager.h b/include/pbl/services/hrm/hrm_manager.h
index 3eeb9ba01b..30db99651e 100644
--- a/include/pbl/services/hrm/hrm_manager.h
+++ b/include/pbl/services/hrm/hrm_manager.h
@@ -115,6 +115,7 @@ bool sys_hrm_manager_set_update_interval(HRMSessionRef session, uint32_t update_
//! @param[out] app_id if not NULL, the app_id belonging to this subscription is returned here
//! @param[out] update_interval_s if not NULL, the requested update interval is returned here
//! @param[out] expire_s if not NULL, the number of seconds that this subcription will expire in
+//! @param[out] features if not NULL, the features of this subscription are returned here
//! @return true if succss, false if subscription was not found
bool sys_hrm_manager_get_subscription_info(HRMSessionRef session, AppInstallId *app_id,
uint32_t *update_interval_s, uint16_t *expire_s,
diff --git a/include/pbl/services/hrm/hrm_manager_private.h b/include/pbl/services/hrm/hrm_manager_private.h
index 16f545201b..ec45c03d80 100644
--- a/include/pbl/services/hrm/hrm_manager_private.h
+++ b/include/pbl/services/hrm/hrm_manager_private.h
@@ -6,7 +6,7 @@
#include "hrm_manager.h"
#include "applib/event_service_client.h"
-#include "drivers/rtc.h"
+#include
#include "freertos_types.h"
#include "kernel/events.h"
#include "pbl/os/mutex.h"
diff --git a/include/pbl/services/music.h b/include/pbl/services/music.h
index 4a7e4ae330..43d73d5941 100644
--- a/include/pbl/services/music.h
+++ b/include/pbl/services/music.h
@@ -84,7 +84,7 @@ bool music_is_volume_reporting_supported(void);
//! @see music_is_command_supported
void music_command_send(MusicCommand command);
-//! @param The command to test.
+//! @param command The command to test.
//! @return True if the command is supported by the connected server.
bool music_is_command_supported(MusicCommand command);
diff --git a/include/pbl/services/poll_remote.h b/include/pbl/services/poll_remote.h
index 8a3d27c540..71f482eaa0 100644
--- a/include/pbl/services/poll_remote.h
+++ b/include/pbl/services/poll_remote.h
@@ -38,6 +38,7 @@ void poll_remote_start(void);
void poll_remote_stop(void);
//! Sets the polling intervals.
+//! @param service The poll remote service for which to set the intervals.
//! @param min_interval_minutes The minimum interval between two "poll services" requests.
//! Calls to poll_remote_send_request() will be no-ops if min_interval_minutes has not been reached.
//! @param max_interval_minutes The maximum interval between two "poll services" requests.
diff --git a/include/pbl/services/powermode_service.h b/include/pbl/services/powermode_service.h
deleted file mode 100644
index 6a1114fdb5..0000000000
--- a/include/pbl/services/powermode_service.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-FileCopyrightText: 2026 Core Devices LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-#include
-
-//! Initialize the power mode service.
-void powermode_service_init(void);
-
-//! Enable or disable the power mode service. When disabled, request and
-//! release calls are no-ops.
-void powermode_service_set_enabled(bool enabled);
-
-//! Request high-performance CPU mode. Must be paired with a
-//! powermode_service_release_hp() call.
-void powermode_service_request_hp(void);
-
-//! Release a previously requested high-performance mode. The CPU will
-//! return to low-power mode only when all clients have released.
-void powermode_service_release_hp(void);
diff --git a/include/pbl/services/process_management/app_storage.h b/include/pbl/services/process_management/app_storage.h
index 2e50141c0b..062e3b2c25 100644
--- a/include/pbl/services/process_management/app_storage.h
+++ b/include/pbl/services/process_management/app_storage.h
@@ -34,8 +34,8 @@ typedef enum AppStorageGetAppInfoResult {
//! Retrieve the process metadata for a given app_bank and performs sanity checks
//! to make sure that the process in the specified app_bank can be run by the current system.
-//! @param app_info[in,out] Structure to be populated with information from flash.
-//! @param build_id_out[out] Buffer into which the GNU build ID of the process its executable
+//! @param[in,out] app_info Structure to be populated with information from flash.
+//! @param[out] build_id_out Buffer into which the GNU build ID of the process its executable
//! should be copied. The buffer must be at least BUILD_ID_EXPECTED_LEN bytes. OK to pass NULL.
//! If no build ID was present, the buffer will be filled with zeroes.
//! @param app_id The app id for which the app metadata needs to be fetched.
@@ -58,7 +58,7 @@ void app_storage_get_file_name(char *name, size_t buf_length, AppInstallId app_i
//! Computes the process image and relocation table size
//! @param info pointer to a PebbleProcessInfo struct
-//! @param load_size_out[out] receives the computed size on success
+//! @param[out] load_size_out receives the computed size on success
//! @return true if the size can be computed safely
bool app_storage_get_process_load_size(const PebbleProcessInfo *info,
size_t *load_size_out);
diff --git a/include/pbl/services/put_bytes/put_bytes_storage.h b/include/pbl/services/put_bytes/put_bytes_storage.h
index 719a33f381..4cc59830cc 100644
--- a/include/pbl/services/put_bytes/put_bytes_storage.h
+++ b/include/pbl/services/put_bytes/put_bytes_storage.h
@@ -73,6 +73,6 @@ void pb_storage_deinit(PutBytesStorage *storage, bool is_success);
//! Some types of storage allow the state of a partial installation to be recovered (today, just
//! firmware & resources).
//! @param obj_type The type of resource to recover the install status of
-//! @param status[out] How many bytes have been written and their crc
+//! @param[out] status How many bytes have been written and their crc
//! @return True iff the status struct was populated with valid data
bool pb_storage_get_status(PutBytesObjectType obj_type, PbInstallStatus *status);
diff --git a/include/pbl/services/regular_timer.h b/include/pbl/services/regular_timer.h
index 3ca6e1828e..1e11acb5f4 100644
--- a/include/pbl/services/regular_timer.h
+++ b/include/pbl/services/regular_timer.h
@@ -41,7 +41,7 @@ void regular_timer_add_multiminute_callback(RegularTimerInfo* cb, uint16_t minut
bool regular_timer_remove_callback(RegularTimerInfo* cb);
//! Check if a regular timer is currently scheduled
-//! @params cb pointer to the RegularTimerInfo struct for the timer
+//! @param cb pointer to the RegularTimerInfo struct for the timer
//! @returns true if scheduled or pending deletion, false otherwise
bool regular_timer_is_scheduled(RegularTimerInfo *cb);
@@ -50,7 +50,7 @@ bool regular_timer_is_scheduled(RegularTimerInfo *cb);
//! TODO: It would probably make sense to just fold this into the logic
//! for _is_scheduled() once we verify no consumers are relying on
//! this odd behavior
-//! @params cb pointer to the RegularTimerInfo struct for the timer
+//! @param cb pointer to the RegularTimerInfo struct for the timer
bool regular_timer_pending_deletion(RegularTimerInfo *cb);
diff --git a/include/pbl/services/settings/settings_raw_iter.h b/include/pbl/services/settings/settings_raw_iter.h
index 5007250b07..27dd6ade3c 100644
--- a/include/pbl/services/settings/settings_raw_iter.h
+++ b/include/pbl/services/settings/settings_raw_iter.h
@@ -101,7 +101,7 @@ bool settings_raw_iter_end(SettingsRawIter *iter);
int settings_raw_iter_get_current_record_pos(SettingsRawIter *iter);
//! Restore a previous record position from
-//! \ref setting_iter_get_current_record_pos
+//! \ref settings_raw_iter_get_current_record_pos
void settings_raw_iter_set_current_record_pos(SettingsRawIter *iter, int pos);
//! Return the resumed record position. This was set when we started searching for a record.
diff --git a/include/pbl/services/shared_prf_storage/shared_prf_storage.h b/include/pbl/services/shared_prf_storage/shared_prf_storage.h
index 992c4382f6..a2182e44bc 100644
--- a/include/pbl/services/shared_prf_storage/shared_prf_storage.h
+++ b/include/pbl/services/shared_prf_storage/shared_prf_storage.h
@@ -47,6 +47,8 @@ bool shared_prf_storage_get_ble_pairing_data(SMPairingInfo *pairing_info_out,
//! @param pairing_info Data structure containing all the pairing info available.
//! @param name Optional device name to store. Pass NULL if not available.
+//! @param requires_address_pinning Whether the pairing requires address pinning.
+//! @param flags Pairing flags to store.
void shared_prf_storage_store_ble_pairing_data(const SMPairingInfo *pairing_info,
const char *name,
bool requires_address_pinning,
diff --git a/include/pbl/services/shared_prf_storage/v3_sprf/shared_prf_storage_private.h b/include/pbl/services/shared_prf_storage/v3_sprf/shared_prf_storage_private.h
index 98fa1fcb3c..855b002444 100644
--- a/include/pbl/services/shared_prf_storage/v3_sprf/shared_prf_storage_private.h
+++ b/include/pbl/services/shared_prf_storage/v3_sprf/shared_prf_storage_private.h
@@ -46,7 +46,7 @@ _Static_assert(sizeof(SprfMagic) == 4, "SprfMagic unexpected size");
//! main_fw_scratch: A region for normal fw to stash info in the future if needed
//!
//! Each entry, or field, has its own crc which is written once the write of the field is complete.
-//! @NOTE: The CRC _must_ be the first member of a field. There are static asserts to catch
+//! @note The CRC _must_ be the first member of a field. There are static asserts to catch
//! this for current, please add a static assert for this if you create a new field
//!
//! A field is 'valid' iff a CRC of its contents matches the crc in flash
diff --git a/include/pbl/services/speaker/speaker_service.h b/include/pbl/services/speaker/speaker_service.h
index 8642ec2659..24468812f9 100644
--- a/include/pbl/services/speaker/speaker_service.h
+++ b/include/pbl/services/speaker/speaker_service.h
@@ -57,6 +57,13 @@ bool speaker_service_play_tone(uint16_t freq_hz, uint16_t duration_ms,
uint8_t waveform, uint8_t velocity,
SpeakerPriority pri, uint8_t vol);
+//! Play a short fixed tone at an absolute output volume, bypassing the user's
+//! speaker-volume preference, so settings UIs can preview a candidate volume
+//! before it is saved. Mute still applies.
+//! @param vol Absolute output volume (0-100)
+//! @return true if playback started
+bool speaker_service_play_volume_preview(uint8_t vol);
+
//! Play N monophonic tracks in parallel, mixed together.
//! Track arrays and any sample data are copied into kernel memory.
//! @param tracks Array of tracks. For each, its notes array and (optional)
diff --git a/include/pbl/services/system_task.h b/include/pbl/services/system_task.h
index 8ab1b13358..82282c8846 100644
--- a/include/pbl/services/system_task.h
+++ b/include/pbl/services/system_task.h
@@ -23,11 +23,13 @@ void system_task_watchdog_feed(void);
typedef void (*SystemTaskEventCallback)(void *data);
//! @param cb Callback function that will later be called from the system task
+//! @param data Context pointer passed to the callback
//! @param should_context_switch A boolean that indicates our ISR should context switch at the end instead of
//! resuming the previous task. See portEND_SWITCHING_ISR()
bool system_task_add_callback_from_isr(SystemTaskEventCallback cb, void *data, bool* should_context_switch);
//! @param cb Callback function that will later be called from the system task
+//! @param data Context pointer passed to the callback
bool system_task_add_callback(SystemTaskEventCallback cb, void *data);
//! @param block True if callbacks should be rejected, False if they should be let through.
diff --git a/include/pbl/services/timeline/attribute.h b/include/pbl/services/timeline/attribute.h
index b451388fef..e8f7fbcb72 100644
--- a/include/pbl/services/timeline/attribute.h
+++ b/include/pbl/services/timeline/attribute.h
@@ -166,8 +166,8 @@ bool attribute_copy(Attribute *dest, const Attribute *src, uint8_t **buffer,
//! in the "out" list in a contiguous region of memory given by buffer
//! @param out a pointer to the destination attribute list
//! @param in a pointer to the source attribute list
-//! @param buffer a pointer to a region of memory at least \ref attribute_list_get_buffer_size(in)
-//! bytes
+//! @param buffer a pointer to a region of memory at least
+//! \ref attribute_list_get_buffer_size "attribute_list_get_buffer_size(in)" bytes
//! @param buffer_end a pointer to the end of the buffer
//! @return true if successful, false if buffer was not large enough
bool attribute_list_copy(AttributeList *out, const AttributeList *in, uint8_t *buffer,
@@ -202,7 +202,7 @@ void attribute_list_add_uint32(AttributeList *list, AttributeId id, uint32_t uin
//! Append an attribute or replace an existing one in an attribute list.
//! @param list pointer to the attribute list
//! @param id AttributeID of the attribute to add
-//! @param TimelineResourceId value to store as the content of the attribute
+//! @param resource_id value to store as the content of the attribute
void attribute_list_add_resource_id(AttributeList *list, AttributeId id,
uint32_t resource_id);
@@ -238,7 +238,7 @@ void attribute_list_add_attribute(AttributeList *list, const Attribute *new_attr
//! Initializes an attribute list.
//! @param num_attributes Number of attributes to initialize for this list
-//! @param list the attribute list to initialize
+//! @param list_out the attribute list to initialize
void attribute_list_init_list(uint8_t num_attributes, AttributeList *list_out);
//! Destroy an attribute list.
@@ -293,7 +293,7 @@ Uint32List *attribute_get_uint32_list(const AttributeList *attr_list, AttributeI
//! @param attr_list a pointer to the list of attributes to serialize
//! @param buffer a pointer to the buffer to write to
//! @param buf_end the end of buffer
-//! @retuns the number of serialized bytes
+//! @returns the number of serialized bytes
size_t attribute_list_serialize(const AttributeList *attr_list, uint8_t *buffer, uint8_t *buf_end);
//! Calculate the required size for a buffer to store a list of attributes
diff --git a/include/pbl/services/timeline/item.h b/include/pbl/services/timeline/item.h
index 02848b08e7..f6f9eae72d 100644
--- a/include/pbl/services/timeline/item.h
+++ b/include/pbl/services/timeline/item.h
@@ -201,8 +201,8 @@ TimelineItem *timeline_item_create_with_attributes(time_t timestamp, uint16_t du
//! in order corresponding to action order
//! @param required_size_for_strings total size of all attribute strings
//! @param string_buffer pointer to pointer to the start of the string buffer (where attribute
-//! strings must be appended. The alloc string will set \code *string_buffer
-//! if \param string buffer is not NULL)
+//! strings must be appended. The alloc string will set \c *string_buffer
+//! if \c string_buffer is not NULL)
TimelineItem *timeline_item_create(int num_attributes, int num_actions,
uint8_t attributes_per_action[], size_t required_size_for_strings, uint8_t **string_buffer);
@@ -246,7 +246,7 @@ void timeline_item_deserialize_header(TimelineItem *item,
//! Get the UTC-to-localtime adjusted timestamp of a serialized or deserialized header.
//! Just returns the timestamp if the item is not an all day event or floating.
-//! @param pointer to the header of the item
+//! @param hdr pointer to the header of the item
//! @return the potentially adjusted timestamp
time_t timeline_item_get_tz_timestamp(CommonTimelineItemHeader *hdr);
@@ -254,7 +254,7 @@ time_t timeline_item_get_tz_timestamp(CommonTimelineItemHeader *hdr);
//! @param item a pointer to the item to serialize
//! @param buffer a pointer to the buffer to write to
//! @param buffer_size the size of the buffer in bytes
-//! @returns the number of bytes written to \ref buffer
+//! @returns the number of bytes written to \c buffer
size_t timeline_item_serialize_payload(TimelineItem *item, uint8_t *buffer,
size_t buffer_size);
@@ -263,10 +263,10 @@ size_t timeline_item_get_serialized_payload_size(TimelineItem *item);
//! Deserialize actions & attributes from payload
//! @param item pointer to the item to deserialize
-//! @string_buffer buffer to store the strings in
-//! @string_buffer_size size of the string buffer in bytes
-//! @payload serialized payload buffer
-//! @payload_size size of the payload buffer in bytes
+//! @param string_buffer buffer to store the strings in
+//! @param string_buffer_size size of the string buffer in bytes
+//! @param payload serialized payload buffer
+//! @param payload_size size of the payload buffer in bytes
//! @return true on success
bool timeline_item_deserialize_payload(TimelineItem *item,
char *string_buffer, size_t string_buffer_size, const uint8_t *payload, size_t payload_size);
diff --git a/include/pbl/services/timeline/layout_layer.h b/include/pbl/services/timeline/layout_layer.h
index d844491096..40596828d1 100644
--- a/include/pbl/services/timeline/layout_layer.h
+++ b/include/pbl/services/timeline/layout_layer.h
@@ -133,13 +133,13 @@ struct LayoutLayerConfig {
void *context;
};
-//! Call the correct \ref LayoutLayerConstructor for a given \ref LayoutId
+//! Call the correct \c LayoutLayerConstructor for a given \ref LayoutId
LayoutLayer *layout_create(LayoutId id, const LayoutLayerConfig *config);
//! Verify that the required attributes are there for the layout
bool layout_verify(bool existing_attributes[], LayoutId id);
-//! Call the \ref LayoutLayerSizeGetter for a given layout
+//! Call the \c LayoutLayerSizeGetter for a given layout
GSize layout_get_size(GContext *ctx, LayoutLayer *layout);
const LayoutColors *layout_get_colors(const LayoutLayer *layout);
diff --git a/include/pbl/services/timeline/swap_layer.h b/include/pbl/services/timeline/swap_layer.h
index 4ed20e6af4..048020a3ce 100644
--- a/include/pbl/services/timeline/swap_layer.h
+++ b/include/pbl/services/timeline/swap_layer.h
@@ -62,8 +62,8 @@ typedef struct {
//! layer_set_hidden((Layer *)&swap_layer, true);
//! \endcode
//! @note However, there are a few caveats:
-//! * To add content layers, you must use \ref swap_layer_add_child().
-//! * To change the frame of a scroll layer, use \ref swap_layer_set_frame().
+//! * To add content layers, you must use \c swap_layer_add_child().
+//! * To change the frame of a scroll layer, use \c swap_layer_set_frame().
typedef struct SwapLayer {
Layer layer;
ArrowLayer arrow_layer;
diff --git a/include/pbl/services/timeline/timeline.h b/include/pbl/services/timeline/timeline.h
index f05c3b3b8f..31c691a287 100644
--- a/include/pbl/services/timeline/timeline.h
+++ b/include/pbl/services/timeline/timeline.h
@@ -29,7 +29,7 @@ typedef struct {
status_t timeline_init(TimelineNode **timeline);
//! Add a timeline pin we've created to the timeline.
-//! Call \ref timeline_destroy_item after this in order to free up the memory used by the item.
+//! Call \ref timeline_item_destroy after this in order to free up the memory used by the item.
//! @return true on success, false otherwise
bool timeline_add(TimelineItem *item);
@@ -62,6 +62,7 @@ bool timeline_nodes_equal(TimelineNode *a, TimelineNode *b);
//! returns the first parent_id of the item, which is the app's UUID (for pins) or source ID
//! (for notifications). For reminders, it will return the parent_id of the parent, which is the
//! app UUID of the pin that created the reminder.
+//! @param item the timeline item to get the originator of
//! @param [out] id pointer to storage for returned uuid. Set to UUID_INVALID when false
//! is returned
//! @return true if success, false on failure
@@ -80,7 +81,7 @@ int timeline_item_time_comparator(CommonTimelineItemHeader *new_common,
//! Whether a Timeline item should show up in the Timeline direction with the exception of all
//! day events.
-//! @param common The common header of the item to consider.
+//! @param header The common header of the item to consider.
//! @param direction The Timeline direction.
//! @return true if the item would show up, false otherwise.
bool timeline_item_should_show(CommonTimelineItemHeader *header, TimelineIterDirection direction);
diff --git a/include/pbl/services/timeline/timeline_actions.h b/include/pbl/services/timeline/timeline_actions.h
index 5186118bc1..cd4dc3ff0d 100644
--- a/include/pbl/services/timeline/timeline_actions.h
+++ b/include/pbl/services/timeline/timeline_actions.h
@@ -24,13 +24,14 @@ void timeline_actions_add_action_to_root_level(TimelineItemAction *action,
//! Creates the root level for a Timeline ActionMenu, needed for holding timeline actions.
//! @param num_actions The number of actions the root level will hold.
//! @param separator_index See (struct ActionMenuLevel).
+//! @param source The window/app that creates the action menu
//! @return A pointer to the root level of the action menu.
ActionMenuLevel *timeline_actions_create_action_menu_root_level(uint8_t num_actions,
uint8_t separator_index,
TimelineItemActionSource source);
//! Creates a Timeline ActionMenu and pushes it to the screen
-//! @param config The configuration info for this new ActionMenu. The config context must be a
+//! @param base_config The configuration info for this new ActionMenu. The config context must be a
//! pointer to the TimelineItem associated with this menu.
//! @param window_stack Window stack to push the action menu to
ActionMenu *timeline_actions_push_action_menu(ActionMenuConfig *base_config,
@@ -60,5 +61,7 @@ void timeline_actions_dismiss_all(NotificationInfo *notif_list, int num_notifica
//! Invokes a timeline action
//! @param action The action to perform
//! @param pin The pin associated with the action
+//! @param cb Callback invoked when the action completes
+//! @param cb_data Context pointer passed to the callback
void timeline_actions_invoke_action(const TimelineItemAction *action, const TimelineItem *pin,
ActionCompleteCallback cb, void *cb_data);
diff --git a/include/pbl/services/timeline/timeline_resources.h b/include/pbl/services/timeline/timeline_resources.h
index dd758bf319..803cbc531a 100644
--- a/include/pbl/services/timeline/timeline_resources.h
+++ b/include/pbl/services/timeline/timeline_resources.h
@@ -88,7 +88,7 @@ bool timeline_resources_get_id_system(TimelineResourceId timeline_id, TimelineRe
//! @param timeline_res pointer to TimelineResourceInfo which contains the timeline resource ID and
//! corresponding app UUID
//! @param size the TimelineResourceSize requested
-//! @param resource_id outparam pointer to AppResourceIdInfo containing the ID and
+//! @param res_info_out outparam pointer to AppResourceIdInfo containing the ID and
//! ResAppNum for the requested timeline resource (both 0 if the resource could not be located)
void timeline_resources_get_id(const TimelineResourceInfo *timeline_res, TimelineResourceSize size,
AppResourceInfo *res_info_out);
diff --git a/include/pbl/services/timezone_database.h b/include/pbl/services/timezone_database.h
index 0ec22af342..27bbdb0137 100644
--- a/include/pbl/services/timezone_database.h
+++ b/include/pbl/services/timezone_database.h
@@ -55,14 +55,14 @@ int timezone_database_get_region_count(void);
//! Note, this does not populate the actual bounds of the current DST period and instead leaves
//! the .dst_start and .dst_end members in tz_info uninitialized.
//!
-//! @param The region ID to look up
-//! @param tz_info[out] The TimezoneInfo strcuture to populate with the region
+//! @param region_id The region ID to look up
+//! @param[out] tz_info The TimezoneInfo strcuture to populate with the region
bool timezone_database_load_region_info(uint16_t region_id, TimezoneInfo *tz_info);
//! Load a timezone name for a given region ID.
//!
//! @param region_id The region ID to look up
-//! @param region_name[out] The resulting null-terminated name, including both the continent and
+//! @param[out] region_name The resulting null-terminated name, including both the continent and
//! the city name. This buffer must be at least TIMEZONE_NAME_LENGTH long
//! in bytes.
//! @return True if successful, false if the region ID was invalid.
@@ -71,8 +71,8 @@ bool timezone_database_load_region_name(uint16_t region_id, char *region_name);
//! Load a pair of DST rules for the given id.
//!
//! @param dst_id The DST rule ID to look up
-//! @param start[out] a TimezoneDSTRule structure to populate with the rule to enter DST
-//! @param start[out] a TimezoneDSTRule structure to populate with the rule to leave DST
+//! @param[out] start a TimezoneDSTRule structure to populate with the rule to enter DST
+//! @param[out] end a TimezoneDSTRule structure to populate with the rule to leave DST
//! @return true if successful, false if the dst_id is invalid or the database is malformed
bool timezone_database_load_dst_rule(uint8_t dst_id, TimezoneDSTRule *start, TimezoneDSTRule *end);
diff --git a/include/pbl/util/circular_buffer.h b/include/pbl/util/circular_buffer.h
index fecf6c4070..972541e692 100644
--- a/include/pbl/util/circular_buffer.h
+++ b/include/pbl/util/circular_buffer.h
@@ -38,6 +38,7 @@ bool circular_buffer_write(CircularBuffer* buffer, const void* data, uint16_t le
//! @note After the client is done writing data, it _must_ call circular_buffer_write_finish()
//! so that the CircularBuffer can update the length of the data it contains and update its internal
//! bookkeeping
+//! @param buffer The circular buffer to write to.
//! @param[out] data_out Pointer to storage for the pointer that is set the the start of the
//! writable area when the function returns, or NULL if there is no space available.
//! @return The maximum number of bytes that can be written starting at the returned the pointer.
@@ -46,6 +47,7 @@ uint16_t circular_buffer_write_prepare(CircularBuffer *buffer, uint8_t **data_ou
//! To be used after circular_buffer_write_prepare(), to make the CircularBuffer update the length
//! of the data it contains.
+//! @param buffer The circular buffer that was written to.
//! @param written_length The length that has just been writted at the pointer provided by
//! circular_buffer_write_prepare().
void circular_buffer_write_finish(CircularBuffer *buffer, uint16_t written_length);
@@ -86,7 +88,7 @@ uint16_t circular_buffer_copy_offset(const CircularBuffer* buffer, uint16_t star
//! In case the requested length wraps around the edges of the circular buffer, a heap-allocated
//! copy is made.
//! @param buffer The buffer to read or copy from.
-//! @param[out] data_ptr_out After returning, it will point to the byte array with the data. NOTE:
+//! @param[out] data_out After returning, it will point to the byte array with the data. NOTE:
//! This can be NULL in the case the malloc_imp wasn't able to allocate the buffer.
//! @param[in] length The length of the data to read. If this is longer than what
//! circular_buffer_get_read_space_remaining() returns, the function will return false.
diff --git a/include/pbl/util/heap.h b/include/pbl/util/heap.h
index 7efd01708d..ac83833725 100644
--- a/include/pbl/util/heap.h
+++ b/include/pbl/util/heap.h
@@ -47,6 +47,7 @@ typedef struct Heap {
//! Initialize the heap inside the specified boundaries, zero-ing out the free
//! list data structure.
//! @note Assumes 0 is not a valid address for allocation.
+//! @param heap The heap to initialize
//! @param start The start of the heap will be the first int-aligned address >= start
//! @param end The end of the heap will be the last sizeof(HeaderBlock) aligned
//! address that is < end
@@ -70,6 +71,7 @@ void heap_set_corruption_handler(Heap *heap, CorruptionHandler corruption_handle
//! endo of the buffer, while small fragments are taken from the start of the
//! buffer.
//! @note heap_init() must be called prior to using heap_malloc().
+//! @param heap The heap to allocate from
//! @param nbytes Number of bytes to be allocated. Must be > 0.
//! @param client_pc The PC register of the client who caused this malloc. Only used when
//! CONFIG_MALLOC_INSTRUMENTATION is defined.
@@ -88,6 +90,7 @@ void heap_free(Heap* const heap, void* ptr, uintptr_t client_pc);
//! Allocate a new block of the given size, and copy over the data at ptr into
//! the new block. If the new size is smaller than the old size, will only copy
//! over as much data as possible. Frees ptr.
+//! @param heap The heap to allocate from
//! @param ptr Points to the memory region to re-allocate.
//! @param nbytes The total number of bytes to allocate.
//! @param client_pc The PC register of the client who caused this malloc. Only used when
@@ -116,6 +119,7 @@ uint32_t heap_get_minimum_headroom(Heap *heap);
//! Used for debugging.
//! Calculates and outputs the current memory usage on the given heap.
+//! @param heap The heap to calculate the totals for
//! @param used Output, will contain the number of bytes currently
//! allocated and in use.
//! @param free Output, will contain the number of unallocated bytes.
diff --git a/include/pbl/util/list.h b/include/pbl/util/list.h
index 2dee61324f..7f8616cae0 100644
--- a/include/pbl/util/list.h
+++ b/include/pbl/util/list.h
@@ -48,11 +48,13 @@ void list_remove(ListNode *node, ListNode **head, ListNode **tail);
//! Appends new_node to the tail of the list that node is part of.
//! @param node Any node in the list, can be NULL (will result in a list containing only new_node)
+//! @param new_node The node to append
//! Always returns the tail of the list.
ListNode* list_append(ListNode *node, ListNode *new_node);
//! Appends new_node to the head of the list that node is part of.
//! @param node Any node in the list, can be NULL (will result in a list containing only new_node)
+//! @param new_node The node to prepend
//! Always returns the head of the list.
ListNode* list_prepend(ListNode *node, ListNode *new_node);
@@ -83,7 +85,7 @@ uint32_t list_count_to_head_from(ListNode *node);
//! Counts the number of nodes from head to tail
uint32_t list_count(ListNode *node);
-//! Gets the node at away, where positive index is towards the tail
+//! Gets the node at \c index away, where positive index is towards the tail
ListNode* list_get_at(ListNode *node, int32_t index);
//! Adds a node to a list ordered by given comparator.
@@ -104,7 +106,6 @@ bool list_contains(const ListNode *head, const ListNode *node);
//! @param node The list node from which to depart the search
//! @param filter_callback A function returning true in case the node that is passed in matches the
//! filter criteria, and false if it doesn't and should be skipped.
-//! @param found_node The node to be evaluated by the filter callback
//! @param data Optional callback data
ListNode* list_find(ListNode *node, ListFilterCallback filter_callback, void *data);
@@ -112,7 +113,6 @@ ListNode* list_find(ListNode *node, ListFilterCallback filter_callback, void *da
//! @param node The list node from which to depart the search
//! @param filter_callback A function returning true in case the node that is passed in matches the
//! filter criteria, and false if it doesn't and should be skipped.
-//! @param found_node The node to be evaluated by the filter callback
//! @param wrap_around True if the search should continue from the head if the tail has been reached
//! @param data Optional callback data
ListNode* list_find_next(ListNode *node, ListFilterCallback filter_callback, bool wrap_around, void *data);
@@ -121,7 +121,6 @@ ListNode* list_find_next(ListNode *node, ListFilterCallback filter_callback, boo
//! @param node The list node from which to depart the search
//! @param filter_callback A function returning true in case the node that is passed in matches the
//! filter criteria, and false if it doesn't and should be skipped.
-//! @param found_node The node to be evaluated by the filter callback
//! @param wrap_around True if the search should continue from the tail if the head has been reached
//! @param data Optional callback data
ListNode* list_find_prev(ListNode *node, ListFilterCallback filter_callback, bool wrap_around, void *data);
@@ -135,7 +134,7 @@ ListNode* list_concatenate(ListNode *list_a, ListNode *list_b);
//! Iterates over each node and passes it into callback given
//! @param[in] head The head of the list that we want to iterate over.
//! @param[in] each_cb The callback function to pass each node into
-//! @param[in] data Optional callback data
+//! @param[in] context Optional callback data
void list_foreach(ListNode *head, ListForEachCallback each_cb, void *context);
//! Dump a list to PBL_LOG
diff --git a/include/pbl/util/math.h b/include/pbl/util/math.h
index 7f71463f87..48d9a1e403 100644
--- a/include/pbl/util/math.h
+++ b/include/pbl/util/math.h
@@ -43,6 +43,8 @@ int32_t sign_extend(uint32_t a, int bits);
int32_t serial_distance32(uint32_t start, uint32_t end);
//! Calculates the distance (end - start), taking a roll-over into account as good as it can get.
+//! @param start the start value
+//! @param end the end value
//! @param bits the number of bits that are valid in start and end.
int32_t serial_distance(uint32_t start, uint32_t end, int bits);
diff --git a/include/pbl/util/math_fixed.h b/include/pbl/util/math_fixed.h
index e7ed2949fc..f149d07737 100644
--- a/include/pbl/util/math_fixed.h
+++ b/include/pbl/util/math_fixed.h
@@ -164,9 +164,9 @@ static __inline__ Fixed_S16_3 Fixed_S16_3_S32_16_mul(Fixed_S16_3 a, Fixed_S32_16
//! num_input_coefficients
//! @param[in] ca pointer to array of output side coefficients. Must be an array of size
//! num_output_coefficients
-//! @param[in|out] state_x pointer to array to hold the history of x. Must be an array
+//! @param[in,out] state_x pointer to array to hold the history of x. Must be an array
//! of size num_input_coefficients
-//! @param[in|out] state_y pointer to array to hold the history of y. Must be an array
+//! @param[in,out] state_y pointer to array to hold the history of y. Must be an array
//! of size num_output_coefficients
//! @return the filtered output value, y[n]
Fixed_S64_32 math_fixed_recursive_filter(Fixed_S64_32 x,
diff --git a/include/pbl/util/slist.h b/include/pbl/util/slist.h
index 75c720fdc9..e56cff4b46 100644
--- a/include/pbl/util/slist.h
+++ b/include/pbl/util/slist.h
@@ -27,11 +27,13 @@ SingleListNode* slist_insert_after(SingleListNode *node, SingleListNode *new_nod
//! Prepends new_node to the head of the list.
//! @param head The current head of the list, can be NULL.
+//! @param new_node The node to prepend.
//! Always returns the new head of the list.
SingleListNode* slist_prepend(SingleListNode *head, SingleListNode *new_node);
//! Appends new_node to the tail of the list that head is part of.
//! @param head Any node in the list, can be NULL (will result in a list containing only new_node).
+//! @param new_node The node to append.
//! Always returns the tail of the list.
SingleListNode* slist_append(SingleListNode *head, SingleListNode *new_node);
diff --git a/include/pbl/util/string.h b/include/pbl/util/string.h
index 646b4457b7..8c00d1ed5a 100644
--- a/include/pbl/util/string.h
+++ b/include/pbl/util/string.h
@@ -35,8 +35,9 @@ uintptr_t str_to_address(const char *address_str);
const char *bool_to_str(bool b);
-//! @param hex 12-digit hex string representing a BT address
-//! @param addr Points to a SS1 BD_ADDR_t as defined in BTBTypes.h
+//! @param hex_str 12-digit hex string representing a BT address
+//! @param bd_addr Points to a SS1 BD_ADDR_t as defined in BTBTypes.h
+//! @param bd_addr_size Size of the bd_addr buffer, in bytes
//! @return True on success
bool convert_bt_addr_hex_str_to_bd_addr(const char *hex_str, uint8_t *bd_addr, const unsigned int bd_addr_size);
diff --git a/include/pebbleos/cron.h b/include/pebbleos/cron.h
index 6b9d2f6e08..a5c553e117 100644
--- a/include/pebbleos/cron.h
+++ b/include/pebbleos/cron.h
@@ -90,7 +90,7 @@ struct CronJob {
//! Add a cron job. This will make the service hold a reference to the specified job, so it must
//! not leave scope or be destroyed until it is unscheduled.
//! The job only gets scheduled once. For re-scheduling, you can call this on the job again.
-//! @params job pointer to the CronJob struct to be scheduled.
+//! @param job pointer to the CronJob struct to be scheduled.
//! @returns time_t for when the job is destined to go off.
time_t cron_job_schedule(CronJob *job);
@@ -98,7 +98,7 @@ time_t cron_job_schedule(CronJob *job);
//! This will make the service hold a reference to the new job, so it must
//! not leave scope or be destroyed until it is unscheduled.
//! @param job pointer to the CronJob after which we want our job to run. job must be scheduled.
-//! @params new_job pointer to the CronJob struct to be scheduled. new_job must be unscheduled.
+//! @param new_job pointer to the CronJob struct to be scheduled. new_job must be unscheduled.
//! @returns time_t for when the job is destined to go off.
//! @note This API makes no guarantee that the two jobs will be scheduled back to back,
//! only that new_job will have the same scheduled time as job and that it will trigger
@@ -106,23 +106,23 @@ time_t cron_job_schedule(CronJob *job);
time_t cron_job_schedule_after(CronJob *new_job, CronJob *job);
//! Remove a scheduled cron job.
-//! @params job pointer to the CronJob struct to be unscheduled.
+//! @param job pointer to the CronJob struct to be unscheduled.
//! @return true if the job was successfully removed (false may indicate no job was
//! scheduled at all or the cb is currently executing)
bool cron_job_unschedule(CronJob *job);
//! Check if a cron job is scheduled.
-//! @params job pointer to the CronJob struct to be checked for being scheduled.
+//! @param job pointer to the CronJob struct to be checked for being scheduled.
//! @returns true if scheduled or pending deletion, false otherwise
bool cron_job_is_scheduled(CronJob *job);
//! Calculate cron job's destined execution time, from the current time.
-//! @params job pointer to the CronJob struct to get the execution time for.
+//! @param job pointer to the CronJob struct to get the execution time for.
//! @returns time_t for when the job is destined to go off.
time_t cron_job_get_execute_time(const CronJob *job);
//! Calculate cron job's destined execution time if it were scheduled at the given time.
-//! @params job pointer to the CronJob struct to get the execution time for.
-//! @params local_epoch the epoch for getting the job's execution time.
+//! @param job pointer to the CronJob struct to get the execution time for.
+//! @param local_epoch the epoch for getting the job's execution time.
//! @returns time_t for when the job is destined to go off.
time_t cron_job_get_execute_time_from_epoch(const CronJob *job, time_t local_epoch);
diff --git a/lib/btutil/wscript_build b/lib/btutil/wscript_build
index 9d9fc9b9e9..9331f8785d 100644
--- a/lib/btutil/wscript_build
+++ b/lib/btutil/wscript_build
@@ -3,7 +3,7 @@ import tools.waf
bld.stlib(source=bld.path.ant_glob('**/*.c'),
target='libbtutil',
includes=['.'],
- use=['pblibc_includes', 'pbl_includes'],
+ use=['pbl_includes'],
env=bld.env.derive())
# vim:filetype=python
diff --git a/lib/c/Kconfig b/lib/c/Kconfig
index 6c2b25ecdb..28400353d5 100644
--- a/lib/c/Kconfig
+++ b/lib/c/Kconfig
@@ -5,16 +5,10 @@ menu "C library"
choice
prompt "C library"
- default LIBC_PEBBLE
+ default LIBC_PICOLIBC
help
Which C library the firmware links against.
-config LIBC_PEBBLE
- bool "Pebble (in-tree)"
- help
- The small in-tree C library (lib/c/pebble). Hand-written string,
- math and printf tuned for the firmware; links with -nostdlib.
-
config LIBC_NEWLIB
bool "Newlib (full)"
help
diff --git a/src/fw/assert.c b/lib/c/assert.c
similarity index 90%
rename from src/fw/assert.c
rename to lib/c/assert.c
index b43fb51b3f..66b73abdc6 100644
--- a/src/fw/assert.c
+++ b/lib/c/assert.c
@@ -1,7 +1,7 @@
/* SPDX-FileCopyrightText: 2025 Google LLC */
/* SPDX-License-Identifier: Apache-2.0 */
-#include "system/logging.h"
+#include
#include "system/passert.h"
void __assert_func(const char *file, int line, const char *func, const char *e) {
diff --git a/lib/c/newlib/vsnprintf.c b/lib/c/newlib/vsnprintf.c
index 417a4d26cd..a867f7b375 100644
--- a/lib/c/newlib/vsnprintf.c
+++ b/lib/c/newlib/vsnprintf.c
@@ -121,7 +121,6 @@
#include
#include
-// pblibc_private.h was UNITTEST-only; not needed here.
// Not using 64-bit division for Dialog Bluetooth. This saves *gobs* of memory.
#ifdef ARCH_NO_NATIVE_LONG_DIVIDE
diff --git a/lib/c/pebble/LICENSE b/lib/c/pebble/LICENSE
deleted file mode 100644
index 0e6a28c404..0000000000
--- a/lib/c/pebble/LICENSE
+++ /dev/null
@@ -1,16 +0,0 @@
-Copyright Patrick Powell 1995
-
-This code is based on code written by Patrick Powell (papowell@astart.com)
-It may be used for any purpose as long as this notice remains intact on all
-source code distributions
-
-Copyright (c) 2008 Holger Weiss.
-
-This version of the code is maintained by Holger Weiss .
-My changes to the code may freely be used, modified and/or redistributed for
-any purpose. It would be nice if additions and fixes to this file (including
-trivial code cleanups) would be sent back in order to let me include them in
-the version available at .
-However, this is not a requirement for using or redistributing (possibly
-modified) versions of this file, nor is leaving this notice intact mandatory.
-
diff --git a/lib/c/pebble/alloca.c b/lib/c/pebble/alloca.c
deleted file mode 100644
index 78b6a6cba7..0000000000
--- a/lib/c/pebble/alloca.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#include
-
-# define __alloca(size) __builtin_alloca (size)
-
-void *alloca(size_t size) {
- /* This never worked to begin with, so let's at least make it obvious when
- * someone calls it (while we shut up the compiler warning). */
- while (1);
- /*return __alloca(size);*/
-}
diff --git a/lib/c/pebble/ctype_ptr.c b/lib/c/pebble/ctype_ptr.c
deleted file mode 100644
index 1d1809c63a..0000000000
--- a/lib/c/pebble/ctype_ptr.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-///////////////////////////////////////
-// Implements: (sorta)
-// int isalpha(int c);
-// int isupper(int c);
-// int islower(int c);
-// int isdigit(int c);
-// int isxdigit(int c);
-// int isspace(int c);
-// int ispunct(int c);
-// int isalnum(int c);
-// int isprint(int c);
-// int isgraph(int c);
-// int iscntrl(int c);
-// int isascii(int c);
-
-#if UNITTEST
-# include
-#else
-# include
-#endif
-
-// Ordered for unsigned char
-#if !UNITTEST
-__attribute__((__externally_visible__))
-#endif
-const unsigned char __ctype_data[256] = {
- // ASCII set
- // These values can't change. Look at ctype.h for information on these macros.
-// +00 +01 +02 +03 +04 +05 +06 +07
- _CCT, _CCT, _CCT, _CCT, _CCT, _CCT, _CCT, _CCT, // 00
- _CCT, _CCT|_CSP, _CCT|_CSP, _CCT|_CSP, _CCT|_CSP, _CCT|_CSP, _CCT, _CCT, // 08
- _CCT, _CCT, _CCT, _CCT, _CCT, _CCT, _CCT, _CCT, // 10
- _CCT, _CCT, _CCT, _CCT, _CCT, _CCT, _CCT, _CCT, // 18
- _CSP|_CPR, _CPU, _CPU, _CPU, _CPU, _CPU, _CPU, _CPU, // 20
- _CPU, _CPU, _CPU, _CPU, _CPU, _CPU, _CPU, _CPU, // 28
- _CNU, _CNU, _CNU, _CNU, _CNU, _CNU, _CNU, _CNU, // 30
- _CNU, _CNU, _CPU, _CPU, _CPU, _CPU, _CPU, _CPU, // 38
- _CPU, _CUP|_CHX, _CUP|_CHX, _CUP|_CHX, _CUP|_CHX, _CUP|_CHX, _CUP|_CHX, _CUP, // 40
- _CUP, _CUP, _CUP, _CUP, _CUP, _CUP, _CUP, _CUP, // 48
- _CUP, _CUP, _CUP, _CUP, _CUP, _CUP, _CUP, _CUP, // 50
- _CUP, _CUP, _CUP, _CPU, _CPU, _CPU, _CPU, _CPU, // 58
- _CPU, _CLO|_CHX, _CLO|_CHX, _CLO|_CHX, _CLO|_CHX, _CLO|_CHX, _CLO|_CHX, _CLO, // 60
- _CLO, _CLO, _CLO, _CLO, _CLO, _CLO, _CLO, _CLO, // 68
- _CLO, _CLO, _CLO, _CLO, _CLO, _CLO, _CLO, _CLO, // 70
- _CLO, _CLO, _CLO, _CPU, _CPU, _CPU, _CPU, _CCT, // 78
- // Non-ASCII set
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
-};
diff --git a/lib/c/pebble/include/_ansi.h b/lib/c/pebble/include/_ansi.h
deleted file mode 100644
index 9ccd124a6d..0000000000
--- a/lib/c/pebble/include/_ansi.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-// this is all magic necessary for pre-ansi compatible code
-
-#define _PTR void *
-#define _AND ,
-#define _NOARGS void
-#define _CONST const
-#define _VOLATILE volatile
-#define _SIGNED signed
-#define _DOTS , ...
-#define _VOID void
-
-#define _EXFUN(name, proto) name proto
-#define _EXPARM(name, proto) (* name) proto
-
-#define _DEFUN(name, arglist, args) name(args)
-#define _DEFUN_VOID(name) name(_NOARGS)
-#define _CAST_VOID (void)
-#ifndef _LONG_DOUBLE
-#define _LONG_DOUBLE long double
-#endif
-#ifndef _PARAMS
-#define _PARAMS(paramlist) paramlist
-#endif
diff --git a/lib/c/pebble/include/alloca.h b/lib/c/pebble/include/alloca.h
deleted file mode 100644
index 17f297cbac..0000000000
--- a/lib/c/pebble/include/alloca.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-#include
-
-void *alloca(size_t size);
diff --git a/lib/c/pebble/include/ctype.h b/lib/c/pebble/include/ctype.h
deleted file mode 100644
index aa357c5377..0000000000
--- a/lib/c/pebble/include/ctype.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-// Casts to int ensure that the return value is int, as spec indicates
-
-// Uppercase
-#define _CUP (1 << 0)
-// Lowercase
-#define _CLO (1 << 1)
-// Number
-#define _CNU (1 << 2)
-// Space
-#define _CSP (1 << 3)
-// Punctuation
-#define _CPU (1 << 4)
-// Control
-#define _CCT (1 << 5)
-// Printable (only for ' ')
-#define _CPR (1 << 6)
-// Hex character
-#define _CHX (1 << 7)
-
-// ctype flag table for all char values
-extern const unsigned char __ctype_data[256];
-
-// Cast to unsigned char to prevent overflow and to map signed char to our range.
-// This lets us cut out 128 bytes of data from __ctype_data
-#define __ctype_get(C) (__ctype_data[(unsigned char)(C)])
-#define __ctype_check(C, FLG) ((int)(__ctype_get(C) & (FLG)))
-
-#define isalpha(C) __ctype_check(C, _CUP|_CLO)
-#define isupper(C) __ctype_check(C, _CUP)
-#define islower(C) __ctype_check(C, _CLO)
-#define isdigit(C) __ctype_check(C, _CNU)
-#define isxdigit(C) __ctype_check(C, _CHX|_CNU)
-#define isspace(C) __ctype_check(C, _CSP)
-#define ispunct(C) __ctype_check(C, _CPU)
-#define isalnum(C) __ctype_check(C, _CUP|_CLO|_CNU)
-#define isprint(C) __ctype_check(C, _CUP|_CLO|_CNU|_CPU|_CPR)
-#define isgraph(C) __ctype_check(C, _CUP|_CLO|_CNU|_CPU)
-#define iscntrl(C) __ctype_check(C, _CCT)
-
-#define isascii(C) ((int)(((unsigned char)(C)) < 0x80))
-#define toascii(C) ((int)(((unsigned char)(C)) & 0x7F))
-
-// __typeof__ use is to prevent double-evaluation
-#define toupper(C) \
- ({ __typeof__(C) X = (C); \
- islower(X) ? (int)X - 'a' + 'A' : (int)X; })
-
-#define tolower(C) \
- ({ __typeof__(C) X = (C); \
- isupper(X) ? (int)X - 'A' + 'a' : (int)X; })
diff --git a/lib/c/pebble/include/float.h b/lib/c/pebble/include/float.h
deleted file mode 100644
index 0f126c300c..0000000000
--- a/lib/c/pebble/include/float.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* SPDX-FileCopyrightText: 2025 Apache Software Foundation (ASF) */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-#ifndef FLT_EPSILON /* May be defined in toolchain header */
-# define FLT_EPSILON 1.1920929e-07F /* 1E-5 */
-#endif
-
-#ifndef DBL_EPSILON /* May be defined in toolchain header */
-# define DBL_EPSILON 2.2204460492503131e-16 /* smallest double such that 1.0 + DBL_EPSILON != 1.0 */
-#endif
-
-#ifndef DBL_DIG /* May be defined in toolchain header */
-# define DBL_DIG 15 /* number of decimal digits of precision for double */
-#endif
-
-#ifndef DBL_MAX /* May be defined in toolchain header */
-# define DBL_MAX 1.7976931348623157e+308 /* max finite value of a double */
-#endif
-
-#ifndef DBL_MAX_10_EXP /* May be defined in toolchain header */
-# define DBL_MAX_10_EXP 308 /* max decimal exponent of a double */
-#endif
-
-#ifndef DBL_MAX_EXP /* May be defined in toolchain header */
-# define DBL_MAX_EXP 1024 /* max binary exponent of a double */
-#endif
-
-#ifndef FLT_RADIX /* May be defined in toolchain header */
-# define FLT_RADIX 2 /* radix of exponent representation */
-#endif
-
-#ifndef FLT_EVAL_METHOD /* May be defined in toolchain header */
-# define FLT_EVAL_METHOD 0 /* evaluate all operations just to the range and precision of the type */
-#endif
\ No newline at end of file
diff --git a/lib/c/pebble/include/inttypes.h b/lib/c/pebble/include/inttypes.h
deleted file mode 100644
index df4680eedb..0000000000
--- a/lib/c/pebble/include/inttypes.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-#include
-
-// There's no way to check this from the preprocessor, and this header isn't freestanding, so...
-// If we ever upgrade GCC, we may need to re-evaluate these two.
-// You can check the types by running `arm-none-eabi-gcc -dM -E -
-
-// We use newlib's order because why not and it'll make us more compatible.
-#ifndef LC_ALL
-# define LC_ALL 0
-#endif
-#ifndef LC_COLLATE
-# define LC_COLLATE 1
-#endif
-#ifndef LC_CTYPE
-# define LC_CTYPE 2
-#endif
-#ifndef LC_MONETARY
-# define LC_MONETARY 3
-#endif
-#ifndef LC_NUMERIC
-# define LC_NUMERIC 4
-#endif
-#ifndef LC_TIME
-# define LC_TIME 5
-#endif
-#ifndef LC_MESSAGES
-# define LC_MESSAGES 6
-#endif
-
-struct lconv {
- char *decimal_point;
- char *thousands_sep;
- char *grouping;
- char *int_curr_symbol;
- char *currency_symbol;
- char *mon_decimal_point;
- char *mon_thousands_sep;
- char *mon_grouping;
- char *positive_sign;
- char *negative_sign;
- char int_frac_digits;
- char frac_digits;
- char p_cs_precedes;
- char p_sep_by_space;
- char n_cs_precedes;
- char n_sep_by_space;
- char p_sign_posn;
- char n_sign_posn;
- char int_n_cs_precedes;
- char int_n_sep_by_space;
- char int_n_sign_posn;
- char int_p_cs_precedes;
- char int_p_sep_by_space;
- char int_p_sign_posn;
-};
-
-char *setlocale(int category, const char *locale);
diff --git a/lib/c/pebble/include/math.h b/lib/c/pebble/include/math.h
deleted file mode 100644
index b87cfec965..0000000000
--- a/lib/c/pebble/include/math.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-FileCopyrightText: 2025 Apache Software Foundation (ASF) */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-#ifndef _HUGE_ENUF
-# define _HUGE_ENUF (1e+300) /* _HUGE_ENUF*_HUGE_ENUF must overflow */
-#endif
-
-#define INFINITY ((double)(_HUGE_ENUF * _HUGE_ENUF))
-#define NAN ((double)(INFINITY * 0.0F))
-
-#define INFINITY_F ((float)INFINITY)
-#define NAN_F ((float)(INFINITY * 0.0F))
-
-#define M_E 2.7182818284590452353602874713526625
-#define M_LN2 0.69314718055994530941723212145817657
-#define M_LN10 2.3025850929940456840179914546843642
-#define M_PI 3.1415926535897932384626433832795029
-#define M_PI_2 1.5707963267948966192313216916397514
-
-typedef float float_t;
-
-typedef double double_t;
-
-#define FP_NAN 0
-#define FP_INFINITE 1
-#define FP_ZERO 2
-#define FP_SUBNORMAL 3
-#define FP_NORMAL 4
-
-#define fpclassify(x) __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, \
- FP_SUBNORMAL, FP_ZERO, (x))
-
-#define isfinite(x) __builtin_isfinite(x)
-#define isnormal(x) __builtin_isnormal(x)
-#define isinf(x) (((x) == INFINITY) || ((x) == -INFINITY))
-#define isinff(x) (((x) == INFINITY_F) || ((x) == -INFINITY_F))
-#define isnan(x) ((x) != (x))
-#define isnanf(x) ((x) != (x))
-
-double asin(double x);
-
-double atan(double x);
-
-double ceil(double x);
-
-float ceilf(float x);
-
-double cos(double x);
-
-double copysign(double x, double y);
-
-double exp(double x);
-
-float expf(float x);
-
-double fabs(double x);
-
-float fabsf(float x);
-
-long double fabsl(long double x);
-
-double floor(double x);
-
-float floorf(float x);
-
-float fmaxf(float x, float y);
-
-float fminf(float x, float y);
-
-double fmod(double x, double div);
-
-double log(double x);
-
-double log2(double x);
-
-float logf(float x);
-
-float log10f(float x);
-
-double modf(double x, double *iptr);
-
-float modff(float x, float *iptr);
-
-double nearbyint(double x);
-
-double round(double d);
-
-float roundf(float x);
-
-double sin(double x);
-
-double sqrt(double x);
-
-float tanhf(float x);
-
-#define signbit(x) __builtin_signbit(x)
\ No newline at end of file
diff --git a/lib/c/pebble/include/setjmp.h b/lib/c/pebble/include/setjmp.h
deleted file mode 100644
index b87eceb1cd..0000000000
--- a/lib/c/pebble/include/setjmp.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-///////////////////////////////////////
-// Notes:
-// This is entirely non-portable. It will need to be rewritten if we stop using ARM.
-// Unfortunately, there is no portable way to define these.
-// This means unit tests can't use our setjmp/longjmp either.
-
-#pragma once
-
-#if __arm__
-// On ARM at least, GPRs are longs
-// This still holds on A64.
-struct __jmp_buf_struct {
- long r4, r5, r6, r7, r8, r9, sl, fp, sp, lr;
-// Using real FPU
-#if defined(__VFP_FP__) && !defined(__SOFTFP__)
- // FPU registers are still 32bit on A64 though, so they're ints
- int s[16]; /* s16~s31 */
- int fpscr;
-#endif
-};
-typedef struct __jmp_buf_struct jmp_buf[1];
-
-int setjmp(jmp_buf env);
-void longjmp(jmp_buf buf, int value) __attribute__((noreturn));
-#else
-// other implementations either use system setjmp or don't have it.
-# include_next
-#endif
diff --git a/lib/c/pebble/include/stdio.h b/lib/c/pebble/include/stdio.h
deleted file mode 100644
index 671aae4f6f..0000000000
--- a/lib/c/pebble/include/stdio.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-#define __need_size_t
-#define __need_NULL
-#include
-
-#define __need___va_list
-#include
-
-typedef struct {
-} FILE;
-
-extern FILE *stderr;
-
-// stdio.h isn't supposed to define va_list, so _need___va_list gives us __gnuc_va_list
-// Let's define that to something less compiler-specific
-#define __VA_LIST __gnuc_va_list
-
-int fprintf(FILE *__restrict stream, const char *__restrict format, ...)
- __attribute__((__format__(__printf__, 2, 3)));
-int printf(const char *__restrict format, ...)
- __attribute__((format (printf, 1, 2)));
-int sprintf(char * restrict str, const char * restrict format, ...)
- __attribute__((__format__(__printf__, 2, 3)));
-int snprintf(char * restrict str, size_t size, const char * restrict format, ...)
- __attribute__((__format__(__printf__, 3, 4)));
-int vprintf(const char *__restrict format, __VA_LIST ap)
- __attribute__((__format__(__printf__, 1, 0)));
-int vsprintf(char * restrict str, const char * restrict format, __VA_LIST ap)
- __attribute__((__format__(__printf__, 2, 0)));
-int vsnprintf(char * restrict str, size_t size, const char * restrict format, __VA_LIST ap)
- __attribute__((__format__(__printf__, 3, 0)));
-
-#if !UNITTEST
-#define sniprintf snprintf
-#define vsniprintf vsnprintf
-#endif
diff --git a/lib/c/pebble/include/stdlib.h b/lib/c/pebble/include/stdlib.h
deleted file mode 100644
index 779497d80f..0000000000
--- a/lib/c/pebble/include/stdlib.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-#endif
-
-// It's an int.
-#ifndef RAND_MAX
-# define RAND_MAX (0x7FFFFFFFL)
-#endif
-
-#define __need_size_t
-#define __need_NULL
-#include
-
-
-int abs(int j) __attribute__((__const__));
-long labs(long j) __attribute__((__const__));
-
-#if __clang__
-// Default builtins break the clang build for some reason,
-// and we don't have a real implementation of these functions
-#define abs(x) __builtin_abs(x)
-#define labs(x) __builtin_labs(x)
-#endif
-
-int atoi(const char *nptr) __attribute__((__pure__));
-long int atol(const char *nptr) __attribute__((__pure__));
-long int strtol(const char * restrict nptr, char ** restrict endptr, int base);
-
-// Implemented in src/fw/util/rand/rand.c
-int rand(void);
-int rand_r(unsigned *seed);
-void srand(unsigned seed);
-
-void exit(int status) __attribute__((noreturn));
-
-// Not implemented, but included in the header to build the default platform.c of libs.
-void free(void *ptr);
-void *malloc(size_t bytes);
-
-long jrand48(unsigned short int s[3]);
diff --git a/lib/c/pebble/include/string.h b/lib/c/pebble/include/string.h
deleted file mode 100644
index 970f46069e..0000000000
--- a/lib/c/pebble/include/string.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-#define __need_size_t
-#define __need_NULL
-#include
-
-int memcmp(const void *s1, const void *s2, size_t n);
-void *memcpy(void * restrict s1, const void * restrict s2, size_t n);
-void *memmove(void *s1, const void *s2, size_t n);
-void *memset(void *s, int c, size_t n);
-void *memchr(const void *s, int c, size_t n);
-char *strcat(char * restrict s1, const char * restrict s2);
-char *strncat(char * restrict s1, const char * restrict s2, size_t n);
-size_t strlen(const char *s);
-size_t strnlen(const char *s, size_t maxlen);
-char *strcpy(char * restrict s1, const char * restrict s2);
-char *strncpy(char * restrict s1, const char * restrict s2, size_t n);
-int strcmp(const char *s1, const char *s2);
-int strncmp(const char *s1, const char *s2, size_t n);
-char *strchr(const char *s, int c);
-char *strrchr(const char *s, int c);
-size_t strcspn(const char *s1, const char *s2);
-size_t strspn(const char *s1, const char *s2);
-char *strstr(const char *s1, const char *s2);
-
-int atoi(const char *nptr) __attribute__((__pure__));
-long int atol(const char *nptr) __attribute__((__pure__));
-long int strtol(const char * restrict nptr, char ** restrict endptr, int base);
-unsigned long int strtoul(const char * restrict nptr, char ** restrict endptr, int base);
-
-char *itoa(int value, char *str, int base);
diff --git a/lib/c/pebble/include/sys/cdefs.h b/lib/c/pebble/include/sys/cdefs.h
deleted file mode 100644
index 436976e4b4..0000000000
--- a/lib/c/pebble/include/sys/cdefs.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-#if defined(__cplusplus)
-#define __BEGIN_DECLS extern "C" {
-#define __END_DECLS };
-#else
-#define __BEGIN_DECLS
-#define __END_DECLS
-#endif
-
-#define __P(protos) protos
-#define __CONCAT(x, y) x ## y
-#define __STRING(x) #x
diff --git a/lib/c/pebble/include/sys/stat.h b/lib/c/pebble/include/sys/stat.h
deleted file mode 100644
index fa1749fa5e..0000000000
--- a/lib/c/pebble/include/sys/stat.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-// stub
diff --git a/lib/c/pebble/include/sys/types.h b/lib/c/pebble/include/sys/types.h
deleted file mode 100644
index 53cf796f4e..0000000000
--- a/lib/c/pebble/include/sys/types.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-#define __need_size_t
-#include
-
-// Cheap trick to make __SIZE_TYPE__ give an unsigned version
-#define unsigned signed
-typedef __SIZE_TYPE__ ssize_t;
-#undef unsigned
-
-typedef signed long int time_t;
-
-typedef ssize_t off_t;
diff --git a/lib/c/pebble/include/unistd.h b/lib/c/pebble/include/unistd.h
deleted file mode 100644
index fa1749fa5e..0000000000
--- a/lib/c/pebble/include/unistd.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-// stub
diff --git a/lib/c/pebble/include/wchar.h b/lib/c/pebble/include/wchar.h
deleted file mode 100644
index fa1749fa5e..0000000000
--- a/lib/c/pebble/include/wchar.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-// stub
diff --git a/lib/c/pebble/include/wctype.h b/lib/c/pebble/include/wctype.h
deleted file mode 100644
index fa1749fa5e..0000000000
--- a/lib/c/pebble/include/wctype.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-// stub
diff --git a/lib/c/pebble/math/LICENSE b/lib/c/pebble/math/LICENSE
deleted file mode 100644
index d47ab9a5b8..0000000000
--- a/lib/c/pebble/math/LICENSE
+++ /dev/null
@@ -1,6 +0,0 @@
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunSoft, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
\ No newline at end of file
diff --git a/lib/c/pebble/math/floor.c b/lib/c/pebble/math/floor.c
deleted file mode 100644
index 4344363b1f..0000000000
--- a/lib/c/pebble/math/floor.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-///////////////////////////////////////
-// Implements:
-// double floor(double x);
-
-#include
-#include
-#include
-
-#include
-
-// TODO: PBL-36144 replace this naive implementation with __builtin_floor()
-
-#ifndef NAN
-#define NAN (0.0/0.0)
-#endif
-
-#ifndef INFINITY
-#define INFINITY (1.0/0.0)
-#endif
-
-#ifndef isinf
-#define isinf(y) (__builtin_isinf(y))
-#endif
-
-#ifndef isnan
-#define isnan(y) (__builtin_isnan(y))
-#endif
-
-
-double floor(double x) {
- if (isnan(x)) {
- return NAN;
- }
- if (isinf(x)) {
- return INFINITY;
- }
-
- const int64_t x_int = (int64_t)x;
- const bool has_no_fraction = (double)x_int == x;
- return (double)((x >= 0 || has_no_fraction) ? x_int : x_int - 1);
-}
diff --git a/lib/c/pebble/math/libc-nuttx/asin.c b/lib/c/pebble/math/libc-nuttx/asin.c
deleted file mode 100644
index a76e4fed26..0000000000
--- a/lib/c/pebble/math/libc-nuttx/asin.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_asin.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2015-2016 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#undef DBL_EPSILON
-#define DBL_EPSILON 1e-12
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/* This lib uses Newton's method to approximate asin(x). Newton's Method
- * converges very slowly for x close to 1. We can accelerate convergence
- * with the following identy: asin(x)=Sign(x)*(Pi/2-asin(sqrt(1-x^2)))
- */
-
-static double asin_aux(double x)
-{
- long double y;
- double y_cos;
- double y_sin;
-
- y = 0.0;
- y_sin = 0.0;
-
- while (fabs(y_sin - x) > DBL_EPSILON)
- {
- y_cos = cos(y);
- y -= ((long double)y_sin - (long double)x) / (long double)y_cos;
- y_sin = sin(y);
- }
-
- return y;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double asin(double x)
-{
- double y;
-
- /* Verify that the input value is in the domain of the function */
-
- if (x < -1.0 || x > 1.0 || isnan(x))
- {
- return NAN;
- }
-
- /* if x is > sqrt(2), use identity for faster convergence */
-
- if (fabs(x) > 0.71)
- {
- y = M_PI_2 - asin_aux(sqrt(1.0 - x * x));
- y = copysign(y, x);
- }
- else
- {
- y = asin_aux(x);
- }
-
- return y;
-}
diff --git a/lib/c/pebble/math/libc-nuttx/atan.c b/lib/c/pebble/math/libc-nuttx/atan.c
deleted file mode 100644
index ed23221b7f..0000000000
--- a/lib/c/pebble/math/libc-nuttx/atan.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_atan.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009, 2010 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double atan(double x)
-{
- return asin(x / sqrt(x * x + 1));
-}
diff --git a/lib/c/pebble/math/libc-nuttx/ceil.c b/lib/c/pebble/math/libc-nuttx/ceil.c
deleted file mode 100644
index cb3c512b92..0000000000
--- a/lib/c/pebble/math/libc-nuttx/ceil.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_ceil.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double ceil(double x)
-{
- double x1 = x;
-
- modf(x, &x);
- if (x1 > 0.0 && fabs(x1 - x) > 0.0)
- {
- x += 1.0;
- }
-
- return x;
-}
diff --git a/lib/c/pebble/math/libc-nuttx/ceilf.c b/lib/c/pebble/math/libc-nuttx/ceilf.c
deleted file mode 100644
index da5570809d..0000000000
--- a/lib/c/pebble/math/libc-nuttx/ceilf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_ceilf.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float ceilf(float x)
-{
- float x1 = x;
-
- modff(x, &x);
- if (x1 > 0.0F && fabsf(x1 - x) > 0.0F)
- {
- x += 1.0F;
- }
-
- return x;
-}
\ No newline at end of file
diff --git a/lib/c/pebble/math/libc-nuttx/copysign.c b/lib/c/pebble/math/libc-nuttx/copysign.c
deleted file mode 100644
index 15dbf51359..0000000000
--- a/lib/c/pebble/math/libc-nuttx/copysign.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_copysign.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double copysign(double x, double y)
-{
- if (signbit(y))
- {
- return -fabs(x);
- }
-
- return fabs(x);
-}
diff --git a/lib/c/pebble/math/libc-nuttx/cos.c b/lib/c/pebble/math/libc-nuttx/cos.c
deleted file mode 100644
index 5dee6c0b71..0000000000
--- a/lib/c/pebble/math/libc-nuttx/cos.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_cos.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double cos(double x)
-{
- return sin(x + M_PI_2);
-}
diff --git a/lib/c/pebble/math/libc-nuttx/exp.c b/lib/c/pebble/math/libc-nuttx/exp.c
deleted file mode 100644
index 8a841e9b1d..0000000000
--- a/lib/c/pebble/math/libc-nuttx/exp.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_exp.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-
-double lib_expi(size_t n);
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static double _dbl_inv_fact[] =
-{
- 1.0 / 1.0, /* 1 / 0! */
- 1.0 / 1.0, /* 1 / 1! */
- 1.0 / 2.0, /* 1 / 2! */
- 1.0 / 6.0, /* 1 / 3! */
- 1.0 / 24.0, /* 1 / 4! */
- 1.0 / 120.0, /* 1 / 5! */
- 1.0 / 720.0, /* 1 / 6! */
- 1.0 / 5040.0, /* 1 / 7! */
- 1.0 / 40320.0, /* 1 / 8! */
- 1.0 / 362880.0, /* 1 / 9! */
- 1.0 / 3628800.0, /* 1 / 10! */
- 1.0 / 39916800.0, /* 1 / 11! */
- 1.0 / 479001600.0, /* 1 / 12! */
- 1.0 / 6227020800.0, /* 1 / 13! */
- 1.0 / 87178291200.0, /* 1 / 14! */
- 1.0 / 1307674368000.0, /* 1 / 15! */
- 1.0 / 20922789888000.0, /* 1 / 16! */
- 1.0 / 355687428096000.0, /* 1 / 17! */
- 1.0 / 6402373705728000.0, /* 1 / 18! */
-};
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double exp(double x)
-{
- size_t int_part;
- bool invert;
- double value;
- double x0;
- size_t i;
-
- if (x == 0)
- {
- return 1;
- }
- else if (x < 0)
- {
- invert = true;
- x = -x;
- }
- else
- {
- invert = false;
- }
-
- /* Extract integer component */
-
- int_part = (size_t) x;
-
- /* Set x to fractional component */
-
- x -= (double)int_part;
-
- /* Perform Taylor series approximation with nineteen terms */
-
- value = 0.0;
- x0 = 1.0;
- for (i = 0; i < 19; i++)
- {
- value += x0 * _dbl_inv_fact[i];
- x0 *= x;
- }
-
- /* Multiply by exp of the integer component */
-
- value *= lib_expi(int_part);
-
- if (invert)
- {
- return (1.0 / value);
- }
- else
- {
- return value;
- }
-}
diff --git a/lib/c/pebble/math/libc-nuttx/expf.c b/lib/c/pebble/math/libc-nuttx/expf.c
deleted file mode 100644
index bb4ee59d3d..0000000000
--- a/lib/c/pebble/math/libc-nuttx/expf.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_expf.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-
-float lib_expif(size_t n);
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static float _flt_inv_fact[] =
-{
- 1.0 / 1.0, /* 1/0! */
- 1.0 / 1.0, /* 1/1! */
- 1.0 / 2.0, /* 1/2! */
- 1.0 / 6.0, /* 1/3! */
- 1.0 / 24.0, /* 1/4! */
- 1.0 / 120.0, /* 1/5! */
- 1.0 / 720.0, /* 1/6! */
- 1.0 / 5040.0, /* 1/7! */
- 1.0 / 40320.0, /* 1/8! */
- 1.0 / 362880.0, /* 1/9! */
- 1.0 / 3628800.0, /* 1/10! */
-};
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float expf(float x)
-{
- size_t int_part;
- bool invert;
- float value;
- float x0;
- size_t i;
-
- if (x == 0)
- {
- return 1;
- }
- else if (x < 0)
- {
- invert = true;
- x = -x;
- }
- else
- {
- invert = false;
- }
-
- /* Extract integer component */
-
- int_part = (size_t) x;
-
- /* set x to fractional component */
-
- x -= (float)int_part;
-
- /* Perform Taylor series approximation with eleven terms */
-
- value = 0.0F;
- x0 = 1.0F;
- for (i = 0; i < 10; i++)
- {
- value += x0 * _flt_inv_fact[i];
- x0 *= x;
- }
-
- /* Multiply by exp of the integer component */
-
- value *= lib_expif(int_part);
-
- if (invert)
- {
- return (1.0F / value);
- }
- else
- {
- return value;
- }
-}
\ No newline at end of file
diff --git a/lib/c/pebble/math/libc-nuttx/fabs.c b/lib/c/pebble/math/libc-nuttx/fabs.c
deleted file mode 100644
index 7da1745f37..0000000000
--- a/lib/c/pebble/math/libc-nuttx/fabs.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_fabs.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009, 2010 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double fabs(double x)
-{
- return ((x < 0) ? -x : x);
-}
diff --git a/lib/c/pebble/math/libc-nuttx/fabsf.c b/lib/c/pebble/math/libc-nuttx/fabsf.c
deleted file mode 100644
index 1b1932087d..0000000000
--- a/lib/c/pebble/math/libc-nuttx/fabsf.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_fabsf.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009, 2010 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float fabsf(float x)
-{
- return ((x < 0) ? -x : x);
-}
diff --git a/lib/c/pebble/math/libc-nuttx/fabsl.c b/lib/c/pebble/math/libc-nuttx/fabsl.c
deleted file mode 100644
index 0c0e50dfbd..0000000000
--- a/lib/c/pebble/math/libc-nuttx/fabsl.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_fabsl.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009, 2010 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-long double fabsl(long double x)
-{
- return ((x < 0) ? -x : x);
-}
diff --git a/lib/c/pebble/math/libc-nuttx/floor.c b/lib/c/pebble/math/libc-nuttx/floor.c
deleted file mode 100644
index 86aa3072a0..0000000000
--- a/lib/c/pebble/math/libc-nuttx/floor.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_floor.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double floor(double x)
-{
- double modx;
-
- /* modf() will return the integer part of X. The return value of floor
- * differs for non-integer, negative values.
- *
- * x modf floor
- * ---- ----- -----
- * 2.0 2.0 2.0
- * 2.4 2.0 2.0
- * 2.9 2.0 2.0
- * -2.7 -2.0 -3.0
- * -2.0 -2.0 -2.0
- */
-
- modf(x, &modx);
- if (x < 0.0 && x < modx)
- {
- modx -= 1.0;
- }
-
- return modx;
-}
diff --git a/lib/c/pebble/math/libc-nuttx/floorf.c b/lib/c/pebble/math/libc-nuttx/floorf.c
deleted file mode 100644
index e356c85ac0..0000000000
--- a/lib/c/pebble/math/libc-nuttx/floorf.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_floorf.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float floorf(float x)
-{
- float modx;
-
- /* modf() will return the integer part of X. The return value of floor
- * differs for non-integer, negative values.
- *
- * x modff floor
- * ---- ----- -----
- * 2.0 2.0 2.0
- * 2.4 2.0 2.0
- * 2.9 2.0 2.0
- * -2.7 -2.0 -3.0
- * -2.0 -2.0 -2.0
- */
-
- modff(x, &modx);
- if (x < 0.0F && x < modx)
- {
- modx -= 1.0F;
- }
-
- return modx;
-}
\ No newline at end of file
diff --git a/lib/c/pebble/math/libc-nuttx/fmaxf.c b/lib/c/pebble/math/libc-nuttx/fmaxf.c
deleted file mode 100644
index 28082fb44c..0000000000
--- a/lib/c/pebble/math/libc-nuttx/fmaxf.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_fmaxf.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float fmaxf(float x, float y)
-{
- return ((x > y) ? x : y);
-}
\ No newline at end of file
diff --git a/lib/c/pebble/math/libc-nuttx/fminf.c b/lib/c/pebble/math/libc-nuttx/fminf.c
deleted file mode 100644
index 320c513d01..0000000000
--- a/lib/c/pebble/math/libc-nuttx/fminf.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_fminf.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float fminf(float x, float y)
-{
- return ((x < y) ? x : y);
-}
\ No newline at end of file
diff --git a/lib/c/pebble/math/libc-nuttx/fmod.c b/lib/c/pebble/math/libc-nuttx/fmod.c
deleted file mode 100644
index 9f9f23cfdb..0000000000
--- a/lib/c/pebble/math/libc-nuttx/fmod.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_fmod.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double fmod(double x, double div)
-{
- double n0;
-
- modf(x / div, &n0);
-
- return x - n0 * div;
-}
diff --git a/lib/c/pebble/math/libc-nuttx/libexpi.c b/lib/c/pebble/math/libc-nuttx/libexpi.c
deleted file mode 100644
index 4613ce6135..0000000000
--- a/lib/c/pebble/math/libc-nuttx/libexpi.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_libexpi.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define M_E2 (M_E * M_E)
-#define M_E4 (M_E2 * M_E2)
-#define M_E8 (M_E4 * M_E4)
-#define M_E16 (M_E8 * M_E8)
-#define M_E32 (M_E16 * M_E16)
-#define M_E64 (M_E32 * M_E32)
-#define M_E128 (M_E64 * M_E64)
-#define M_E256 (M_E128 * M_E128)
-#define M_E512 (M_E256 * M_E256)
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static const double g_expi_square_tbl[] =
-{
- M_E, /* e^1 */
- M_E2, /* e^2 */
- M_E4, /* e^4 */
- M_E8, /* e^8 */
- M_E16, /* e^16 */
- M_E32, /* e^32 */
- M_E64, /* e^64 */
- M_E128, /* e^128 */
- M_E256, /* e^256 */
- M_E512 /* e^512 */
-};
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double lib_expi(size_t n)
-{
- size_t i;
- double val;
-
- /* The largest calculable value for n is floor(ln(DBL_MAX)) */
-
- if (n > 709)
- {
- return INFINITY;
- }
-
- val = 1.0;
-
- for (i = 0; n != 0; i++)
- {
- if ((n & (1 << i)) != 0)
- {
- n &= ~(1 << i);
- val *= g_expi_square_tbl[i];
- }
- }
-
- return val;
-}
diff --git a/lib/c/pebble/math/libc-nuttx/libexpif.c b/lib/c/pebble/math/libc-nuttx/libexpif.c
deleted file mode 100644
index 7c15428bf8..0000000000
--- a/lib/c/pebble/math/libc-nuttx/libexpif.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_libexpif.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define M_E2 (M_E * M_E)
-#define M_E4 (M_E2 * M_E2)
-#define M_E8 (M_E4 * M_E4)
-#define M_E16 (M_E8 * M_E8)
-#define M_E32 (M_E16 * M_E16)
-#define M_E64 (M_E32 * M_E32)
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/* Values above M_E64 will never be used since it's larger than FLT_MAX
- *(3.402823e+38).
- */
-
-static const float g_expif_square_tbl[] =
-{
- (float)M_E, /* e^1 */
- (float)M_E2, /* e^2 */
- (float)M_E4, /* e^4 */
- (float)M_E8, /* e^8 */
- (float)M_E16, /* e^16 */
- (float)M_E32, /* e^32 */
- (float)M_E64 /* e^64 */
-};
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float lib_expif(size_t n)
-{
- size_t i;
- float val;
-
- /* The largest calculable value for n is floor(ln(FLT_MAX)) */
-
- if (n > 88)
- {
- return INFINITY_F;
- }
-
- val = 1.0F;
-
- for (i = 0; n != 0; i++)
- {
- if ((n & (1 << i)) != 0)
- {
- n &= ~(1 << i);
- val *= g_expif_square_tbl[i];
- }
- }
-
- return val;
-}
\ No newline at end of file
diff --git a/lib/c/pebble/math/libc-nuttx/libsqrtapprox.c b/lib/c/pebble/math/libc-nuttx/libsqrtapprox.c
deleted file mode 100644
index 035fe060f9..0000000000
--- a/lib/c/pebble/math/libc-nuttx/libsqrtapprox.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_libsqrtapprox.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float lib_sqrtapprox(float x)
-{
- union
- {
- int32_t i;
- float x;
- } u;
-
- /* Floats + bit manipulation = +inf fun! */
-
- u.x = x;
- u.i = 0x1fc00000 + (u.i >> 1);
-
- return u.x;
-}
\ No newline at end of file
diff --git a/lib/c/pebble/math/libc-nuttx/log.c b/lib/c/pebble/math/libc-nuttx/log.c
deleted file mode 100644
index a8d4484555..0000000000
--- a/lib/c/pebble/math/libc-nuttx/log.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_log.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009, 2010 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define DBL_MAX_EXP_X 700.0
-
-/* To avoid looping forever in particular corner cases, every LOG_MAX_ITER
- * the error criteria is relaxed by a factor LOG_RELAX_MULTIPLIER.
- * todo: might need to adjust the double floating point version too.
- */
-
-#define LOG_MAX_ITER 400
-#define LOG_RELAX_MULTIPLIER 2.0
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: log
- ****************************************************************************/
-
-
-double log(double x)
-{
- double y;
- double y_old;
- double ey;
- double epsilon;
- double rf; /* epsilon relax factor */
- int iter;
-
- y = 0.0;
- y_old = 1.0;
- epsilon = DBL_EPSILON;
-
- iter = 0;
- rf = 1.0;
-
- while (y > y_old + epsilon || y < y_old - epsilon)
- {
- y_old = y;
- ey = exp(y);
- y -= (ey - x) / ey;
-
- if (y > DBL_MAX_EXP_X)
- {
- y = DBL_MAX_EXP_X;
- }
-
- if (y < -DBL_MAX_EXP_X)
- {
- y = -DBL_MAX_EXP_X;
- }
-
- epsilon = ((fabs(y) > rf) ? fabs(y) : rf) * DBL_EPSILON;
-
- if (++iter >= LOG_MAX_ITER)
- {
- rf *= LOG_RELAX_MULTIPLIER;
- iter = 0;
- }
- }
-
- if (y == DBL_MAX_EXP_X)
- {
- return INFINITY;
- }
-
- if (y == -DBL_MAX_EXP_X)
- {
- return INFINITY;
- }
-
- return y;
-}
diff --git a/lib/c/pebble/math/libc-nuttx/log10f.c b/lib/c/pebble/math/libc-nuttx/log10f.c
deleted file mode 100644
index c799e3840b..0000000000
--- a/lib/c/pebble/math/libc-nuttx/log10f.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_log10f.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009, 2010 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float log10f(float x)
-{
- return (logf(x) / (float)M_LN10);
-}
diff --git a/lib/c/pebble/math/libc-nuttx/log2.c b/lib/c/pebble/math/libc-nuttx/log2.c
deleted file mode 100644
index c128522762..0000000000
--- a/lib/c/pebble/math/libc-nuttx/log2.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_log2.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009, 2010 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double log2(double x)
-{
- return (log(x) / M_LN2);
-}
diff --git a/lib/c/pebble/math/libc-nuttx/logf.c b/lib/c/pebble/math/libc-nuttx/logf.c
deleted file mode 100644
index 90060a7dd3..0000000000
--- a/lib/c/pebble/math/libc-nuttx/logf.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_logf.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009, 2010 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define FLT_MAX_EXP_X 88.0F
-
-/* To avoid looping forever in particular corner cases, every LOGF_MAX_ITER
- * the error criteria is relaxed by a factor LOGF_RELAX_MULTIPLIER.
- * todo: might need to adjust the double floating point version too.
- */
-
-#define LOGF_MAX_ITER 400
-#define LOGF_RELAX_MULTIPLIER 2.0F
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: logf
- ****************************************************************************/
-
-float logf(float x)
-{
- float y;
- float y_old;
- float ey;
- float epsilon;
- float rf; /* epsilon relax factor */
- int iter;
-
- y = 0.0F;
- y_old = 1.0F;
- epsilon = FLT_EPSILON;
-
- iter = 0;
- rf = 1.0F;
-
- while (y > y_old + epsilon || y < y_old - epsilon)
- {
- y_old = y;
- ey = expf(y);
- y -= (ey - x) / ey;
-
- if (y > FLT_MAX_EXP_X)
- {
- y = FLT_MAX_EXP_X;
- }
-
- if (y < -FLT_MAX_EXP_X)
- {
- y = -FLT_MAX_EXP_X;
- }
-
- epsilon = ((fabsf(y) > rf) ? fabsf(y) : rf) * FLT_EPSILON;
-
- if (++iter >= LOGF_MAX_ITER)
- {
- rf *= LOGF_RELAX_MULTIPLIER;
- iter = 0;
- }
- }
-
- if (y == FLT_MAX_EXP_X)
- {
- return INFINITY_F;
- }
-
- if (y == -FLT_MAX_EXP_X)
- {
- return INFINITY_F;
- }
-
- return y;
-}
\ No newline at end of file
diff --git a/lib/c/pebble/math/libc-nuttx/modf.c b/lib/c/pebble/math/libc-nuttx/modf.c
deleted file mode 100644
index 8ef61e894a..0000000000
--- a/lib/c/pebble/math/libc-nuttx/modf.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_modf.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double modf(double x, double *iptr)
-{
- if (fabs(x) >= 4503599627370496.0)
- {
- *iptr = x;
- return 0.0;
- }
- else if (fabs(x) < 1.0)
- {
- *iptr = 0.0;
- return x;
- }
- else
- {
- *iptr = (double)(int64_t)x;
- return (x - *iptr);
- }
-}
diff --git a/lib/c/pebble/math/libc-nuttx/modff.c b/lib/c/pebble/math/libc-nuttx/modff.c
deleted file mode 100644
index 1c6ede82ef..0000000000
--- a/lib/c/pebble/math/libc-nuttx/modff.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_modff.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float modff(float x, float *iptr)
-{
- if (fabsf(x) >= 8388608.0F)
- {
- *iptr = x;
- return 0.0F;
- }
- else if (fabsf(x) < 1.0F)
- {
- *iptr = 0.0F;
- return x;
- }
- else
- {
- *iptr = (float)(int)x;
- return (x - *iptr);
- }
-}
\ No newline at end of file
diff --git a/lib/c/pebble/math/libc-nuttx/roundf.c b/lib/c/pebble/math/libc-nuttx/roundf.c
deleted file mode 100644
index 4aaea456d9..0000000000
--- a/lib/c/pebble/math/libc-nuttx/roundf.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_roundf.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float roundf(float x)
-{
- float f;
-
- if (isinff(x) || isnanf(x))
- {
- return x;
- }
-
- f = modff(x, &x);
- if (x <= 0.0f && f <= -0.5f)
- {
- x -= 1.0f;
- }
-
- if (x >= 0.0f && f >= 0.5f)
- {
- x += 1.0f;
- }
-
- return x;
-}
\ No newline at end of file
diff --git a/lib/c/pebble/math/libc-nuttx/sin.c b/lib/c/pebble/math/libc-nuttx/sin.c
deleted file mode 100644
index 53fdde9e64..0000000000
--- a/lib/c/pebble/math/libc-nuttx/sin.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_sin.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static double _dbl_inv_fact[] =
-{
- 1.0 / 1.0, /* 1 / 1! */
- 1.0 / 6.0, /* 1 / 3! */
- 1.0 / 120.0, /* 1 / 5! */
- 1.0 / 5040.0, /* 1 / 7! */
- 1.0 / 362880.0, /* 1 / 9! */
- 1.0 / 39916800.0, /* 1 / 11! */
- 1.0 / 6227020800.0, /* 1 / 13! */
- 1.0 / 1307674368000.0, /* 1 / 15! */
- 1.0 / 355687428096000.0, /* 1 / 17! */
- 1.0 / 121645100408832000.0, /* 1 / 19! */
-};
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double sin(double x)
-{
- double x_squared;
- double sin_x;
- size_t i;
-
- /* Move x to [-pi, pi) */
-
- x = fmod(x, 2 * M_PI);
- if (x >= M_PI)
- {
- x -= 2 * M_PI;
- }
-
- if (x < -M_PI)
- {
- x += 2 * M_PI;
- }
-
- /* Move x to [-pi/2, pi/2) */
-
- if (x >= M_PI_2)
- {
- x = M_PI - x;
- }
-
- if (x < -M_PI_2)
- {
- x = -M_PI - x;
- }
-
- x_squared = x * x;
- sin_x = 0.0;
-
- /* Perform Taylor series approximation for sin(x) with ten terms */
-
- for (i = 0; i < 10; i++)
- {
- if (i % 2 == 0)
- {
- sin_x += x * _dbl_inv_fact[i];
- }
- else
- {
- sin_x -= x * _dbl_inv_fact[i];
- }
-
- x *= x_squared;
- }
-
- return sin_x;
-}
diff --git a/lib/c/pebble/math/libc-nuttx/sqrt.c b/lib/c/pebble/math/libc-nuttx/sqrt.c
deleted file mode 100644
index b40584fd46..0000000000
--- a/lib/c/pebble/math/libc-nuttx/sqrt.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_sqrt.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-float lib_sqrtapprox(float x);
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-double sqrt(double x)
-{
- long double y;
- long double y1;
-
- if (x < 0.0)
- {
- return NAN;
- }
-
- if (isnan(x))
- {
- return NAN;
- }
-
- if (isinf(x))
- {
- return INFINITY;
- }
-
- if (x == 0.0)
- {
- return 0.0;
- }
-
- /* Guess square root (using bit manipulation) */
-
- y = lib_sqrtapprox(x);
-
- /* Perform four iterations of approximation. This number (4) is
- * definitely optimal
- */
-
- y = 0.5 * (y + x / y);
- y = 0.5 * (y + x / y);
- y = 0.5 * (y + x / y);
- y = 0.5 * (y + x / y);
-
- /* If guess was terribe (out of range of float). Repeat approximation
- * until convergence.
- */
-
- if (y * y < x - 1.0 || y * y > x + 1.0)
- {
- y1 = -1.0;
- while (y != y1)
- {
- y1 = y;
- y = 0.5 * (y + x / y);
- }
- }
-
- return y;
-}
diff --git a/lib/c/pebble/math/libc-nuttx/sqrtf.c b/lib/c/pebble/math/libc-nuttx/sqrtf.c
deleted file mode 100644
index c9d4d04b60..0000000000
--- a/lib/c/pebble/math/libc-nuttx/sqrtf.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_sqrtf.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009-2011 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-float lib_sqrtapprox(float x);
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float sqrtf(float x)
-{
- float y;
-
- /* Filter out invalid/trivial inputs */
-
- if (x < 0.0F)
- {
- /* FIXME: errno unsupported */
- /* set_errno(EDOM); */
- return NAN_F;
- }
-
- if (isnanf(x))
- {
- return NAN_F;
- }
-
- if (isinff(x))
- {
- return INFINITY_F;
- }
-
- if (x == 0.0F)
- {
- return 0.0F;
- }
-
- /* Guess square root (using bit manipulation) */
-
- y = lib_sqrtapprox(x);
-
- /* Perform three iterations of approximation. This number (3) is
- * definitely optimal
- */
-
- y = 0.5F * (y + x / y);
- y = 0.5F * (y + x / y);
- y = 0.5F * (y + x / y);
-
- return y;
-}
\ No newline at end of file
diff --git a/lib/c/pebble/math/libc-nuttx/tanhf.c b/lib/c/pebble/math/libc-nuttx/tanhf.c
deleted file mode 100644
index 2c8585055c..0000000000
--- a/lib/c/pebble/math/libc-nuttx/tanhf.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
- * libs/libm/libm/lib_tanhf.c
- *
- * SPDX-License-Identifier: ISC
- * SPDX-FileCopyrightText: Copyright (C) 2012 Gregory Nutt.
- * SPDX-FileContributor: Ported by: Darcy Gong
- *
- * It derives from the Rhombus OS math library by Nick Johnson which has
- * a compatible, MIT-style license:
- *
- * Copyright (C) 2009, 2010 Nick Johnson
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-float tanhf(float x)
-{
- float x0 = expf(x);
- float x1 = 1.0F / x0;
-
- return ((x0 - x1) / (x0 + x1));
-}
diff --git a/lib/c/pebble/math/log.c b/lib/c/pebble/math/log.c
deleted file mode 100644
index 8931b37b06..0000000000
--- a/lib/c/pebble/math/log.c
+++ /dev/null
@@ -1,173 +0,0 @@
-///////////////////////////////////////
-// Implements:
-// double log(double x);
-///////////////////////////////////////
-// Notes:
-// This is taken from newlib.
-// @nolint
-
-#include
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#include
-
-/* __ieee754_log(x)
- * Return the logrithm of x
- *
- * Method :
- * 1. Argument Reduction: find k and f such that
- * x = 2^k * (1+f),
- * where sqrt(2)/2 < 1+f < sqrt(2) .
- *
- * 2. Approximation of log(1+f).
- * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
- * = 2s + 2/3 s**3 + 2/5 s**5 + .....,
- * = 2s + s*R
- * We use a special Reme algorithm on [0,0.1716] to generate
- * a polynomial of degree 14 to approximate R The maximum error
- * of this polynomial approximation is bounded by 2**-58.45. In
- * other words,
- * 2 4 6 8 10 12 14
- * R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s +Lg6*s +Lg7*s
- * (the values of Lg1 to Lg7 are listed in the program)
- * and
- * | 2 14 | -58.45
- * | Lg1*s +...+Lg7*s - R(z) | <= 2
- * | |
- * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.
- * In order to guarantee error in log below 1ulp, we compute log
- * by
- * log(1+f) = f - s*(f - R) (if f is not too large)
- * log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy)
- *
- * 3. Finally, log(x) = k*ln2 + log(1+f).
- * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))
- * Here ln2 is split into two floating point number:
- * ln2_hi + ln2_lo,
- * where n*ln2_hi is always exact for |n| < 2000.
- *
- * Special cases:
- * log(x) is NaN with signal if x < 0 (including -INF) ;
- * log(+INF) is +INF; log(0) is -INF with signal;
- * log(NaN) is that NaN with no signal.
- *
- * Accuracy:
- * according to an error analysis, the error is always less than
- * 1 ulp (unit in the last place).
- *
- * Constants:
- * The hexadecimal values are the intended ones for the following
- * constants. The decimal values may be used, provided that the
- * compiler will convert from decimal to binary accurately enough
- * to produce the hexadecimal values shown.
- */
-
-static const double
-ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */
-ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */
-two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */
-Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */
-Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
-Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */
-Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */
-Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */
-Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
-Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
-
-static const double zero = 0.0;
-
-typedef union
-{
- double value;
- struct
- {
- uint32_t lsw;
- uint32_t msw;
- } parts;
-} ieee_double_shape_type;
-
-#define EXTRACT_WORDS(ix0,ix1,d) \
-do { \
- ieee_double_shape_type ew_u; \
- ew_u.value = (d); \
- (ix0) = ew_u.parts.msw; \
- (ix1) = ew_u.parts.lsw; \
-} while (0)
-
-/* Get the more significant 32 bit int from a double. */
-
-#define GET_HIGH_WORD(i,d) \
-do { \
- ieee_double_shape_type gh_u; \
- gh_u.value = (d); \
- (i) = gh_u.parts.msw; \
-} while (0)
-
-/* Set the more significant 32 bits of a double from an int. */
-
-#define SET_HIGH_WORD(d,v) \
-do { \
- ieee_double_shape_type sh_u; \
- sh_u.value = (d); \
- sh_u.parts.msw = (v); \
- (d) = sh_u.value; \
-} while (0)
-
-double log(double x)
-{
- double hfsq,f,s,z,R,w,t1,t2,dk;
- int32_t k,hx,i,j;
- uint32_t lx;
-
- EXTRACT_WORDS(hx,lx,x);
-
- k=0;
- if (hx < 0x00100000) { /* x < 2**-1022 */
- if (((hx&0x7fffffff)|lx)==0)
- return -two54/zero; /* log(+-0)=-inf */
- if (hx<0) return (x-x)/zero; /* log(-#) = NaN */
- k -= 54; x *= two54; /* subnormal number, scale up x */
- GET_HIGH_WORD(hx,x);
- }
- if (hx >= 0x7ff00000) return x+x;
- k += (hx>>20)-1023;
- hx &= 0x000fffff;
- i = (hx+0x95f64)&0x100000;
- SET_HIGH_WORD(x,hx|(i^0x3ff00000)); /* normalize x or x/2 */
- k += (i>>20);
- f = x-1.0;
- if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */
- if(f==zero) { if(k==0) return zero; else {dk=(double)k;
- return dk*ln2_hi+dk*ln2_lo;}}
- R = f*f*(0.5-0.33333333333333333*f);
- if(k==0) return f-R; else {dk=(double)k;
- return dk*ln2_hi-((R-dk*ln2_lo)-f);}
- }
- s = f/(2.0+f);
- dk = (double)k;
- z = s*s;
- i = hx-0x6147a;
- w = z*z;
- j = 0x6b851-hx;
- t1= w*(Lg2+w*(Lg4+w*Lg6));
- t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7)));
- i |= j;
- R = t2+t1;
- if(i>0) {
- hfsq=0.5*f*f;
- if(k==0) return f-(hfsq-s*(hfsq+R)); else
- return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f);
- } else {
- if(k==0) return f-s*(f-R); else
- return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f);
- }
-}
diff --git a/lib/c/pebble/math/pow.c b/lib/c/pebble/math/pow.c
deleted file mode 100644
index 5181dd1731..0000000000
--- a/lib/c/pebble/math/pow.c
+++ /dev/null
@@ -1,364 +0,0 @@
-///////////////////////////////////////
-// Implements:
-// double pow(double x, double y);
-///////////////////////////////////////
-// Notes:
-// This is taken from newlib.
-// @nolint
-
-/*
- * ====================================================
- * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#include
-#include
-
-/* __ieee754_pow(x,y) return x**y
- *
- * n
- * Method: Let x = 2 * (1+f)
- * 1. Compute and return log2(x) in two pieces:
- * log2(x) = w1 + w2,
- * where w1 has 53-24 = 29 bit trailing zeros.
- * 2. Perform y*log2(x) = n+y' by simulating multi-precision
- * arithmetic, where |y'|<=0.5.
- * 3. Return x**y = 2**n*exp(y'*log2)
- *
- * Special cases:
- * 1. (anything) ** 0 is 1
- * 2. (anything) ** 1 is itself
- * 3a. (anything) ** NAN is NAN except
- * 3b. +1 ** NAN is 1
- * 4. NAN ** (anything except 0) is NAN
- * 5. +-(|x| > 1) ** +INF is +INF
- * 6. +-(|x| > 1) ** -INF is +0
- * 7. +-(|x| < 1) ** +INF is +0
- * 8. +-(|x| < 1) ** -INF is +INF
- * 9. +-1 ** +-INF is 1
- * 10. +0 ** (+anything except 0, NAN) is +0
- * 11. -0 ** (+anything except 0, NAN, odd integer) is +0
- * 12. +0 ** (-anything except 0, NAN) is +INF
- * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF
- * 14. -0 ** (odd integer) = -( +0 ** (odd integer) )
- * 15. +INF ** (+anything except 0,NAN) is +INF
- * 16. +INF ** (-anything except 0,NAN) is +0
- * 17. -INF ** (anything) = -0 ** (-anything)
- * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)
- * 19. (-anything except 0 and inf) ** (non-integer) is NAN
- *
- * Accuracy:
- * pow(x,y) returns x**y nearly rounded. In particular
- * pow(integer,integer)
- * always returns the correct integer provided it is
- * representable.
- *
- * Constants :
- * The hexadecimal values are the intended ones for the following
- * constants. The decimal values may be used, provided that the
- * compiler will convert from decimal to binary accurately enough
- * to produce the hexadecimal values shown.
- */
-
-static const double
-bp[] = {1.0, 1.5,},
-dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */
-dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */
-zero = 0.0,
-one = 1.0,
-two = 2.0,
-two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */
-huge = 1.0e300,
-tiny = 1.0e-300,
- /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */
-L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */
-L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */
-L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */
-L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */
-L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */
-L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */
-P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */
-P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */
-P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */
-P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */
-P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */
-lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */
-lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */
-lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */
-ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */
-cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */
-cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */
-cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h*/
-ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */
-ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/
-ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
-
-typedef union
-{
- double value;
- struct
- {
- uint32_t lsw;
- uint32_t msw;
- } parts;
-} ieee_double_shape_type;
-
-#define EXTRACT_WORDS(ix0,ix1,d) \
-do { \
- ieee_double_shape_type ew_u; \
- ew_u.value = (d); \
- (ix0) = ew_u.parts.msw; \
- (ix1) = ew_u.parts.lsw; \
-} while (0)
-
-/* Get the more significant 32 bit int from a double. */
-
-#define GET_HIGH_WORD(i,d) \
-do { \
- ieee_double_shape_type gh_u; \
- gh_u.value = (d); \
- (i) = gh_u.parts.msw; \
-} while (0)
-
-/* Get the less significant 32 bit int from a double. */
-
-#define GET_LOW_WORD(i,d) \
-do { \
- ieee_double_shape_type gl_u; \
- gl_u.value = (d); \
- (i) = gl_u.parts.lsw; \
-} while (0)
-
-/* Set the more significant 32 bits of a double from an int. */
-
-#define SET_HIGH_WORD(d,v) \
-do { \
- ieee_double_shape_type sh_u; \
- sh_u.value = (d); \
- sh_u.parts.msw = (v); \
- (d) = sh_u.value; \
-} while (0)
-
-/* Set the less significant 32 bits of a double from an int. */
-
-#define SET_LOW_WORD(d,v) \
-do { \
- ieee_double_shape_type sl_u; \
- sl_u.value = (d); \
- sl_u.parts.lsw = (v); \
- (d) = sl_u.value; \
-} while (0)
-
-double pow(double x, double y)
-{
- double z,ax,z_h,z_l,p_h,p_l;
- double y1,t1,t2,r,s,t,u,v,w;
- int32_t i,j,k,yisint,n;
- int32_t hx,hy,ix,iy;
- uint32_t lx,ly;
-
- EXTRACT_WORDS(hx,lx,x);
- EXTRACT_WORDS(hy,ly,y);
- ix = hx&0x7fffffff; iy = hy&0x7fffffff;
-
- /* y==zero: x**0 = 1 */
- if((iy|ly)==0) return one;
-
- /* x|y==NaN return NaN unless x==1 then return 1 */
- if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) ||
- iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) {
- if(((ix-0x3ff00000)|lx)==0) return one;
- else return __builtin_nan("");
- }
-
- /* determine if y is an odd int when x < 0
- * yisint = 0 ... y is not an integer
- * yisint = 1 ... y is an odd int
- * yisint = 2 ... y is an even int
- */
- yisint = 0;
- if(hx<0) {
- if(iy>=0x43400000) yisint = 2; /* even integer y */
- else if(iy>=0x3ff00000) {
- k = (iy>>20)-0x3ff; /* exponent */
- if(k>20) {
- j = ly>>(52-k);
- if((uint32_t)(j<<(52-k))==ly) yisint = 2-(j&1);
- } else if(ly==0) {
- j = iy>>(20-k);
- if((j<<(20-k))==iy) yisint = 2-(j&1);
- }
- }
- }
-
- /* special value of y */
- if(ly==0) {
- if (iy==0x7ff00000) { /* y is +-inf */
- if(((ix-0x3ff00000)|lx)==0)
- return one; /* +-1**+-inf = 1 */
- else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */
- return (hy>=0)? y: zero;
- else /* (|x|<1)**-,+inf = inf,0 */
- return (hy<0)?-y: zero;
- }
- if(iy==0x3ff00000) { /* y is +-1 */
- if(hy<0) return one/x; else return x;
- }
- if(hy==0x40000000) return x*x; /* y is 2 */
- if(hy==0x3fe00000) { /* y is 0.5 */
- if(hx>=0) /* x >= +0 */
- return __builtin_sqrt(x);
- }
- }
-
- ax = __builtin_fabs(x);
- /* special value of x */
- if(lx==0) {
- if(ix==0x7ff00000||ix==0||ix==0x3ff00000){
- z = ax; /*x is +-0,+-inf,+-1*/
- if(hy<0) z = one/z; /* z = (1/|x|) */
- if(hx<0) {
- if(((ix-0x3ff00000)|yisint)==0) {
- z = (z-z)/(z-z); /* (-1)**non-int is NaN */
- } else if(yisint==1)
- z = -z; /* (x<0)**odd = -(|x|**odd) */
- }
- return z;
- }
- }
-
- /* (x<0)**(non-int) is NaN */
- /* REDHAT LOCAL: This used to be
- if((((hx>>31)+1)|yisint)==0) return (x-x)/(x-x);
- but ANSI C says a right shift of a signed negative quantity is
- implementation defined. */
- if(((((uint32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
-
- /* |y| is huge */
- if(iy>0x41e00000) { /* if |y| > 2**31 */
- if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */
- if(ix<=0x3fefffff) return (hy<0)? huge*huge:tiny*tiny;
- if(ix>=0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
- }
- /* over/underflow if x is not close to one */
- if(ix<0x3fefffff) return (hy<0)? huge*huge:tiny*tiny;
- if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
- /* now |1-x| is tiny <= 2**-20, suffice to compute
- log(x) by x-x^2/2+x^3/3-x^4/4 */
- t = ax-1; /* t has 20 trailing zeros */
- w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25));
- u = ivln2_h*t; /* ivln2_h has 21 sig. bits */
- v = t*ivln2_l-w*ivln2;
- t1 = u+v;
- SET_LOW_WORD(t1,0);
- t2 = v-(t1-u);
- } else {
- double s2,s_h,s_l,t_h,t_l;
- n = 0;
- /* take care subnormal number */
- if(ix<0x00100000)
- {ax *= two53; n -= 53; GET_HIGH_WORD(ix,ax); }
- n += ((ix)>>20)-0x3ff;
- j = ix&0x000fffff;
- /* determine interval */
- ix = j|0x3ff00000; /* normalize ix */
- if(j<=0x3988E) k=0; /* |x|>1)|0x20000000)+0x00080000+(k<<18));
- t_l = ax - (t_h-bp[k]);
- s_l = v*((u-s_h*t_h)-s_h*t_l);
- /* compute log(ax) */
- s2 = s*s;
- r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6)))));
- r += s_l*(s_h+s);
- s2 = s_h*s_h;
- t_h = 3.0+s2+r;
- SET_LOW_WORD(t_h,0);
- t_l = r-((t_h-3.0)-s2);
- /* u+v = s*(1+...) */
- u = s_h*t_h;
- v = s_l*t_h+t_l*s;
- /* 2/(3log2)*(s+...) */
- p_h = u+v;
- SET_LOW_WORD(p_h,0);
- p_l = v-(p_h-u);
- z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */
- z_l = cp_l*p_h+p_l*cp+dp_l[k];
- /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */
- t = (double)n;
- t1 = (((z_h+z_l)+dp_h[k])+t);
- SET_LOW_WORD(t1,0);
- t2 = z_l-(((t1-t)-dp_h[k])-z_h);
- }
-
- s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
- if(((((uint32_t)hx>>31)-1)|(yisint-1))==0)
- s = -one;/* (-ve)**(odd int) */
-
- /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
- y1 = y;
- SET_LOW_WORD(y1,0);
- p_l = (y-y1)*t1+y*t2;
- p_h = y1*t1;
- z = p_l+p_h;
- EXTRACT_WORDS(j,i,z);
- if (j>=0x40900000) { /* z >= 1024 */
- if(((j-0x40900000)|i)!=0) /* if z > 1024 */
- return s*huge*huge; /* overflow */
- else {
- if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */
- }
- } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */
- if(((j-0xc090cc00)|i)!=0) /* z < -1075 */
- return s*tiny*tiny; /* underflow */
- else {
- if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */
- }
- }
- /*
- * compute 2**(p_h+p_l)
- */
- i = j&0x7fffffff;
- k = (i>>20)-0x3ff;
- n = 0;
- if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */
- n = j+(0x00100000>>(k+1));
- k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */
- t = zero;
- SET_HIGH_WORD(t,n&~(0x000fffff>>k));
- n = ((n&0x000fffff)|0x00100000)>>(20-k);
- if(j<0) n = -n;
- p_h -= t;
- }
- t = p_l+p_h;
- SET_LOW_WORD(t,0);
- u = t*lg2_h;
- v = (p_l-(t-p_h))*lg2+t*lg2_l;
- z = u+v;
- w = v-(z-u);
- t = z*z;
- t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5))));
- r = (z*t1)/(t1-two)-(w+z*w);
- z = one-(r-z);
- GET_HIGH_WORD(j,z);
- j += (n<<20);
- if((j>>20)<=0) z = __builtin_scalbn(z,(int)n); /* subnormal output */
- else SET_HIGH_WORD(z,j);
- return s*z;
-}
diff --git a/lib/c/pebble/math/round.c b/lib/c/pebble/math/round.c
deleted file mode 100644
index 9ba31d23b7..0000000000
--- a/lib/c/pebble/math/round.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-// Naive implementation, probably room for optimization...
-double round(double d) {
- if (__builtin_floor(d) == d) {
- return d;
- }
- double half;
- if (d < 0.0) {
- if (d > -0.5) {
- return -0.0;
- } else {
- half = -0.5;
- }
- } else {
- half = 0.5;
- }
- return __builtin_floor(d + half);
-}
diff --git a/lib/c/pebble/math/scalbn.c b/lib/c/pebble/math/scalbn.c
deleted file mode 100644
index 6f11ce3d66..0000000000
--- a/lib/c/pebble/math/scalbn.c
+++ /dev/null
@@ -1,127 +0,0 @@
-///////////////////////////////////////
-// Implements:
-// double scalbn(double x, int n);
-///////////////////////////////////////
-// Notes:
-// This is taken from newlib.
-// Only included because pow() needs it.
-// @nolint
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#include
-#include
-
-/*
- * scalbn (double x, int n)
- * scalbn(x,n) returns x* 2**n computed by exponent
- * manipulation rather than by actually performing an
- * exponentiation or a multiplication.
- */
-
-static const double
-two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
-twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
-huge = 1.0e+300,
-tiny = 1.0e-300;
-
-typedef union
-{
- double value;
- struct
- {
- uint32_t lsw;
- uint32_t msw;
- } parts;
-} ieee_double_shape_type;
-
-#define EXTRACT_WORDS(ix0,ix1,d) \
-do { \
- ieee_double_shape_type ew_u; \
- ew_u.value = (d); \
- (ix0) = ew_u.parts.msw; \
- (ix1) = ew_u.parts.lsw; \
-} while (0)
-
-/* Get the more significant 32 bit int from a double. */
-
-#define GET_HIGH_WORD(i,d) \
-do { \
- ieee_double_shape_type gh_u; \
- gh_u.value = (d); \
- (i) = gh_u.parts.msw; \
-} while (0)
-
-/* Get the less significant 32 bit int from a double. */
-
-#define GET_LOW_WORD(i,d) \
-do { \
- ieee_double_shape_type gl_u; \
- gl_u.value = (d); \
- (i) = gl_u.parts.lsw; \
-} while (0)
-
-/* Set the more significant 32 bits of a double from an int. */
-
-#define SET_HIGH_WORD(d,v) \
-do { \
- ieee_double_shape_type sh_u; \
- sh_u.value = (d); \
- sh_u.parts.msw = (v); \
- (d) = sh_u.value; \
-} while (0)
-
-/* Set the less significant 32 bits of a double from an int. */
-
-#define SET_LOW_WORD(d,v) \
-do { \
- ieee_double_shape_type sl_u; \
- sl_u.value = (d); \
- sl_u.parts.lsw = (v); \
- (d) = sl_u.value; \
-} while (0)
-
-static double copysign(double x, double y)
-{
- uint32_t hx,hy;
- GET_HIGH_WORD(hx,x);
- GET_HIGH_WORD(hy,y);
- SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
- return x;
-}
-
-double scalbn(double x, int n)
-{
- int32_t k,hx,lx;
- EXTRACT_WORDS(hx,lx,x);
- k = (hx&0x7ff00000)>>20; /* extract exponent */
- if (k==0) { /* 0 or subnormal x */
- if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
- x *= two54;
- GET_HIGH_WORD(hx,x);
- k = ((hx&0x7ff00000)>>20) - 54;
- if (n< -50000) return tiny*x; /*underflow*/
- }
- if (k==0x7ff) return x+x; /* NaN or Inf */
- k = k+n;
- if (k > 0x7fe) return huge*copysign(huge,x); /* overflow */
- if (k > 0) /* normal result */
- {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;}
- if (k <= -54) {
- if (n > 50000) /* in case integer overflow in n+k */
- return huge*copysign(huge,x); /*overflow*/
- else return tiny*copysign(tiny,x); /*underflow*/
- }
- k += 54; /* subnormal result */
- SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20));
- return x*twom54;
-}
diff --git a/lib/c/pebble/math/sqrt.c b/lib/c/pebble/math/sqrt.c
deleted file mode 100644
index ffd91606f9..0000000000
--- a/lib/c/pebble/math/sqrt.c
+++ /dev/null
@@ -1,254 +0,0 @@
-///////////////////////////////////////
-// Implements:
-// double sqrt(double x);
-///////////////////////////////////////
-// Notes:
-// This is taken from newlib.
-// Only included because pow() needs it.
-// @nolint
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#include
-#include
-
-typedef union
-{
- double value;
- struct
- {
- uint32_t lsw;
- uint32_t msw;
- } parts;
-} ieee_double_shape_type;
-
-#define EXTRACT_WORDS(ix0,ix1,d) \
-do { \
- ieee_double_shape_type ew_u; \
- ew_u.value = (d); \
- (ix0) = ew_u.parts.msw; \
- (ix1) = ew_u.parts.lsw; \
-} while (0)
-
-/* Get the more significant 32 bit int from a double. */
-
-#define GET_HIGH_WORD(i,d) \
-do { \
- ieee_double_shape_type gh_u; \
- gh_u.value = (d); \
- (i) = gh_u.parts.msw; \
-} while (0)
-
-/* Get the less significant 32 bit int from a double. */
-
-#define GET_LOW_WORD(i,d) \
-do { \
- ieee_double_shape_type gl_u; \
- gl_u.value = (d); \
- (i) = gl_u.parts.lsw; \
-} while (0)
-
-#define INSERT_WORDS(d,ix0,ix1) \
-do { \
- ieee_double_shape_type iw_u; \
- iw_u.parts.msw = (ix0); \
- iw_u.parts.lsw = (ix1); \
- (d) = iw_u.value; \
-} while (0)
-
-/* Set the more significant 32 bits of a double from an int. */
-
-#define SET_HIGH_WORD(d,v) \
-do { \
- ieee_double_shape_type sh_u; \
- sh_u.value = (d); \
- sh_u.parts.msw = (v); \
- (d) = sh_u.value; \
-} while (0)
-
-/* Set the less significant 32 bits of a double from an int. */
-
-#define SET_LOW_WORD(d,v) \
-do { \
- ieee_double_shape_type sl_u; \
- sl_u.value = (d); \
- sl_u.parts.lsw = (v); \
- (d) = sl_u.value; \
-} while (0)
-
-/* __ieee754_sqrt(x)
- * Return correctly rounded sqrt.
- * ------------------------------------------
- * | Use the hardware sqrt if you have one |
- * ------------------------------------------
- * Method:
- * Bit by bit method using integer arithmetic. (Slow, but portable)
- * 1. Normalization
- * Scale x to y in [1,4) with even powers of 2:
- * find an integer k such that 1 <= (y=x*2^(2k)) < 4, then
- * sqrt(x) = 2^k * sqrt(y)
- * 2. Bit by bit computation
- * Let q = sqrt(y) truncated to i bit after binary point (q = 1),
- * i 0
- * i+1 2
- * s = 2*q , and y = 2 * ( y - q ). (1)
- * i i i i
- *
- * To compute q from q , one checks whether
- * i+1 i
- *
- * -(i+1) 2
- * (q + 2 ) <= y. (2)
- * i
- * -(i+1)
- * If (2) is false, then q = q ; otherwise q = q + 2 .
- * i+1 i i+1 i
- *
- * With some algebric manipulation, it is not difficult to see
- * that (2) is equivalent to
- * -(i+1)
- * s + 2 <= y (3)
- * i i
- *
- * The advantage of (3) is that s and y can be computed by
- * i i
- * the following recurrence formula:
- * if (3) is false
- *
- * s = s , y = y ; (4)
- * i+1 i i+1 i
- *
- * otherwise,
- * -i -(i+1)
- * s = s + 2 , y = y - s - 2 (5)
- * i+1 i i+1 i i
- *
- * One may easily use induction to prove (4) and (5).
- * Note. Since the left hand side of (3) contain only i+2 bits,
- * it does not necessary to do a full (53-bit) comparison
- * in (3).
- * 3. Final rounding
- * After generating the 53 bits result, we compute one more bit.
- * Together with the remainder, we can decide whether the
- * result is exact, bigger than 1/2ulp, or less than 1/2ulp
- * (it will never equal to 1/2ulp).
- * The rounding mode can be detected by checking whether
- * huge + tiny is equal to huge, and whether huge - tiny is
- * equal to huge for some floating point number "huge" and "tiny".
- *
- * Special cases:
- * sqrt(+-0) = +-0 ... exact
- * sqrt(inf) = inf
- * sqrt(-ve) = NaN ... with invalid signal
- * sqrt(NaN) = NaN ... with invalid signal for signaling NaN
- *
- * Other methods : see the appended file at the end of the program below.
- *---------------
- */
-
-static const double one = 1.0, tiny=1.0e-300;
-
-double sqrt(double x)
-{
- double z;
- int32_t sign = 0x80000000;
- uint32_t r,t1,s1,ix1,q1;
- int32_t ix0,s0,q,m,t,i;
-
- EXTRACT_WORDS(ix0,ix1,x);
-
- /* take care of Inf and NaN */
- if((ix0&0x7ff00000)==0x7ff00000) {
- return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf
- sqrt(-inf)=sNaN */
- }
- /* take care of zero */
- if(ix0<=0) {
- if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */
- else if(ix0<0)
- return (x-x)/(x-x); /* sqrt(-ve) = sNaN */
- }
- /* normalize x */
- m = (ix0>>20);
- if(m==0) { /* subnormal x */
- while(ix0==0) {
- m -= 21;
- ix0 |= (ix1>>11); ix1 <<= 21;
- }
- for(i=0;(ix0&0x00100000)==0;i++) ix0<<=1;
- m -= i-1;
- ix0 |= (ix1>>(32-i));
- ix1 <<= i;
- }
- m -= 1023; /* unbias exponent */
- ix0 = (ix0&0x000fffff)|0x00100000;
- if(m&1){ /* odd m, double x to make it even */
- ix0 += ix0 + ((ix1&sign)>>31);
- ix1 += ix1;
- }
- m >>= 1; /* m = [m/2] */
-
- /* generate sqrt(x) bit by bit */
- ix0 += ix0 + ((ix1&sign)>>31);
- ix1 += ix1;
- q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */
- r = 0x00200000; /* r = moving bit from right to left */
-
- while(r!=0) {
- t = s0+r;
- if(t<=ix0) {
- s0 = t+r;
- ix0 -= t;
- q += r;
- }
- ix0 += ix0 + ((ix1&sign)>>31);
- ix1 += ix1;
- r>>=1;
- }
-
- r = sign;
- while(r!=0) {
- t1 = s1+r;
- t = s0;
- if((t>31);
- ix1 += ix1;
- r>>=1;
- }
-
- /* use floating add to find out rounding direction */
- if((ix0|ix1)!=0) {
- z = one-tiny; /* trigger inexact flag */
- if (z>=one) {
- z = one+tiny;
- if (q1==(uint32_t)0xffffffff) { q1=0; q += 1;}
- else if (z>one) {
- if (q1==(uint32_t)0xfffffffe) q+=1;
- q1+=2;
- } else
- q1 += (q1&1);
- }
- }
- ix0 = (q>>1)+0x3fe00000;
- ix1 = q1>>1;
- if ((q&1)==1) ix1 |= sign;
- ix0 += (m <<20);
- INSERT_WORDS(z,ix0,ix1);
- return z;
-}
diff --git a/lib/c/pebble/pblibc_assembly.h b/lib/c/pebble/pblibc_assembly.h
deleted file mode 100644
index 99b4a4d662..0000000000
--- a/lib/c/pebble/pblibc_assembly.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-#if __ARM_ARCH_ISA_THUMB >= 2
-# define MEMCPY_IMPLEMENTED_IN_ASSEMBLY 1
-# define MEMSET_IMPLEMENTED_IN_ASSEMBLY 1
-#else
-# define MEMCPY_IMPLEMENTED_IN_ASSEMBLY 0
-# define MEMSET_IMPLEMENTED_IN_ASSEMBLY 0
-#endif
diff --git a/lib/c/pebble/pblibc_private.h b/lib/c/pebble/pblibc_private.h
deleted file mode 100644
index d5b77dd116..0000000000
--- a/lib/c/pebble/pblibc_private.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#pragma once
-
-// Rename (and re-define) the libc functions
-#if UNITTEST
-#include
-#include
-
-# define PBLIBC(fn) pblibc_##fn
-
-// String functions
-# undef memcmp
-# define memcmp PBLIBC(memcmp)
-# undef memcpy
-# define memcpy PBLIBC(memcpy)
-# undef memmove
-# define memmove PBLIBC(memmove)
-# undef memset
-# define memset PBLIBC(memset)
-# undef memchr
-# define memchr PBLIBC(memchr)
-# undef atoi
-# define atoi PBLIBC(atoi)
-# undef atol
-# define atol PBLIBC(atol)
-# undef strtol
-# define strtol PBLIBC(strtol)
-# undef strcat
-# define strcat PBLIBC(strcat)
-# undef strncat
-# define strncat PBLIBC(strncat)
-# undef strlen
-# define strlen PBLIBC(strlen)
-# undef strnlen
-# define strnlen PBLIBC(strnlen)
-# undef strcpy
-# define strcpy PBLIBC(strcpy)
-# undef strncpy
-# define strncpy PBLIBC(strncpy)
-# undef strcmp
-# define strcmp PBLIBC(strcmp)
-# undef strncmp
-# define strncmp PBLIBC(strncmp)
-# undef strchr
-# define strchr PBLIBC(strchr)
-# undef strrchr
-# define strrchr PBLIBC(strrchr)
-# undef strcspn
-# define strcspn PBLIBC(strcspn)
-# undef strspn
-# define strspn PBLIBC(strspn)
-# undef strstr
-# define strstr PBLIBC(strstr)
-
-int memcmp(const void *s1, const void *s2, size_t n);
-void *memcpy(void *s1, const void *s2, size_t n);
-void *memmove(void *s1, const void *s2, size_t n);
-void *memset(void *s, int c, size_t n);
-void *memchr(const void *s, int c, size_t n);
-int atoi(const char *nptr);
-long int atol(const char *nptr);
-long int strtol(const char *nptr, char **endptr, int base);
-char *strcat(char *s1, const char *s2);
-char *strncat(char *s1, const char *s2, size_t n);
-size_t strlen(const char *s);
-size_t strnlen(const char *s, size_t maxlen);
-char *strcpy(char *s1, const char *s2);
-char *strncpy(char *s1, const char *s2, size_t n);
-int strcmp(const char *s1, const char *s2);
-int strncmp(const char *s1, const char *s2, size_t n);
-char *strchr(const char *s, int c);
-char *strrchr(const char *s, int c);
-size_t strcspn(const char *s1, const char *s2);
-size_t strspn(const char *s1, const char *s2);
-char *strstr(const char *s1, const char *s2);
-
-
-// Math functions
-# undef floor
-# define floor PBLIBC(floor)
-# undef log
-# define log PBLIBC(log)
-# undef pow
-# define pow PBLIBC(pow)
-# undef scalbn
-# define scalbn PBLIBC(scalbn)
-# undef sqrt
-# define sqrt PBLIBC(sqrt)
-
-double floor(double x);
-double log(double x);
-double pow(double x, double y);
-double round(double d);
-double scalbn(double x, int n);
-double sqrt(double x);
-
-
-// ctype
-# undef __ctype_lookup
-# undef isalpha
-# undef isupper
-# undef islower
-# undef isdigit
-# undef isxdigit
-# undef isspace
-# undef ispunct
-# undef isalnum
-# undef isprint
-# undef isgraph
-# undef iscntrl
-
-# undef isascii
-# undef toascii
-
-# undef toupper
-# undef tolower
-
-
-// printf
-# undef vsprintf
-# define vsprintf PBLIBC(vsprintf)
-# undef vsnprintf
-# define vsnprintf PBLIBC(vsnprintf)
-# undef sprintf
-# define sprintf PBLIBC(sprintf)
-# undef snprintf
-# define snprintf PBLIBC(snprintf)
-
-int sprintf(char *str, const char *format, ...);
-int snprintf(char *str, size_t size, const char *format, ...);
-int vsprintf(char *str, const char *format, va_list ap);
-int vsnprintf(char *str, size_t size, const char *format, va_list ap);
-
-#endif
diff --git a/lib/c/pebble/rand48.c b/lib/c/pebble/rand48.c
deleted file mode 100644
index 96ccf89ae7..0000000000
--- a/lib/c/pebble/rand48.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* SPDX-FileCopyrightText: 2025 Core Devices LLC */
-/* SPDX-FileCopyrightText: 2025 The Apache Software Foundation */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#include
-#include
-#include
-
-static unsigned short int g_seed48[7] =
-{
- 0,
- 0,
- 0,
- 0xe66d,
- 0xdeec,
- 0x5,
- 0xb
-};
-
-static uint64_t rand48_step(unsigned short int *xi,
- unsigned short int *lc)
-{
- uint64_t a;
- uint64_t x;
-
- x = xi[0] | ((xi[1] + 0ul) << 16) | ((xi[2] + 0ull) << 32);
- a = lc[0] | ((lc[1] + 0ul) << 16) | ((lc[2] + 0ull) << 32);
- x = a * x + lc[3];
-
- xi[0] = x;
- xi[1] = x >> 16;
- xi[2] = x >> 32;
- return x & 0xffffffffffffull;
-}
-
-long jrand48(unsigned short int s[3])
-{
- return (long)(rand48_step(s, g_seed48 + 3) >> 16);
-}
diff --git a/lib/c/pebble/setjmp.c b/lib/c/pebble/setjmp.c
deleted file mode 100644
index 14b7b1329a..0000000000
--- a/lib/c/pebble/setjmp.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-///////////////////////////////////////
-// Implements:
-// int setjmp(jmp_buf env);
-// void longjmp(jmp_buf buf, int value);
-///////////////////////////////////////
-// Notes:
-// This is entirely non-portable. It will need to be rewritten if we stop using ARM.
-// Unfortunately, there is no portable way to define these.
-// This means unit tests can't use our setjmp/longjmp either.
-
-#include
-
-#if __ARM_ARCH_ISA_THUMB >= 2
-// Valid for anything with THUMB2
-
-int __attribute__((__naked__)) setjmp(jmp_buf env) {
- __asm volatile (
- // move SP to a register we can store from and don't need to save
- "mov %ip, %sp\n"
- // store all the registers
- "stmia %r0!, {%r4-%r9, %sl, %fp, %ip, %lr}\n"
-// using real FPU
-#if defined(__VFP_FP__) && !defined(__SOFTFP__)
- // store FP registers
- "vstmia %r0!, {%s16-%s31}\n"
- // store FPSCR
- "vmrs %r1, fpscr\n"
- "str %r1, [%r0], #4\n"
-#endif
- // return 0
- "mov %r0, #0\n"
- "bx lr\n"
- );
-}
-
-void __attribute__((__naked__)) longjmp(jmp_buf buf, int value) {
- __asm volatile (
- // load all the registers
- "ldmia %r0!, {%r4-%r9, %sl, %fp, %ip, %lr}\n"
- // load SP from a register we could load to and don't need to restore
- "mov %sp, %ip\n"
-// using real FPU
-#if defined(__VFP_FP__) && !defined(__SOFTFP__)
- // load FP registers
- "vldmia %r0!, {%s16-%s31}\n"
- // load FPSCR
- "ldr %r2, [%r0], #4\n"
- "vmsr fpscr, %r2\n"
-#endif
- // return value
- "movs %r0, %r1\n"
- // unless it's 0, in which case, return 1.
- "it eq\n"
- "moveq %r0, #1\n"
- "bx lr\n"
- );
-}
-#else
-// Undefined implementations, don't implement!
-// That way we get a link-time error.
-#endif
diff --git a/lib/c/pebble/string/atoi.c b/lib/c/pebble/string/atoi.c
deleted file mode 100644
index cee49ffb8b..0000000000
--- a/lib/c/pebble/string/atoi.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-///////////////////////////////////////
-// Implements:
-// int atoi(const char *nptr);
-// long int atol(const char *nptr);
-///////////////////////////////////////
-// Exports to apps:
-// atoi, atol
-
-#include
-#include
-#include
-#include
-#include
-
-intmax_t strtoX_core(const char * restrict nptr, char ** restrict endptr, int base, bool do_errors,
- intmax_t max, intmax_t min);
-
-int atoi(const char *nptr) {
- return strtoX_core(nptr, NULL, 10, false, INT_MAX, INT_MIN);
-}
-
-long int atol(const char *nptr) {
- return strtoX_core(nptr, NULL, 10, false, INT_MAX, INT_MIN);
-}
diff --git a/lib/c/pebble/string/itoa.c b/lib/c/pebble/string/itoa.c
deleted file mode 100644
index 2ce6c3a028..0000000000
--- a/lib/c/pebble/string/itoa.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* SPDX-FileCopyrightText: 2025 Core Devices LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#include
-
-static void reverse(char *str, int length) {
- int start = 0;
- int end = length - 1;
- while (start < end) {
- char temp = str[start];
- str[start] = str[end];
- str[end] = temp;
- start++;
- end--;
- }
-}
-
-char *itoa(int value, char *str, int base) {
- int i = 0;
- int is_negative = 0;
-
- // Handle base validation
- if (base < 2 || base > 36) {
- str[0] = '\0';
- return str;
- }
-
- // Handle 0 explicitly
- if (value == 0) {
- str[i++] = '0';
- str[i] = '\0';
- return str;
- }
-
- // Handle negative numbers for base 10
- if (value < 0 && base == 10) {
- is_negative = 1;
- value = -value;
- }
-
- // Process individual digits
- while (value != 0) {
- int rem = value % base;
- str[i++] = (rem > 9) ? (rem - 10) + 'a' : rem + '0';
- value = value / base;
- }
-
- // Append negative sign for negative numbers
- if (is_negative) {
- str[i++] = '-';
- }
-
- str[i] = '\0';
-
- // Reverse the string
- reverse(str, i);
-
- return str;
-}
diff --git a/lib/c/pebble/string/memchr.c b/lib/c/pebble/string/memchr.c
deleted file mode 100644
index 911b141788..0000000000
--- a/lib/c/pebble/string/memchr.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-///////////////////////////////////////
-// Implements:
-// void *memchr(const void *s, int c, size_t n);
-
-#include
-#include
-
-void *memchr(const void *s, int c, size_t n) {
- const unsigned char *p = (const unsigned char*)s;
- unsigned char ch = (unsigned char)c;
- for (size_t i = 0; i < n; i++) {
- if (p[i] == ch) {
- return (void*)&p[i];
- }
- }
- return NULL;
-}
diff --git a/lib/c/pebble/string/memcmp.c b/lib/c/pebble/string/memcmp.c
deleted file mode 100644
index 5f3f1e51fd..0000000000
--- a/lib/c/pebble/string/memcmp.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-///////////////////////////////////////
-// Implements:
-// int memcmp(const void *s1, const void *s2, size_t n);
-
-#include
-#include
-#include
-
-int memcmp(const void *s1, const void *s2, size_t n) {
- const unsigned char *p1 = (const unsigned char*)s1;
- const unsigned char *p2 = (const unsigned char*)s2;
-
- // Fast path: word-by-word comparison if both pointers are word-aligned
- if ((((uintptr_t)p1 | (uintptr_t)p2) & (sizeof(uint32_t) - 1)) == 0) {
- const uint32_t *w1 = (const uint32_t*)p1;
- const uint32_t *w2 = (const uint32_t*)p2;
-
- while (n >= sizeof(uint32_t)) {
- if (*w1 != *w2) {
- break;
- }
- w1++;
- w2++;
- n -= sizeof(uint32_t);
- }
-
- p1 = (const unsigned char*)w1;
- p2 = (const unsigned char*)w2;
- }
-
- // Byte-by-byte comparison for remaining/unaligned bytes
- while (n--) {
- int diff = *p1 - *p2;
- if (diff) {
- return diff;
- }
- p1++;
- p2++;
- }
- return 0;
-}
diff --git a/lib/c/pebble/string/memcpy-armv7m.S b/lib/c/pebble/string/memcpy-armv7m.S
deleted file mode 100644
index 57ad59c853..0000000000
--- a/lib/c/pebble/string/memcpy-armv7m.S
+++ /dev/null
@@ -1,295 +0,0 @@
-/* SPDX-FileCopyrightText: 2013 ARM Ltd */
-/* SPDX-License-Identifier: BSD-3-Clause */
-/* This memcpy routine is optimised for Cortex-M3/M4 cores with/without
- unaligned access.
- If compiled with GCC, this file should be enclosed within following
- pre-processing check:
- if defined (__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__)
- Prototype: void *memcpy (void *dst, const void *src, size_t count);
- The job will be done in 5 steps.
- Step 1: Align src/dest pointers, copy mis-aligned if fail to align both
- Step 2: Repeatedly copy big block size of __OPT_BIG_BLOCK_SIZE
- Step 3: Repeatedly copy big block size of __OPT_MID_BLOCK_SIZE
- Step 4: Copy word by word
- Step 5: Copy byte-to-byte
- Tunable options:
- __OPT_BIG_BLOCK_SIZE: Size of big block in words. Default to 64.
- __OPT_MID_BLOCK_SIZE: Size of big block in words. Default to 16.
- */
-
-#if __ARM_ARCH_ISA_THUMB >= 2
-
-#ifndef __OPT_BIG_BLOCK_SIZE
-#define __OPT_BIG_BLOCK_SIZE (4 * 16)
-#endif
-
-#ifndef __OPT_MID_BLOCK_SIZE
-#define __OPT_MID_BLOCK_SIZE (4 * 4)
-#endif
-
-#if __OPT_BIG_BLOCK_SIZE == 16
-#define BEGIN_UNROLL_BIG_BLOCK \
- .irp offset, 0,4,8,12
-#elif __OPT_BIG_BLOCK_SIZE == 32
-#define BEGIN_UNROLL_BIG_BLOCK \
- .irp offset, 0,4,8,12,16,20,24,28
-#elif __OPT_BIG_BLOCK_SIZE == 64
-#define BEGIN_UNROLL_BIG_BLOCK \
- .irp offset, 0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60
-#else
-#error "Illegal __OPT_BIG_BLOCK_SIZE"
-#endif
-
-#if __OPT_MID_BLOCK_SIZE == 8
-#define BEGIN_UNROLL_MID_BLOCK \
- .irp offset, 0,4
-#elif __OPT_MID_BLOCK_SIZE == 16
-#define BEGIN_UNROLL_MID_BLOCK \
- .irp offset, 0,4,8,12
-#else
-#error "Illegal __OPT_MID_BLOCK_SIZE"
-#endif
-
-#define END_UNROLL .endr
-
- .syntax unified
- .text
- .align 2
- .global memcpy
- .thumb
- .thumb_func
- .type memcpy, %function
-memcpy:
- @ r0: dst
- @ r1: src
- @ r2: len
-#ifdef __ARM_FEATURE_UNALIGNED
- /* In case of UNALIGNED access supported, ip is not used in
- function body. */
- mov ip, r0
-#else
- push {r0}
-#endif
- orr r3, r1, r0
- ands r3, r3, #3
- bne .Lmisaligned_copy
-
-.Lbig_block:
- subs r2, __OPT_BIG_BLOCK_SIZE
- blo .Lmid_block
-
- /* Kernel loop for big block copy */
- .align 2
-.Lbig_block_loop:
- BEGIN_UNROLL_BIG_BLOCK
-#ifdef __ARM_ARCH_7EM__
- ldr r3, [r1], #4
- str r3, [r0], #4
- END_UNROLL
-#else /* __ARM_ARCH_7M__ */
- ldr r3, [r1, \offset]
- str r3, [r0, \offset]
- END_UNROLL
- adds r0, __OPT_BIG_BLOCK_SIZE
- adds r1, __OPT_BIG_BLOCK_SIZE
-#endif
- subs r2, __OPT_BIG_BLOCK_SIZE
- bhs .Lbig_block_loop
-
-.Lmid_block:
- adds r2, __OPT_BIG_BLOCK_SIZE - __OPT_MID_BLOCK_SIZE
- blo .Lcopy_word_by_word
-
- /* Kernel loop for mid-block copy */
- .align 2
-.Lmid_block_loop:
- BEGIN_UNROLL_MID_BLOCK
-#ifdef __ARM_ARCH_7EM__
- ldr r3, [r1], #4
- str r3, [r0], #4
- END_UNROLL
-#else /* __ARM_ARCH_7M__ */
- ldr r3, [r1, \offset]
- str r3, [r0, \offset]
- END_UNROLL
- adds r0, __OPT_MID_BLOCK_SIZE
- adds r1, __OPT_MID_BLOCK_SIZE
-#endif
- subs r2, __OPT_MID_BLOCK_SIZE
- bhs .Lmid_block_loop
-
-.Lcopy_word_by_word:
- adds r2, __OPT_MID_BLOCK_SIZE - 4
- blo .Lcopy_less_than_4
-
- /* Kernel loop for small block copy */
- .align 2
-.Lcopy_word_by_word_loop:
- ldr r3, [r1], #4
- str r3, [r0], #4
- subs r2, #4
- bhs .Lcopy_word_by_word_loop
-
-.Lcopy_less_than_4:
- adds r2, #4
- beq .Ldone
-
- lsls r2, r2, #31
- itt ne
- ldrbne r3, [r1], #1
- strbne r3, [r0], #1
-
- bcc .Ldone
-#ifdef __ARM_FEATURE_UNALIGNED
- ldrh r3, [r1]
- strh r3, [r0]
-#else
- ldrb r3, [r1]
- strb r3, [r0]
- ldrb r3, [r1, #1]
- strb r3, [r0, #1]
-#endif /* __ARM_FEATURE_UNALIGNED */
-
-.Ldone:
-#ifdef __ARM_FEATURE_UNALIGNED
- mov r0, ip
-#else
- pop {r0}
-#endif
- bx lr
-
- .align 2
-.Lmisaligned_copy:
-#ifdef __ARM_FEATURE_UNALIGNED
- /* Define label DST_ALIGNED to BIG_BLOCK. It will go to aligned copy
- once destination is adjusted to aligned. */
-#define Ldst_aligned Lbig_block
-
- /* Copy word by word using LDR when alignment can be done in hardware,
- i.e., SCTLR.A is set, supporting unaligned access in LDR and STR. */
-
- cmp r2, #8
- blo .Lbyte_copy
-
- /* if src is aligned, just go to the big block loop. */
- lsls r3, r1, #30
- beq .Ldst_aligned
-#else
- /* if len < 12, misalignment adjustment has more overhead than
- just byte-to-byte copy. Also, len must >=8 to guarantee code
- afterward work correctly. */
- cmp r2, #12
- blo .Lbyte_copy
-#endif /* __ARM_FEATURE_UNALIGNED */
-
- /* Align dst only, not trying to align src. That is the because
- handling of aligned src and misaligned dst need more overhead than
- otherwise. By doing this the worst case is when initial src is aligned,
- additional up to 4 byte additional copy will executed, which is
- acceptable. */
-
- ands r3, r0, #3
- beq .Ldst_aligned
-
- rsb r3, #4
- subs r2, r3
-
- lsls r3, r3, #31
- itt ne
- ldrbne r3, [r1], #1
- strbne r3, [r0], #1
-
- bcc .Ldst_aligned
-
-#ifdef __ARM_FEATURE_UNALIGNED
- ldrh r3, [r1], #2
- strh r3, [r0], #2
- b .Ldst_aligned
-#else
- ldrb r3, [r1], #1
- strb r3, [r0], #1
- ldrb r3, [r1], #1
- strb r3, [r0], #1
- /* Now that dst is aligned */
-.Ldst_aligned:
- /* if r1 is aligned now, it means r0/r1 has the same misalignment,
- and they are both aligned now. Go aligned copy. */
- ands r3, r1, #3
- beq .Lbig_block
-
- /* dst is aligned, but src isn't. Misaligned copy. */
-
- push {r4, r5}
- subs r2, #4
-
- /* Backward r1 by misaligned bytes, to make r1 aligned.
- Since we need to restore r1 to unaligned address after the loop,
- we need keep the offset bytes to ip and sub it from r1 afterward. */
- subs r1, r3
- rsb ip, r3, #4
-
- /* Pre-load on word */
- ldr r4, [r1], #4
-
- cmp r3, #2
- beq .Lmisaligned_copy_2_2
- cmp r3, #3
- beq .Lmisaligned_copy_3_1
-
- .macro mis_src_copy shift
-1:
- lsrs r4, r4, \shift
- ldr r3, [r1], #4
- lsls r5, r3, 32-\shift
- orr r4, r4, r5
- str r4, [r0], #4
- mov r4, r3
- subs r2, #4
- bhs 1b
- .endm
-
-.Lmisaligned_copy_1_3:
- mis_src_copy shift=8
- b .Lsrc_misaligned_tail
-
-.Lmisaligned_copy_3_1:
- mis_src_copy shift=24
- b .Lsrc_misaligned_tail
-
-.Lmisaligned_copy_2_2:
- /* For 2_2 misalignment, ldr is still faster than 2 x ldrh. */
- mis_src_copy shift=16
-
-.Lsrc_misaligned_tail:
- adds r2, #4
- subs r1, ip
- pop {r4, r5}
-
-#endif /* __ARM_FEATURE_UNALIGNED */
-
-.Lbyte_copy:
- subs r2, #4
- blo .Lcopy_less_than_4
-
-.Lbyte_copy_loop:
- subs r2, #1
- ldrb r3, [r1], #1
- strb r3, [r0], #1
- bhs .Lbyte_copy_loop
-
- ldrb r3, [r1]
- strb r3, [r0]
- ldrb r3, [r1, #1]
- strb r3, [r0, #1]
- ldrb r3, [r1, #2]
- strb r3, [r0, #2]
-
-#ifdef __ARM_FEATURE_UNALIGNED
- mov r0, ip
-#else
- pop {r0}
-#endif
- bx lr
-
- .size memcpy, .-memcpy
-#endif
diff --git a/lib/c/pebble/string/memcpy.c b/lib/c/pebble/string/memcpy.c
deleted file mode 100644
index 370a847e5d..0000000000
--- a/lib/c/pebble/string/memcpy.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-///////////////////////////////////////
-// Implements:
-// void *memcpy(void *s1, const void *s2, size_t n);
-// void *memmove(void *s1, const void *s2, size_t n);
-///////////////////////////////////////
-// Exports to apps:
-// memcpy, memmove
-
-#include
-#include
-#include
-#include
-
-#if !MEMCPY_IMPLEMENTED_IN_ASSEMBLY
-void *memcpy(void * restrict s1, const void * restrict s2, size_t n) {
- char *dest = (char*)s1;
- const char *src = (const char*)s2;
- while (n--) {
- *dest++ = *src++;
- }
- return s1;
-}
-#endif
-
-void *memmove(void * restrict s1, const void * restrict s2, size_t n) {
- char *dest = (char*)s1;
- const char *src = (const char*)s2;
- if (dest <= src) {
- while (n--) {
- *dest++ = *src++;
- }
- } else {
- while (n--) {
- dest[n] = src[n];
- }
- }
- return s1;
-}
diff --git a/lib/c/pebble/string/memset-thumb2.S b/lib/c/pebble/string/memset-thumb2.S
deleted file mode 100644
index 7dba0ceae4..0000000000
--- a/lib/c/pebble/string/memset-thumb2.S
+++ /dev/null
@@ -1,92 +0,0 @@
-/* SPDX-FileCopyrightText: 2015 ARM Ltd */
-/* SPDX-License-Identifier: BSD-3-Clause */
-
-/* modified 2016-06-22:
- * converted aeabi_memset to normal memset (save r0, different argument order) */
-
-#if __ARM_ARCH_ISA_THUMB >= 2
-
- .syntax unified
- .text
- .align 2
- .thumb
- .thumb_func
- .global memset
- .type memset, %function
-memset:
- .cfi_startproc
- push {r0, r4, r5, r6}
- lsls r4, r0, #30
- beq .L14
- subs r4, r2, #1
- cmp r2, #0
- beq .L16
- uxtb r5, r1
- mov r3, r0
- b .L4
-.L6:
- subs r2, r4, #1
- cbz r4, .L16
- mov r4, r2
-.L4:
- strb r5, [r3], #1
- lsls r2, r3, #30
- bne .L6
-.L2:
- cmp r4, #3
- bls .L11
- uxtb r5, r1
- orr r5, r5, r5, lsl #8
- cmp r4, #15
- orr r5, r5, r5, lsl #16
- bls .L9
- add r2, r3, #16
- mov r6, r4
-.L10:
- subs r6, r6, #16
- cmp r6, #15
- str r5, [r2, #-16]
- str r5, [r2, #-12]
- str r5, [r2, #-8]
- str r5, [r2, #-4]
- add r2, r2, #16
- bhi .L10
- sub r2, r4, #16
- bic r2, r2, #15
- and r4, r4, #15
- adds r2, r2, #16
- cmp r4, #3
- add r3, r3, r2
- bls .L11
-.L9:
- mov r6, r3
- mov r2, r4
-.L12:
- subs r2, r2, #4
- cmp r2, #3
- str r5, [r6], #4
- bhi .L12
- subs r2, r4, #4
- bic r2, r2, #3
- adds r2, r2, #4
- add r3, r3, r2
- and r4, r4, #3
-.L11:
- cbz r4, .L16
- uxtb r1, r1
- add r4, r4, r3
-.L13:
- strb r1, [r3], #1
- cmp r3, r4
- bne .L13
-.L16:
- pop {r0, r4, r5, r6}
- bx lr
-.L14:
- mov r4, r2
- mov r3, r0
- b .L2
- .cfi_endproc
- .size memset, . - memset
-
-#endif
diff --git a/lib/c/pebble/string/memset.c b/lib/c/pebble/string/memset.c
deleted file mode 100644
index 1f6b7a063a..0000000000
--- a/lib/c/pebble/string/memset.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-///////////////////////////////////////
-// Implements:
-// void *memset(void *s, int c, size_t n);
-///////////////////////////////////////
-// Exports to apps:
-// memset
-
-#include
-#include
-#include
-
-#if !MEMSET_IMPLEMENTED_IN_ASSEMBLY
-void *memset(void *s, int c, size_t n) {
- unsigned char *p = (unsigned char*)s;
- while (n--) {
- *p++ = (unsigned char)c;
- }
- return s;
-}
-#endif
diff --git a/lib/c/pebble/string/strcat.c b/lib/c/pebble/string/strcat.c
deleted file mode 100644
index bccb594595..0000000000
--- a/lib/c/pebble/string/strcat.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* SPDX-FileCopyrightText: 2024 Google LLC */
-/* SPDX-License-Identifier: Apache-2.0 */
-
-///////////////////////////////////////
-// Implements:
-// char *strcat(char *s1, const char *s2);
-// char *strncat(char *s1, const char *s2, size_t n);
-///////////////////////////////////////
-// Exports to apps:
-// strcat, strncat
-///////////////////////////////////////
-// Notes:
-// Tuned for code size.
-
-#include