diff options
| author | Author Name <[email protected]> | 2023-07-07 12:20:59 +0930 |
|---|---|---|
| committer | David Rowe <[email protected]> | 2023-07-07 12:29:06 +0930 |
| commit | ac7c48b4dee99d4c772f133d70d8d1b38262fcd2 (patch) | |
| tree | a2d0ace57a9c0e2e5b611c4987f6fed1b38b81e7 /stm32/cmake | |
shallow zip-file copy from codec2 e9d726bf20
Diffstat (limited to 'stm32/cmake')
| -rw-r--r-- | stm32/cmake/STM32_Lib.cmake | 348 | ||||
| -rw-r--r-- | stm32/cmake/STM32_Toolchain.cmake | 15 | ||||
| -rw-r--r-- | stm32/cmake/arm_header.cmake | 64 | ||||
| -rw-r--r-- | stm32/cmake/gencodebooks.cmake | 173 |
4 files changed, 600 insertions, 0 deletions
diff --git a/stm32/cmake/STM32_Lib.cmake b/stm32/cmake/STM32_Lib.cmake new file mode 100644 index 0000000..f336862 --- /dev/null +++ b/stm32/cmake/STM32_Lib.cmake @@ -0,0 +1,348 @@ +################################################### + +# Definitions for the STM32F4 Standard Peripheral Library + +#set(PERIPHLIBURL http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/firmware) +#set(PERIPHLIBZIP stm32f4_dsp_stdperiph_lib.zip) +set(PERIPHLIBVER 1.8.0) +set(PERIPHLIBNAME STM32F4xx_DSP_StdPeriph_Lib_V) + +if(NOT PERIPHLIBDIR) + set(PERIPHLIBDIR ${CMAKE_SOURCE_DIR}/${PERIPHLIBNAME}${PERIPHLIBVER}) + message(STATUS "Using default path for StdPeriph Lib: ${PERIPHLIBDIR}") +endif() + +set(CMSIS ${PERIPHLIBDIR}/Libraries/CMSIS) +set(STM32F4LIB ${PERIPHLIBDIR}/Libraries/STM32F4xx_StdPeriph_Driver) +set(STM32F4TEMPLATE ${PERIPHLIBDIR}/Project/STM32F4xx_StdPeriph_Templates) +set(DSPLIB ${PERIPHLIBDIR}/Libraries/CMSIS/DSP_Lib) + +add_definitions(-DUSE_STDPERIPH_DRIVER -DARM_MATH_CM4 -DHSE_VALUE=\(\(uint32_t\)8000000\)) +include_directories(${STM32F4LIB}/inc ${STM32F4TEMPLATE} + ${CMSIS}/Include ${CMSIS}/Device/ST/STM32F4xx/Include) + + +set(STM32F4LIB_SRCS +${STM32F4LIB}/src/misc.c +${STM32F4LIB}/src/stm32f4xx_adc.c +${STM32F4LIB}/src/stm32f4xx_can.c +${STM32F4LIB}/src/stm32f4xx_cec.c +${STM32F4LIB}/src/stm32f4xx_crc.c +${STM32F4LIB}/src/stm32f4xx_cryp_aes.c +${STM32F4LIB}/src/stm32f4xx_cryp.c +${STM32F4LIB}/src/stm32f4xx_cryp_des.c +${STM32F4LIB}/src/stm32f4xx_cryp_tdes.c +${STM32F4LIB}/src/stm32f4xx_dac.c +${STM32F4LIB}/src/stm32f4xx_dbgmcu.c +${STM32F4LIB}/src/stm32f4xx_dcmi.c +${STM32F4LIB}/src/stm32f4xx_dma2d.c +${STM32F4LIB}/src/stm32f4xx_dma.c +${STM32F4LIB}/src/stm32f4xx_exti.c +${STM32F4LIB}/src/stm32f4xx_flash.c +${STM32F4LIB}/src/stm32f4xx_flash_ramfunc.c +${STM32F4LIB}/src/stm32f4xx_fmpi2c.c +${STM32F4LIB}/src/stm32f4xx_fsmc.c +${STM32F4LIB}/src/stm32f4xx_gpio.c +${STM32F4LIB}/src/stm32f4xx_hash.c +${STM32F4LIB}/src/stm32f4xx_hash_md5.c +${STM32F4LIB}/src/stm32f4xx_hash_sha1.c +${STM32F4LIB}/src/stm32f4xx_i2c.c +${STM32F4LIB}/src/stm32f4xx_iwdg.c +${STM32F4LIB}/src/stm32f4xx_ltdc.c +${STM32F4LIB}/src/stm32f4xx_pwr.c +${STM32F4LIB}/src/stm32f4xx_qspi.c +${STM32F4LIB}/src/stm32f4xx_rcc.c +${STM32F4LIB}/src/stm32f4xx_rng.c +${STM32F4LIB}/src/stm32f4xx_rtc.c +${STM32F4LIB}/src/stm32f4xx_sai.c +${STM32F4LIB}/src/stm32f4xx_sdio.c +${STM32F4LIB}/src/stm32f4xx_spdifrx.c +${STM32F4LIB}/src/stm32f4xx_spi.c +${STM32F4LIB}/src/stm32f4xx_syscfg.c +${STM32F4LIB}/src/stm32f4xx_tim.c +${STM32F4LIB}/src/stm32f4xx_usart.c +${STM32F4LIB}/src/stm32f4xx_wwdg.c +# Not compiling for now +# $(STM32F4LIB)/src/stm32f4xx_fmc.c +) + +add_library(stm32f4 STATIC ${STM32F4LIB_SRCS}) + + +set(CMSIS_SRCS +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_abs_f32.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_abs_q15.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_abs_q31.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_abs_q7.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_add_f32.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_add_q15.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_add_q31.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_add_q7.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_f32.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q15.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q31.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_dot_prod_q7.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_mult_f32.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_mult_q15.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_mult_q31.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_mult_q7.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_negate_f32.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_negate_q15.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_negate_q31.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_negate_q7.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_offset_f32.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_offset_q15.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_offset_q31.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_offset_q7.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_scale_f32.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_scale_q15.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_scale_q31.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_scale_q7.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_shift_q15.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_shift_q31.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_shift_q7.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_sub_f32.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_sub_q15.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_sub_q31.c +${CMSIS}/DSP_Lib/Source/BasicMathFunctions/arm_sub_q7.c +${CMSIS}/DSP_Lib/Source/CommonTables/arm_common_tables.c +${CMSIS}/DSP_Lib/Source/CommonTables/arm_const_structs.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_f32.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q15.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_conj_q31.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_f32.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q15.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_dot_prod_q31.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_f32.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q15.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_q31.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_f32.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q15.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mag_squared_q31.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_f32.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q15.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_cmplx_q31.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_f32.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q15.c +${CMSIS}/DSP_Lib/Source/ComplexMathFunctions/arm_cmplx_mult_real_q31.c +${CMSIS}/DSP_Lib/Source/ControllerFunctions/arm_pid_init_f32.c +${CMSIS}/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q15.c +${CMSIS}/DSP_Lib/Source/ControllerFunctions/arm_pid_init_q31.c +${CMSIS}/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_f32.c +${CMSIS}/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q15.c +${CMSIS}/DSP_Lib/Source/ControllerFunctions/arm_pid_reset_q31.c +${CMSIS}/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_f32.c +${CMSIS}/DSP_Lib/Source/ControllerFunctions/arm_sin_cos_q31.c +${CMSIS}/DSP_Lib/Source/FastMathFunctions/arm_cos_f32.c +${CMSIS}/DSP_Lib/Source/FastMathFunctions/arm_cos_q15.c +${CMSIS}/DSP_Lib/Source/FastMathFunctions/arm_cos_q31.c +${CMSIS}/DSP_Lib/Source/FastMathFunctions/arm_sin_f32.c +${CMSIS}/DSP_Lib/Source/FastMathFunctions/arm_sin_q15.c +${CMSIS}/DSP_Lib/Source/FastMathFunctions/arm_sin_q31.c +${CMSIS}/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q15.c +${CMSIS}/DSP_Lib/Source/FastMathFunctions/arm_sqrt_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_init_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_32x64_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_fast_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_init_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df1_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_f64.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_init_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_df2T_init_f64.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_stereo_df2T_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_biquad_cascade_stereo_df2T_init_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_opt_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_fast_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_opt_q7.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_opt_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_fast_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_opt_q7.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_partial_q7.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_conv_q7.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_correlate_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_opt_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_correlate_fast_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_correlate_opt_q7.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_correlate_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_correlate_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_correlate_q7.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_fast_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_init_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_decimate_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_fast_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_init_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_init_q7.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_init_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_interpolate_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_init_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_lattice_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_q7.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q7.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_q7.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_init_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_iir_lattice_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_init_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_init_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_f32.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_init_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_norm_q31.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_q15.c +${CMSIS}/DSP_Lib/Source/FilteringFunctions/arm_lms_q31.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_add_f32.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q15.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_add_q31.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_cmplx_mult_f32.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_cmplx_mult_q15.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_cmplx_mult_q31.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_init_f32.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q15.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_init_q31.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_inverse_f32.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_inverse_f64.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_f32.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q15.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_fast_q31.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q15.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_mult_q31.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_f32.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q15.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_scale_q31.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_f32.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q15.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_sub_q31.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_f32.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q15.c +${CMSIS}/DSP_Lib/Source/MatrixFunctions/arm_mat_trans_q31.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_max_f32.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_max_q15.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_max_q31.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_max_q7.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_mean_f32.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_mean_q15.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_mean_q31.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_mean_q7.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_min_f32.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_min_q15.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_min_q31.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_min_q7.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_power_f32.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_power_q15.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_power_q31.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_power_q7.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_rms_f32.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_rms_q15.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_rms_q31.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_std_f32.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_std_q15.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_std_q31.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_var_f32.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_var_q15.c +${CMSIS}/DSP_Lib/Source/StatisticsFunctions/arm_var_q31.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_copy_f32.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_copy_q15.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_copy_q31.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_copy_q7.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_fill_f32.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_fill_q15.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_fill_q31.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_fill_q7.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_float_to_q15.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_float_to_q31.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_float_to_q7.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_q15_to_float.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_q15_to_q31.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_q15_to_q7.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_q31_to_float.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_q31_to_q15.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_q31_to_q7.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_q7_to_float.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_q7_to_q15.c +${CMSIS}/DSP_Lib/Source/SupportFunctions/arm_q7_to_q31.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_bitreversal.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_bitreversal2.S +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_q15.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_q31.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q15.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_init_q31.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q15.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix2_q31.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q15.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_init_q31.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q15.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix4_q31.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_cfft_radix8_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_dct4_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_dct4_init_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q15.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_dct4_init_q31.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_dct4_q15.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_dct4_q31.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_rfft_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_rfft_fast_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_rfft_fast_init_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_rfft_init_f32.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q15.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_rfft_init_q31.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_rfft_q15.c +${CMSIS}/DSP_Lib/Source/TransformFunctions/arm_rfft_q31.c +) + +add_library(CMSIS STATIC ${CMSIS_SRCS}) +target_compile_options(CMSIS PRIVATE "-Wno-double-promotion") diff --git a/stm32/cmake/STM32_Toolchain.cmake b/stm32/cmake/STM32_Toolchain.cmake new file mode 100644 index 0000000..18d4667 --- /dev/null +++ b/stm32/cmake/STM32_Toolchain.cmake @@ -0,0 +1,15 @@ +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_PROCESSOR arm) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp") + +# specify the cross compiler +set(CMAKE_C_COMPILER ${ARM_GCC_BIN}arm-none-eabi-gcc) +set(CMAKE_CXX_COMPILER ${ARM_GCC_BIN}arm-none-eabi-cpp) +set(CMAKE_ASM ${ARM_GCC_BIN}arm-none-eabi-as) +set(CMAKE_OBJCOPY ${ARM_GCC_BIN}arm-none-eabi-objcopy) +set(CMAKE_C_FLAGS_INIT "-specs=nosys.specs" CACHE STRING "Required compiler init flags") +set(CMAKE_CXX_FLAGS_INIT "-specs=nosys.specs" CACHE STRING "Required compiler init flags") +## https://stackoverflow.com/questions/10599038/can-i-skip-cmake-compiler-tests-or-avoid-error-unrecognized-option-rdynamic +set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") diff --git a/stm32/cmake/arm_header.cmake b/stm32/cmake/arm_header.cmake new file mode 100644 index 0000000..7b9130e --- /dev/null +++ b/stm32/cmake/arm_header.cmake @@ -0,0 +1,64 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4) + +#custom command to use objcopy to create .bin files out of ELF files +function(make_mbed_firmware INPUT) + add_custom_command(TARGET ${INPUT} + COMMAND arm-none-eabi-objcopy -O binary ${INPUT} ${INPUT}_${MBED_TARGET}.bin + COMMENT "objcopying to make mbed compatible firmware") + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${INPUT}_${MBED_TARGET}.bin) +endfunction(make_mbed_firmware) + +#assume we're using an LPC1768 model if it's not specified by -DMBED_TARGET= + if( NOT MBED_TARGET MATCHES "LPC1768" AND NOT MBED_TARGET MATCHES "LPC2368" AND NOT MBED_TARGET MATCHES "LPC11U24") + message(STATUS "invalid or no mbed target specified. Options are LPC1768, LPC2368 or LPC11U24. Assuming LPC1768 for now. + Target may be specified using -DMBED_TARGET=") + set(MBED_TARGET "LPC1768") +endif( NOT MBED_TARGET MATCHES "LPC1768" AND NOT MBED_TARGET MATCHES "LPC2368" AND NOT MBED_TARGET MATCHES "LPC11U24") + +set(MBED_INCLUDE "${CMAKE_SOURCE_DIR}/mbed/${MBED_TARGET}/GCC_CS/") + +#setup target specific object files +if(MBED_TARGET MATCHES "LPC1768") + set(MBED_PREFIX "LPC17") + set(CORE "cm3") + set(CHIP ${MBED_INCLUDE}sys.o + ${MBED_INCLUDE}startup_LPC17xx.o) +elseif(MBED_TARGET MATCHES "LPC2368") + set(CHIP ${MBED_INCLUDE}vector_functions.o + ${MBED_INCLUDE}vector_realmonitor.o + ${MBED_INCLUDE}vector_table.o) + set(MBED_PREFIX "LPC23") + set(CORE "arm7") +elseif(MBED_TARGET MATCHES "LPC11U24") + set(CHIP ${MBED_INCLUDE}sys.o + ${MBED_INCLUDE}startup_LPC11xx.o) + set(CORE "cm0") + set(MBED_PREFIX "LPC11U") +endif(MBED_TARGET MATCHES "LPC1768") + +#setup precompiled mbed files which will be needed for all projects +set(CHIP ${CHIP} + ${MBED_INCLUDE}system_${MBED_PREFIX}xx.o + ${MBED_INCLUDE}cmsis_nvic.o + ${MBED_INCLUDE}core_${CORE}.o) + +#force min size build type +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) +endif(NOT CMAKE_BUILD_TYPE) + +#set correct linker script +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \"-T${CMAKE_SOURCE_DIR}/mbed/${MBED_TARGET}/GCC_CS/${MBED_TARGET}.ld\" -static") + +#find CodeSourcery Toolchain for appropriate include dirs +find_path(CSPATH arm-none-eabi-g++ PATHS ENV) +message(STATUS "${CSPATH} is where CodeSourcery is installed") + +#setup directories for appropriate C, C++, mbed libraries and includes +include_directories(${MBED_INCLUDE}) +include_directories(mbed) +include_directories(${CSPATH}/../arm-none-eabi/include) +include_directories(${CSPATH}/../arm-none-eabi/include/c++/4.6.1) +link_directories(${MBED_INCLUDE}) diff --git a/stm32/cmake/gencodebooks.cmake b/stm32/cmake/gencodebooks.cmake new file mode 100644 index 0000000..1ead372 --- /dev/null +++ b/stm32/cmake/gencodebooks.cmake @@ -0,0 +1,173 @@ +# +# Generated sources +# + +set(D ${CMAKE_CURRENT_SOURCE_DIR}/../src/codebook) + +# lsp quantisers + +set(CODEBOOKS + ${D}/lsp1.txt + ${D}/lsp2.txt + ${D}/lsp3.txt + ${D}/lsp4.txt + ${D}/lsp5.txt + ${D}/lsp6.txt + ${D}/lsp7.txt + ${D}/lsp8.txt + ${D}/lsp9.txt + ${D}/lsp10.txt +) + +# lspd quantisers + +set(CODEBOOKSD + ${D}/dlsp1.txt + ${D}/dlsp2.txt + ${D}/dlsp3.txt + ${D}/dlsp4.txt + ${D}/dlsp5.txt + ${D}/dlsp6.txt + ${D}/dlsp7.txt + ${D}/dlsp8.txt + ${D}/dlsp9.txt + ${D}/dlsp10.txt +) + +set(CODEBOOKSJMV + ${D}/lspjmv1.txt + ${D}/lspjmv2.txt + ${D}/lspjmv3.txt +) + +set(CODEBOOKSMEL + ${D}/mel1.txt + ${D}/mel2.txt + ${D}/mel3.txt + ${D}/mel4.txt + ${D}/mel5.txt + ${D}/mel6.txt +) + +set(CODEBOOKSLSPMELVQ + ${D}/lspmelvq1.txt + ${D}/lspmelvq2.txt + ${D}/lspmelvq3.txt +) + +set(CODEBOOKSGE ${D}/gecb.txt) + +set(CODEBOOKSNEWAMP1 + ${D}/train_120_1.txt + ${D}/train_120_2.txt +) + +set(CODEBOOKSNEWAMP1_ENERGY + ${D}/newamp1_energy_q.txt +) + +set(CODEBOOKSNEWAMP2 + ${D}/codes_450.txt +) + +set(CODEBOOKSNEWAMP2_ENERGY + ${D}/newamp2_energy_q.txt +) + +# when crosscompiling we need a native executable +if(CMAKE_CROSSCOMPILING) + include(ExternalProject) + set(SOURCE_DIR ${CMAKE_SOURCE_DIR}/..) + ExternalProject_Add(codec2_native + SOURCE_DIR ${SOURCE_DIR} + BINARY_DIR ${CMAKE_BINARY_DIR}/src/codec2_native + CONFIGURE_COMMAND ${CMAKE_COMMAND} ${SOURCE_DIR} + BUILD_COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/src/codec2_native --target generate_codebook + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy src/generate_codebook ${CMAKE_CURRENT_BINARY_DIR} + ) + add_executable(generate_codebook IMPORTED) + set_target_properties(generate_codebook + PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/generate_codebook) + add_dependencies(generate_codebook codec2_native) +else(CMAKE_CROSSCOMPILING) +# Build code generator binaries. These do not get installed. + # generate_codebook + add_executable(generate_codebook generate_codebook.c) + target_link_libraries(generate_codebook ${CMAKE_REQUIRED_LIBRARIES}) + # Make native builds available for cross-compiling. + export(TARGETS generate_codebook + FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake) +endif(CMAKE_CROSSCOMPILING) + + +# codebook.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebook.c + COMMAND generate_codebook lsp_cb ${CODEBOOKS} > ${CMAKE_CURRENT_BINARY_DIR}/codebook.c + DEPENDS generate_codebook ${CODEBOOKS} +) + +# codebookd.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookd.c + COMMAND generate_codebook lsp_cbd ${CODEBOOKSD} > ${CMAKE_CURRENT_BINARY_DIR}/codebookd.c + DEPENDS generate_codebook ${CODEBOOKSD} +) + +# codebookjmv.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookjmv.c + COMMAND generate_codebook lsp_cbjmv ${CODEBOOKSJMV} > ${CMAKE_CURRENT_BINARY_DIR}/codebookjmv.c + DEPENDS generate_codebook ${CODEBOOKSJMV} +) + + +# codebookmel.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookmel.c + COMMAND generate_codebook mel_cb ${CODEBOOKSMEL} > ${CMAKE_CURRENT_BINARY_DIR}/codebookmel.c + DEPENDS generate_codebook ${CODEBOOKSMEL} +) + +# codebooklspmelvq.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebooklspmelvq.c + COMMAND generate_codebook lspmelvq_cb ${CODEBOOKSLSPMELVQ} > ${CMAKE_CURRENT_BINARY_DIR}/codebooklspmelvq.c + DEPENDS generate_codebook ${CODEBOOKSLSPMELVQ} +) + +# codebookge.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebookge.c + COMMAND generate_codebook ge_cb ${CODEBOOKSGE} > ${CMAKE_CURRENT_BINARY_DIR}/codebookge.c + DEPENDS generate_codebook ${CODEBOOKSGE} +) + +# codebooknewamp1.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebooknewamp1.c + COMMAND generate_codebook newamp1vq_cb ${CODEBOOKSNEWAMP1} > ${CMAKE_CURRENT_BINARY_DIR}/codebooknewamp1.c + DEPENDS generate_codebook ${CODEBOOKSNEWAMP1} +) + +# codebooknewamp1_energy.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebooknewamp1_energy.c + COMMAND generate_codebook newamp1_energy_cb ${CODEBOOKSNEWAMP1_ENERGY} > ${CMAKE_CURRENT_BINARY_DIR}/codebooknewamp1_energy.c + DEPENDS generate_codebook ${CODEBOOKSNEWAMP1_ENERGY} +) + +# codebooknewamp2.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebooknewamp2.c + COMMAND generate_codebook newamp2vq_cb ${CODEBOOKSNEWAMP2} > ${CMAKE_CURRENT_BINARY_DIR}/codebooknewamp2.c + DEPENDS generate_codebook ${CODEBOOKSNEWAMP2} +) + +# codebooknewamp2_energy.c +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/codebooknewamp2_energy.c + COMMAND generate_codebook newamp2_energy_cb ${CODEBOOKSNEWAMP2_ENERGY} > ${CMAKE_CURRENT_BINARY_DIR}/codebooknewamp2_energy.c + DEPENDS generate_codebook ${CODEBOOKSNEWAMP2_ENERGY} +) + |
