Regeneration CubeMX (Appli) preparant le driver ST67W611M1 et la carte SD : - SPI4 (PE12/13/14, CS PF8) + DMA GPDMA1 canaux 4/5, SPI_RDY (PD12/EXTI12), CHIP_EN (PD13) et BOOT (PD15) pour la X-NUCLEO-67W61M1 sur l'Arduino - SDMMC1 + FatFs (appels d'init non generes dans main, IRQ SDMMC1 prio 14), PM14 en open-drain ; I2S6_CK sur PA5 pour liberer PC12 (SDMMC1_CK) - HAL UART retire ; USE_BSP_COM_FEATURE=0 - Audio preserve : ADF 4/16/24, prio IRQ 2, DMA canal 0 en priorite haute, GPDMA1_Channel2_IRQHandler deplace dans audio_irq.c (hors fichiers generes), BSP_MX_I2S6_Init (renommage dans le BSP pour eviter le conflit avec CubeMX) - Middlewares/ST/ST67W6X_Network_Driver, FatFs et sources HAL SPI/SD ajoutes (driver ST67 pas encore integre au build) Build et debug sous Linux : - gcc/toolchain-env.sh, gdbserver.sh, arm-gdb.sh : outils de STM32CubeIDE par glob ; flash.sh les retrouve ; ruby_compat.rb pour Ruby >= 3.2 (TouchGFX) - makefile_appli : sources SD/SPI/FatFs/audio_irq ; chmod +x des .out TouchGFX - Objets de build (*.o, *.d, *.su) retires de l'index (deja dans .gitignore) - AGENTS.md : toolchain Linux, configs VS Code (cppdbg et ST stlinkgdbtarget), pieges de l'extension ST (.settings/ide.store.json, preRunCommands reset) Verifie sur carte : audio OK, debug Appli/Boot OK. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
225 lines
7.8 KiB
C
225 lines
7.8 KiB
C
/**
|
|
******************************************************************************
|
|
* @file logging.h
|
|
* @author ST67 Application Team
|
|
* @brief This file is part of the FreeRTOS logging interface
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* Copyright (c) 2024 STMicroelectronics.
|
|
* All rights reserved.
|
|
*
|
|
* This software is licensed under terms that can be found in the LICENSE file
|
|
* in the root directory of this software component.
|
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
|
|
/**
|
|
* Portions of this file are based on FreeRTOS, which is licensed under the MIT license as indicated below.
|
|
* See https://www.FreeRTOS.org/logging.html for more information.
|
|
*
|
|
* Reference source:
|
|
* https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS-Plus/Source/Utilities/logging/logging.h
|
|
*/
|
|
|
|
/*
|
|
* FreeRTOS V202212.00
|
|
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
* this software and associated documentation files (the "Software"), to deal in
|
|
* the Software without restriction, including without limitation the rights to
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
* subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
* copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*
|
|
* https://www.FreeRTOS.org
|
|
* https://github.com/FreeRTOS
|
|
*
|
|
*/
|
|
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
#ifndef LOGGING_H
|
|
#define LOGGING_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include <stdint.h>
|
|
#include "logging_config.h"
|
|
#include "logging_levels.h"
|
|
|
|
/* Exported macros -----------------------------------------------------------*/
|
|
/** @defgroup ST67W6X_Utilities_Logging_Macros ST67W6X Utility Logging Macros
|
|
* @ingroup ST67W6X_Utilities_Logging
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* \def LogError( ... )
|
|
* Send a message to the log with level ::LOG_ERROR.
|
|
*/
|
|
|
|
/**
|
|
* \def LogErrorEx( line, file, ... )
|
|
* Send a message with line number and file name to the log with level ::LOG_ERROR.
|
|
*/
|
|
|
|
/**
|
|
* \def LogInfo( ... )
|
|
* Send a message to the log with level ::LOG_INFO.
|
|
*/
|
|
|
|
/**
|
|
* \def LogWarn( ... )
|
|
* Send a message to the log with level ::LOG_WARN.
|
|
*/
|
|
|
|
/**
|
|
* \def LogDebug( ... )
|
|
* Send a message to the log with level ::LOG_DEBUG.
|
|
*/
|
|
|
|
#ifndef LOG_LEVEL
|
|
/** Global verbosity level (LOG_NONE, LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_DEBUG) */
|
|
#define LOG_LEVEL LOG_INFO
|
|
#endif /* LOG_LEVEL */
|
|
|
|
/* Get rid of extra C89 style parentheses generated by core FreeRTOS libraries */
|
|
|
|
/** Macro to remove the extra parentheses. */
|
|
#define REMOVE
|
|
|
|
/** Convert a macro parameter to a string. */
|
|
#define STR_( ... ) REM ## __VA_ARGS__
|
|
|
|
/** Convert a macro parameter to a string. */
|
|
#define STR( ... ) STR_( __VA_ARGS__ )
|
|
|
|
/** Removes at most one outer set of parentheses from its arguments. */
|
|
#define OVE( ... ) OVE __VA_ARGS__
|
|
|
|
/** Removes at most one outer set of parentheses from its arguments. */
|
|
#define REMOVE_PARENS( ... ) STR( OVE __VA_ARGS__ )
|
|
|
|
#if defined(__ICCARM__) || defined(__ICCRX__) /* For IAR Compiler */
|
|
#ifndef __FILE_NAME__
|
|
/* coverity[misra_c_2012_rule_21_1_violation : FALSE] */
|
|
/* coverity[misra_c_2012_rule_21_2_violation : FALSE] */
|
|
#define __FILE_NAME__ __FILE__
|
|
#endif /* ! __FILE_NAME__ */
|
|
#endif /* __ICCARM__ */
|
|
|
|
/**
|
|
* Disable definition of logging interface macros when generating doxygen output,
|
|
* to avoid conflict with documentation of macros at the end of the file.
|
|
*/
|
|
/* Check that LOG_LEVEL is defined and has a valid value. */
|
|
#if !defined( LOG_LEVEL ) || \
|
|
( ( LOG_LEVEL != LOG_NONE ) && \
|
|
( LOG_LEVEL != LOG_ERROR ) && \
|
|
( LOG_LEVEL != LOG_WARN ) && \
|
|
( LOG_LEVEL != LOG_INFO ) && \
|
|
( LOG_LEVEL != LOG_DEBUG ) )
|
|
|
|
#error "Please define LOG_LEVEL as either LOG_NONE, LOG_ERROR, LOG_WARN, LOG_INFO, or LOG_DEBUG."
|
|
#else
|
|
#if ( LOG_LEVEL >= LOG_ERROR )
|
|
#define LogError( ... ) vLoggingPrintf( LOG_ERROR, 1U, __LINE__, __FILE_NAME__, REMOVE_PARENS( __VA_ARGS__ ) )
|
|
|
|
#define LogErrorEx(line, file, ... ) vLoggingPrintf( LOG_ERROR, 1U, line, file, REMOVE_PARENS( __VA_ARGS__ ) )
|
|
#else
|
|
#define LogError( ... )
|
|
#define LogErrorEx(line, file, ... )
|
|
#endif /* ( LOG_LEVEL >= LOG_ERROR ) */
|
|
|
|
#if ( LOG_LEVEL >= LOG_WARN )
|
|
#define LogWarn( ... ) vLoggingPrintf( LOG_WARN, 1U, __LINE__, __FILE_NAME__, REMOVE_PARENS( __VA_ARGS__ ) )
|
|
#else
|
|
#define LogWarn( ... )
|
|
#endif /* ( LOG_LEVEL >= LOG_WARN ) */
|
|
|
|
#if ( LOG_LEVEL >= LOG_INFO )
|
|
#define LogInfo( ... ) vLoggingPrintf( LOG_INFO, 0U, 0U, (void *)0, REMOVE_PARENS( __VA_ARGS__ ) )
|
|
#else
|
|
#define LogInfo( ... )
|
|
#endif /* ( LOG_LEVEL >= LOG_INFO ) */
|
|
|
|
#if ( LOG_LEVEL >= LOG_DEBUG )
|
|
#define LogDebug( ... ) vLoggingPrintf( LOG_DEBUG, 0U, 0U, (void *)0, REMOVE_PARENS( __VA_ARGS__ ) )
|
|
#else
|
|
#define LogDebug( ... )
|
|
#endif /* ( LOG_LEVEL >= LOG_DEBUG ) */
|
|
#endif /* LOG_LEVEL */
|
|
|
|
/** @} */
|
|
|
|
/* Exported functions ------------------------------------------------------- */
|
|
/** @defgroup ST67W6X_Utilities_Logging_Functions ST67W6X Utility Logging Functions
|
|
* @ingroup ST67W6X_Utilities_Logging
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* @brief Printf like function to print a message in the log. The application should not use it directly,
|
|
* but it must uses the log macros:
|
|
* - LogError
|
|
* - LogWarn
|
|
* - LogInfo
|
|
* - LogDebug
|
|
* @param log_level specifies the type of log entry
|
|
* @param metadata_print specifies if the metadata should be printed
|
|
* @param line_number specifies the line number in the compilation unit generating the log message. \
|
|
* is automatically generated by the log macros.
|
|
* @param p_file_name specifies the name of the file generating the log message. \
|
|
* is automatically generated by the log macros.
|
|
* @param p_format printf like format string
|
|
*/
|
|
void vLoggingPrintf(uint32_t log_level,
|
|
const uint8_t metadata_print,
|
|
const uint32_t line_number,
|
|
const char *const p_file_name,
|
|
const char *const p_format,
|
|
...);
|
|
|
|
/**
|
|
* @brief Initialize the logging service
|
|
* @param LogOutput_cb [IN] specifies the callback to output the message. \
|
|
* The callback shall not return until it is completed
|
|
* @return NULL in case of error, a pointer to the logging service otherwise
|
|
*/
|
|
void *vLoggingInit(void (*LogOutput_cb)(const char *message));
|
|
|
|
/**
|
|
* @brief Reset the logging service
|
|
*/
|
|
void vLoggingDeInit(void);
|
|
|
|
/**
|
|
* @brief Set the verbose level
|
|
* @param level [IN] the maximum log level to be printed
|
|
*/
|
|
void vLoggingSetVerbosity(uint32_t level);
|
|
|
|
/** @} */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* LOGGING_H */
|