Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2cdb594
Start omi2 firmware
beastoin Apr 17, 2025
c09d52e
feat: Add mic, codec, and transport initialization to omi2 main
beastoin Apr 17, 2025
9e7be1f
feat: add dk2 source files to CMakeLists.txt
beastoin Apr 17, 2025
a56b0f1
chore: Update Kconfig source configuration
beastoin Apr 17, 2025
2fe3f53
feat: add Kconfig.omi for omi2 firmware feature configuration
beastoin Apr 17, 2025
8ff4a0e
fix: update Kconfig source path to resolve file not found error
beastoin Apr 17, 2025
2815644
fix: update Kconfig source path to use CMAKE_CURRENT_LIST_DIR
beastoin Apr 17, 2025
76621d5
fix: update Kconfig source path to use absolute path
beastoin Apr 17, 2025
7a5080f
refactor: Update CMakeLists.txt to selectively include dk2 source files
beastoin Apr 17, 2025
1bf960b
feat: add Kconfig configuration support with conditional compilation …
beastoin Apr 17, 2025
e01cc3d
Enable mic #1
beastoin Apr 17, 2025
b0d0edb
Tuning dtsi ram/flash config
beastoin Apr 17, 2025
06287a8
Reducing mem usage by disable shell
beastoin Apr 17, 2025
78c95e7
Enable mic only
beastoin Apr 17, 2025
6f0cad1
Use omi2 pins for mic
beastoin Apr 17, 2025
af57ed2
Add logs for codec handler
beastoin Apr 17, 2025
bc3eb1a
Clean-up dk2 > transport.c
beastoin Apr 17, 2025
e4dfead
Add transport #1
beastoin Apr 17, 2025
8215780
Wiring mic -> ble #1
beastoin Apr 18, 2025
1a9f955
Tuning audio bytes transports
beastoin Apr 18, 2025
c5c0eb8
Tuning BLE transports
beastoin Apr 18, 2025
ba381d6
Update README with installing guides
beastoin Apr 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@
reg = <0x20040000 DT_SIZE_K(192)>;
};
};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ ram: 192
flash: 192
toolchain:
- zephyr
supported: []
supported: []
160 changes: 160 additions & 0 deletions omi/firmware/firmware/omi2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
enable_language(C ASM) # OPUS

project(omi2)

file(GLOB app_sources src/main.c src/mic.c)
file(GLOB dk2_sources src/lib/dk2/codec.c src/lib/dk2/config.h src/lib/dk2/transport.c)
target_sources(app PRIVATE ${dk2_sources} ${app_sources})

# OPUS
target_sources_ifdef(CONFIG_OMI_CODEC_OPUS app PRIVATE
src/lib/dk2/lib/opus-1.2.1/A2NLSF.c
src/lib/dk2/lib/opus-1.2.1/CNG.c
src/lib/dk2/lib/opus-1.2.1/HP_variable_cutoff.c
src/lib/dk2/lib/opus-1.2.1/LPC_analysis_filter.c
src/lib/dk2/lib/opus-1.2.1/LPC_fit.c
src/lib/dk2/lib/opus-1.2.1/LPC_inv_pred_gain.c
src/lib/dk2/lib/opus-1.2.1/LP_variable_cutoff.c
src/lib/dk2/lib/opus-1.2.1/LTP_analysis_filter_FIX.c
src/lib/dk2/lib/opus-1.2.1/LTP_scale_ctrl_FIX.c
src/lib/dk2/lib/opus-1.2.1/NLSF2A.c
src/lib/dk2/lib/opus-1.2.1/NLSF_VQ.c
src/lib/dk2/lib/opus-1.2.1/NLSF_VQ_weights_laroia.c
src/lib/dk2/lib/opus-1.2.1/NLSF_decode.c
src/lib/dk2/lib/opus-1.2.1/NLSF_del_dec_quant.c
src/lib/dk2/lib/opus-1.2.1/NLSF_encode.c
src/lib/dk2/lib/opus-1.2.1/NLSF_stabilize.c
src/lib/dk2/lib/opus-1.2.1/NLSF_unpack.c
src/lib/dk2/lib/opus-1.2.1/NSQ.c
src/lib/dk2/lib/opus-1.2.1/NSQ_del_dec.c
src/lib/dk2/lib/opus-1.2.1/PLC.c
src/lib/dk2/lib/opus-1.2.1/VAD.c
src/lib/dk2/lib/opus-1.2.1/VQ_WMat_EC.c
src/lib/dk2/lib/opus-1.2.1/ana_filt_bank_1.c
src/lib/dk2/lib/opus-1.2.1/analysis.c
src/lib/dk2/lib/opus-1.2.1/apply_sine_window_FIX.c
src/lib/dk2/lib/opus-1.2.1/autocorr_FIX.c
src/lib/dk2/lib/opus-1.2.1/bands.c
src/lib/dk2/lib/opus-1.2.1/biquad_alt.c
src/lib/dk2/lib/opus-1.2.1/burg_modified_FIX.c
src/lib/dk2/lib/opus-1.2.1/bwexpander.c
src/lib/dk2/lib/opus-1.2.1/bwexpander_32.c
src/lib/dk2/lib/opus-1.2.1/celt.c
src/lib/dk2/lib/opus-1.2.1/celt_decoder.c
src/lib/dk2/lib/opus-1.2.1/celt_encoder.c
src/lib/dk2/lib/opus-1.2.1/celt_lpc.c
src/lib/dk2/lib/opus-1.2.1/arm/celt_pitch_xcorr_arm_gcc.s
src/lib/dk2/lib/opus-1.2.1/check_control_input.c
src/lib/dk2/lib/opus-1.2.1/code_signs.c
src/lib/dk2/lib/opus-1.2.1/control_SNR.c
src/lib/dk2/lib/opus-1.2.1/control_audio_bandwidth.c
src/lib/dk2/lib/opus-1.2.1/control_codec.c
src/lib/dk2/lib/opus-1.2.1/corrMatrix_FIX.c
src/lib/dk2/lib/opus-1.2.1/cwrs.c
src/lib/dk2/lib/opus-1.2.1/debug.c
src/lib/dk2/lib/opus-1.2.1/dec_API.c
src/lib/dk2/lib/opus-1.2.1/decode_core.c
src/lib/dk2/lib/opus-1.2.1/decode_frame.c
src/lib/dk2/lib/opus-1.2.1/decode_indices.c
src/lib/dk2/lib/opus-1.2.1/decode_parameters.c
src/lib/dk2/lib/opus-1.2.1/decode_pitch.c
src/lib/dk2/lib/opus-1.2.1/decode_pulses.c
src/lib/dk2/lib/opus-1.2.1/decoder_set_fs.c
src/lib/dk2/lib/opus-1.2.1/enc_API.c
src/lib/dk2/lib/opus-1.2.1/encode_frame_FIX.c
src/lib/dk2/lib/opus-1.2.1/encode_indices.c
src/lib/dk2/lib/opus-1.2.1/encode_pulses.c
src/lib/dk2/lib/opus-1.2.1/entcode.c
src/lib/dk2/lib/opus-1.2.1/entdec.c
src/lib/dk2/lib/opus-1.2.1/entenc.c
src/lib/dk2/lib/opus-1.2.1/find_LPC_FIX.c
src/lib/dk2/lib/opus-1.2.1/find_LTP_FIX.c
src/lib/dk2/lib/opus-1.2.1/find_pitch_lags_FIX.c
src/lib/dk2/lib/opus-1.2.1/find_pred_coefs_FIX.c
src/lib/dk2/lib/opus-1.2.1/gain_quant.c
src/lib/dk2/lib/opus-1.2.1/init_decoder.c
src/lib/dk2/lib/opus-1.2.1/init_encoder.c
src/lib/dk2/lib/opus-1.2.1/inner_prod_aligned.c
src/lib/dk2/lib/opus-1.2.1/interpolate.c
src/lib/dk2/lib/opus-1.2.1/k2a_FIX.c
src/lib/dk2/lib/opus-1.2.1/k2a_Q16_FIX.c
src/lib/dk2/lib/opus-1.2.1/kiss_fft.c
src/lib/dk2/lib/opus-1.2.1/laplace.c
src/lib/dk2/lib/opus-1.2.1/lin2log.c
src/lib/dk2/lib/opus-1.2.1/log2lin.c
src/lib/dk2/lib/opus-1.2.1/mathops.c
src/lib/dk2/lib/opus-1.2.1/mdct.c
src/lib/dk2/lib/opus-1.2.1/mlp.c
src/lib/dk2/lib/opus-1.2.1/mlp_data.c
src/lib/dk2/lib/opus-1.2.1/modes.c
src/lib/dk2/lib/opus-1.2.1/noise_shape_analysis_FIX.c
src/lib/dk2/lib/opus-1.2.1/opus.c
src/lib/dk2/lib/opus-1.2.1/opus_decoder.c
src/lib/dk2/lib/opus-1.2.1/opus_encoder.c
src/lib/dk2/lib/opus-1.2.1/opus_multistream.c
src/lib/dk2/lib/opus-1.2.1/opus_multistream_decoder.c
src/lib/dk2/lib/opus-1.2.1/opus_multistream_encoder.c
src/lib/dk2/lib/opus-1.2.1/pitch.c
src/lib/dk2/lib/opus-1.2.1/pitch_analysis_core_FIX.c
src/lib/dk2/lib/opus-1.2.1/pitch_est_tables.c
src/lib/dk2/lib/opus-1.2.1/process_NLSFs.c
src/lib/dk2/lib/opus-1.2.1/process_gains_FIX.c
src/lib/dk2/lib/opus-1.2.1/quant_LTP_gains.c
src/lib/dk2/lib/opus-1.2.1/quant_bands.c
src/lib/dk2/lib/opus-1.2.1/rate.c
src/lib/dk2/lib/opus-1.2.1/regularize_correlations_FIX.c
src/lib/dk2/lib/opus-1.2.1/repacketizer.c
src/lib/dk2/lib/opus-1.2.1/resampler.c
src/lib/dk2/lib/opus-1.2.1/resampler_down2.c
src/lib/dk2/lib/opus-1.2.1/resampler_down2_3.c
src/lib/dk2/lib/opus-1.2.1/resampler_private_AR2.c
src/lib/dk2/lib/opus-1.2.1/resampler_private_IIR_FIR.c
src/lib/dk2/lib/opus-1.2.1/resampler_private_down_FIR.c
src/lib/dk2/lib/opus-1.2.1/resampler_private_up2_HQ.c
src/lib/dk2/lib/opus-1.2.1/resampler_rom.c
src/lib/dk2/lib/opus-1.2.1/residual_energy16_FIX.c
src/lib/dk2/lib/opus-1.2.1/residual_energy_FIX.c
src/lib/dk2/lib/opus-1.2.1/schur64_FIX.c
src/lib/dk2/lib/opus-1.2.1/schur_FIX.c
src/lib/dk2/lib/opus-1.2.1/shell_coder.c
src/lib/dk2/lib/opus-1.2.1/sigm_Q15.c
src/lib/dk2/lib/opus-1.2.1/sort.c
src/lib/dk2/lib/opus-1.2.1/stereo_LR_to_MS.c
src/lib/dk2/lib/opus-1.2.1/stereo_MS_to_LR.c
src/lib/dk2/lib/opus-1.2.1/stereo_decode_pred.c
src/lib/dk2/lib/opus-1.2.1/stereo_encode_pred.c
src/lib/dk2/lib/opus-1.2.1/stereo_find_predictor.c
src/lib/dk2/lib/opus-1.2.1/stereo_quant_pred.c
src/lib/dk2/lib/opus-1.2.1/sum_sqr_shift.c
src/lib/dk2/lib/opus-1.2.1/table_LSF_cos.c
src/lib/dk2/lib/opus-1.2.1/tables_LTP.c
src/lib/dk2/lib/opus-1.2.1/tables_NLSF_CB_NB_MB.c
src/lib/dk2/lib/opus-1.2.1/tables_NLSF_CB_WB.c
src/lib/dk2/lib/opus-1.2.1/tables_gain.c
src/lib/dk2/lib/opus-1.2.1/tables_other.c
src/lib/dk2/lib/opus-1.2.1/tables_pitch_lag.c
src/lib/dk2/lib/opus-1.2.1/tables_pulses_per_block.c
src/lib/dk2/lib/opus-1.2.1/vector_ops_FIX.c
src/lib/dk2/lib/opus-1.2.1/vq.c
src/lib/dk2/lib/opus-1.2.1/warped_autocorrelation_FIX.c
src/lib/dk2/lib/opus-1.2.1/arm/celt_pitch_xcorr_arm_gcc.s
)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DARM_MATH_CM4")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVAR_ARRAYS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPUS_ARM_ASM")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPUS_ARM_INLINE_ASM")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPUS_ARM_INLINE_EDSP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPUS_ARM_INLINE_MEDIA")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPUS_ARM_MAY_HAVE_EDSP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPUS_ARM_PRESUME_EDSP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPUS_BUILD")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_ALLOCA")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFIXED_POINT -DDISABLE_FLOAT_API")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_CONFIG_H")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_ALLOCA_H")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsingle-precision-constant") # A lot of constants are written as doubles
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_LRINT -DHAVE_LRINTF")

26 changes: 26 additions & 0 deletions omi/firmware/firmware/omi2/CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 0
},
"configurePresets": [
{
"name": "OMI2",
"displayName": "OMI2",
"configuration": "Debug",
"hidden": false,
"description": "Debug build for omi2 device",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/omi2",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "YES",
"CMAKE_BUILD_TYPE": "Debug",
"BOARD": "omi2/nrf5340/cpuapp",
"CACHED_CONF_FILE": "${sourceDir}/omi2.conf",
"CONF_FILE": "${sourceDir}/omi2.conf"
}
}
]
}
58 changes: 58 additions & 0 deletions omi/firmware/firmware/omi2/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
source "Kconfig.zephyr"

menu "Omi Features Configuration"

config OMI_CODEC_OPUS
bool "Opus Audio Codec"
help
"Enable the Opus audio codec support."
default n

config OMI_ENABLE_OFFLINE_STORAGE
bool "Offline SD Card Storage"
select DISK_ACCESS
select FILE_SYSTEM
select FAT_FILESYSTEM_ELM
select FS_FATFS_MOUNT_MKFS
select FS_FATFS_EXFAT
help
"Enable the offline storage support. Requires a SD Card."
default n

config OMI_ENABLE_ACCELEROMETER
bool "Accelerometer Support"
help
"Enable the accelerometer support."
default n

config OMI_ENABLE_BUTTON
bool "Button support"
help
"Enable the software button support."
default n

config OMI_ENABLE_SPEAKER
bool "Enable the speaker"
help
"Enable the speaker support."
default n

config OMI_ENABLE_BATTERY
bool "Enable the battery"
help
"Enable the battery support."
default n

config OMI_ENABLE_USB
bool "Enable the usb"
help
"Enable the USB power check support."
default n

config OMI_ENABLE_HAPTIC
bool "Enable the haptic"
help
"Enable the haptic support."
default n

endmenu
56 changes: 56 additions & 0 deletions omi/firmware/firmware/omi2/Kconfig.omi
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
menu "Omi2 Features Configuration"

config OMI2_CODEC_OPUS
bool "Opus Audio Codec"
help
"Enable the Opus audio codec support."
default n

config OMI2_ENABLE_OFFLINE_STORAGE
bool "Offline SD Card Storage"
select DISK_ACCESS
select FILE_SYSTEM
select FAT_FILESYSTEM_ELM
select FS_FATFS_MOUNT_MKFS
select FS_FATFS_EXFAT
help
"Enable the offline storage support. Requires a SD Card."
default n

config OMI2_ENABLE_ACCELEROMETER
bool "Accelerometer Support"
help
"Enable the accelerometer support."
default n

config OMI2_ENABLE_BUTTON
bool "Button support"
help
"Enable the software button support."
default n

config OMI2_ENABLE_SPEAKER
bool "Enable the speaker"
help
"Enable the speaker support."
default n

config OMI2_ENABLE_BATTERY
bool "Enable the battery"
help
"Enable the battery support."
default n

config OMI2_ENABLE_USB
bool "Enable the usb"
help
"Enable the USB power check support."
default n

config OMI2_ENABLE_HAPTIC
bool "Enable the haptic"
help
"Enable the haptic support."
default n

endmenu
13 changes: 13 additions & 0 deletions omi/firmware/firmware/omi2/Kconfig.sysbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright (c) 2023 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"

config NRF_DEFAULT_IPC_RADIO
default y

config NETCORE_IPC_RADIO_BT_HCI_IPC
default y
44 changes: 44 additions & 0 deletions omi/firmware/firmware/omi2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# OMI2 Firmware

The firmware for the omi consumer version.

## Install

Use https://docs.omi.me/docs/developer/firmware/Compile_firmware as the reference with these specifications.

- NCS: 2.9.0
- Application: omi2
- Board: omi2/nrf5340/cpuapp, you could also use the [CMakePresets.json](CMakePresets.json).

## WIP

- Status: DEV

- TODOs:
- [x] Testing new modules in omi2 device
- [x] Mic
- [x] BLE
- [x] Buttons
- [x] Leds
- [ ] Wifi, partialy
- [ ] Motors
- [x] Add support MCUBoot
- [x] Add the basic MCUBoot
- [ ] Testing with the omi app (iOS/Android)
- [ ] Init project, basic main loop with tests and the devkit firwmare as libs
- [x] Streaming and transcripting
- [x] Mic
- [x] BLE
- [x] Encoding(OPUS) and Transmiting
- [ ] Fix the audio byte loss issue, about 30%
- [ ] Leds
- [ ] Buttons
- [ ] SD Card
- [ ] Storing files
- [ ] Transfering via BLE
- [ ] Transfering via Wifi
- [ ] Haptic
- [ ] Battery
- [ ] Charger
- [ ] Update the omi devkit firmware deps to compatible with new NCS 2.9.0

Loading