Skip to content

Commit

Permalink
Add astra & hades projects
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed May 24, 2023
1 parent 2214f43 commit 9a970ad
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
run: |
mkdir firmware
cp build/src/kyma/Release/kyma.bin firmware
cp build/src/hades/Release/hades.bin firmware
cp build/src/astra/Release/astra.bin firmware
- name: Upload coverage artifacts
uses: actions/upload-artifact@v3
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ add_subdirectory(${LIBDAISY_DIR})
add_subdirectory(3rd_party/tetl/include)

add_subdirectory(lib)

add_subdirectory(src/astra)
add_subdirectory(src/hades)
add_subdirectory(src/kyma)
57 changes: 57 additions & 0 deletions src/astra/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
project(astra)

add_executable(astra)

target_sources(astra
PRIVATE
main.cpp
)

target_link_libraries(astra
PRIVATE
daisy
mc::audio
)

set_target_properties(astra PROPERTIES
SUFFIX
".elf"
LINK_DEPENDS
${LINKER_SCRIPT}
)

target_link_options(astra PUBLIC
-T ${LINKER_SCRIPT}
-Wl,-Map=astra.map,--cref
-Wl,--check-sections
-Wl,--unresolved-symbols=report-all
-Wl,--warn-common
-Wl,--warn-section-align
-Wl,--print-memory-usage
)

add_custom_command(TARGET astra POST_BUILD
COMMAND
${CMAKE_OBJCOPY}
ARGS
-O ihex -S $<TARGET_FILE:astra> $<TARGET_FILE_BASE_NAME:astra>.hex
BYPRODUCTS
astra.hex
COMMENT
"Generating HEX image"
VERBATIM
)

add_custom_command(TARGET astra POST_BUILD
COMMAND
${CMAKE_OBJCOPY}
ARGS
-O binary -S $<TARGET_FILE:astra> $<TARGET_FILE_BASE_NAME:astra>.bin
WORKING_DIRECTORY
$<TARGET_FILE_DIR:astra>
BYPRODUCTS
astra.bin
COMMENT
"Generating binary image"
VERBATIM
)
37 changes: 37 additions & 0 deletions src/astra/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <daisy_patch_sm.h>

namespace astra
{

static constexpr auto BLOCK_SIZE = 16U;
static constexpr auto SAMPLE_RATE = 96'000.0F;

auto patch = daisy::patch_sm::DaisyPatchSM{};

auto audioCallback(daisy::AudioHandle::InputBuffer in, daisy::AudioHandle::OutputBuffer out, size_t size) -> void
{
patch.ProcessAllControls();

for (size_t i = 0; i < size; ++i)
{
auto const left = IN_L[i];
auto const right = IN_R[i];

OUT_L[i] = left;
OUT_R[i] = right;
}
}

} // namespace astra

auto main() -> int
{
using namespace astra;

patch.Init();
patch.SetAudioSampleRate(SAMPLE_RATE);
patch.SetAudioBlockSize(BLOCK_SIZE);
patch.StartAudio(audioCallback);

while (true) {}
}
57 changes: 57 additions & 0 deletions src/hades/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
project(hades)

add_executable(hades)

target_sources(hades
PRIVATE
main.cpp
)

target_link_libraries(hades
PRIVATE
daisy
mc::audio
)

set_target_properties(hades PROPERTIES
SUFFIX
".elf"
LINK_DEPENDS
${LINKER_SCRIPT}
)

target_link_options(hades PUBLIC
-T ${LINKER_SCRIPT}
-Wl,-Map=hades.map,--cref
-Wl,--check-sections
-Wl,--unresolved-symbols=report-all
-Wl,--warn-common
-Wl,--warn-section-align
-Wl,--print-memory-usage
)

add_custom_command(TARGET hades POST_BUILD
COMMAND
${CMAKE_OBJCOPY}
ARGS
-O ihex -S $<TARGET_FILE:hades> $<TARGET_FILE_BASE_NAME:hades>.hex
BYPRODUCTS
hades.hex
COMMENT
"Generating HEX image"
VERBATIM
)

add_custom_command(TARGET hades POST_BUILD
COMMAND
${CMAKE_OBJCOPY}
ARGS
-O binary -S $<TARGET_FILE:hades> $<TARGET_FILE_BASE_NAME:hades>.bin
WORKING_DIRECTORY
$<TARGET_FILE_DIR:hades>
BYPRODUCTS
hades.bin
COMMENT
"Generating binary image"
VERBATIM
)
37 changes: 37 additions & 0 deletions src/hades/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <daisy_patch_sm.h>

namespace hades
{

static constexpr auto BLOCK_SIZE = 16U;
static constexpr auto SAMPLE_RATE = 96'000.0F;

auto patch = daisy::patch_sm::DaisyPatchSM{};

auto audioCallback(daisy::AudioHandle::InputBuffer in, daisy::AudioHandle::OutputBuffer out, size_t size) -> void
{
patch.ProcessAllControls();

for (size_t i = 0; i < size; ++i)
{
auto const left = IN_L[i];
auto const right = IN_R[i];

OUT_L[i] = left;
OUT_R[i] = right;
}
}

} // namespace hades

auto main() -> int
{
using namespace hades;

patch.Init();
patch.SetAudioSampleRate(SAMPLE_RATE);
patch.SetAudioBlockSize(BLOCK_SIZE);
patch.StartAudio(audioCallback);

while (true) {}
}

0 comments on commit 9a970ad

Please sign in to comment.