board_android-IoT/STM32F 2025. 2. 28. 22:50

 


//#ifdef __GNUC__
//#warning "__GNUC__ is defined ---------" 
//  // With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf  set to 'Yes') calls __io_putchar() 
//  #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
//#else
//#warning "__GNUC__ is -------------- not !!!!    defined  --- keil  "   
//  #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
//#endif /* __GNUC__ */
//  
  
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)  // for  keil    
/**
  * @brief  Retargets the C library printf function to the USART.
  * @param  None
  * @retval None
  */
PUTCHAR_PROTOTYPE
{
  /* Place your implementation of fputc here */
  /* e.g. write a character to the EVAL_COM1 and Loop until the end of transmission */
  HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xFFFF);
 
  return ch;
}

//int _write(int file, char *ptr, int len) {
//    HAL_UART_Transmit(&huart2, (uint8_t *)ptr, len, HAL_MAX_DELAY);
//    return len;
//}
/*
// UART2 리다이렉트 (printf 사용 가능)
int _write(int file, char *ptr, int len) {
    HAL_UART_Transmit(&huart2, (uint8_t*) ptr, len, HAL_MAX_DELAY);
    return len;
}
*/

 

posted by cskimair
:
board_android-IoT/STM32F 2025. 2. 20. 10:20

 

posted by cskimair
:
board_android-IoT/STM32F 2025. 2. 20. 10:19

Keil 컴파일러에서는 printf를 사용하기 위해서는 추가로 설정이 필요합니다.

아래 방법은 UART로 debug message를 보내기 위한 방법입니다 .

1. Header 추가

. String을 사용하기 위해서 #include"stdio.h" 을 추가합니다.

2.Option 변경

아래 그림 처럼 use MicroLIB를 check합니다.

3. UART로 데이터를 전송하기 위한 callback함수를 추가하셔야 합니다. 

     UART 2번으로 data를 전송하기 위해나 fputc()함수를 추가하였습니다.

   그리고  조금 특이한 것은 ferror()함수를 추가 하지 않으면, Reset vector에서 Main()함수로 jmp를 못합니다. (아직 이유는 모름)

 

https://blog.naver.com/compass1111/221624747254

 

Keil compiler printf(with uart) 하기

STM32F1 시리즈와 goodisplay E-ink display장치를 개발하고 있습니다. Keil 컴파일러에서는 printf...

blog.naver.com

 

'board_android-IoT > STM32F' 카테고리의 다른 글

STM32 printf redirection to UART  (0) 2025.02.28
How to change the readout protection on STM32F4  (0) 2025.02.20
Keil compiler printf(with uart) 하기  (0) 2025.02.18
STM Flash loader  (1) 2024.10.29
Keil, uVision , Compile size check  (0) 2024.10.12
posted by cskimair
:
board_android-IoT/STM32F 2025. 2. 18. 23:13

Keil 컴파일러에서는 printf를 사용하기 위해서는 추가로 설정이 필요합니다.

아래 방법은 UART로 debug message를 보내기 위한 방법입니다 .

1. Header 추가

. String을 사용하기 위해서 #include"stdio.h" 을 추가합니다.

2.Option 변경

아래 그림 처럼 use MicroLIB를 check합니다.

3. UART로 데이터를 전송하기 위한 callback함수를 추가하셔야 합니다. 

     UART 2번으로 data를 전송하기 위해나 fputc()함수를 추가하였습니다.

   그리고  조금 특이한 것은 ferror()함수를 추가 하지 않으면, Reset vector에서 Main()함수로 jmp를 못합니다. (아직 이유는 모름)

 

https://blog.naver.com/compass1111/221624747254

 

Keil compiler printf(with uart) 하기

STM32F1 시리즈와 goodisplay E-ink display장치를 개발하고 있습니다. Keil 컴파일러에서는 printf...

blog.naver.com

 

- 아래는 CubeIDE 환경용이나 잘 동작할지는 확인 필요 

https://community.st.com/t5/stm32-mcus/how-to-redirect-the-printf-function-to-a-uart-for-debug-messages/ta-p/49865

 

How to redirect the printf function to a UART for debug messages

Introduction It can be especially useful during code development to display messages in a terminal window about various system parameters to help with debugging. An easy way to do that is to use the printf function and redirect the output to a UART for dis

community.st.com

 

'board_android-IoT > STM32F' 카테고리의 다른 글

How to change the readout protection on STM32F4  (0) 2025.02.20
Keil compiler printf(with uart) 하기  (0) 2025.02.20
STM Flash loader  (1) 2024.10.29
Keil, uVision , Compile size check  (0) 2024.10.12
LTE modem sample  (0) 2024.09.20
posted by cskimair
:
board_android-IoT/ESP32 2024. 11. 28. 10:40

 

ESP32-S3-A7670E-4G

https://www.waveshare.com/wiki/ESP32-S3-A7670E-4G

 

 

 

 

 

 

 

 

 

 

'board_android-IoT > ESP32' 카테고리의 다른 글

ESP32 응용 제품  (0) 2025.03.26
Compile on both ESP32 and ESP8266  (0) 2024.10.29
ESP32 UDP SEND_RECV example  (0) 2024.09.10
ESP32 UDP SEND_RECV example  (0) 2024.09.06
ESP8266 , DB18B20 connection  (0) 2024.07.29
posted by cskimair
:

 

 

// Source code in Arduino IDE 
#ifdef CONFIG_IDF_TARGET_ESP32
#warning  "[ESP32]"
#elif CONFIG_IDF_TARGET_ESP32S3
#warning "[ESP32S3]"
#endif 

1. if select ESP32 
> compile result: 
....: warning: #warning "[ESP32]" [-Wcpp]
 #warning  "[ESP32]"
  ^~~~~~~

2. if select ESP32S3 
- In arduino IDE, Menu: Tools-> Board -> ESP32 -> ESP32S3  

...warning: #warning "[ESP32S3]" [-Wcpp]
 #warning "[ESP32S3]"
  ^~~~~~~
 

Reference:

https://community.platformio.org/t/what-is-the-specific-if-defined-arduino-arch-esp32-for-esp32-s2-esp32-s3-esp32-c3/33833

 

What is the specific #if defined(ARDUINO_ARCH_ESP32) for ESP32-S2, ESP32-S3, ESP32-C3?

as title. what is the specific #if defined(ARDUINO_ARCH_ESP32) for ESP32-S2, ESP32-S3, ESP32-C3? I want to do something only if ESP32-S2 is used for example.

community.platformio.org

 

posted by cskimair
: