I compile firmware on the linux but I download binaries by openOCD on the windows 10.
In the source code, I found out a function LOG_DEBUG(…) in service/ind/logging.h. I think LOG_DEBUG(…) output logs if I compile firmware by DEBUG_BUILD. But I cannot any logs through USB Serial.
If LOG_DEBUG function is activated, Which port is it output the logs by LOG_DEBUG()? For example, USB Serial? SWO? any other port?
The LOG_DEBUG requires DEBUG_BUILD=y and also a LogHandler in your user firmware to catch the logs. It would normally be for USB Serial, a globally constructed object like:
SerialLogHandler logHandler(LOG_LEVEL_TRACE);
or for the hardware UART (TX), Serial1LogHandler. You can also write a custom log appender if you want to send the data somewhere else.
Thank you for your information. First of all, when the firmware was complied with DEBUG_BUILD=y, I faced with APP_FLASH overflow. So I modified memory map and solved the problem.
I could see the APP log messages and System log messages through USB serial. But the log message I wanted is not printed USB serial. For example, I appended DEBUG, LOG_DEBUG and LOG(INFO, …) into system\src\system_setup.cpp.
template<typename Config> void SystemSetupConsole<Config>::handle(char c)
{
if ('i' == c)
{
// see if we have any additional properties. This is true
// for Cellular and Mesh devices.
hal_system_info_t info = {};
info.size = sizeof(info);
HAL_OTA_Add_System_Info(&info, true, nullptr);
LOG(TRACE, "device info key/value count: %d", info.key_value_count);
LOG(INFO, "INFO : device info key/value count: %d", info.key_value_count);
print("print\r\n");
LOG_DEBUG(TRACE, "test-logdebug");
DEBUG("test-debug");
...