M5StickC의 FreeRTOS 태스크 정보 취득을 실현합니다
1 소개
작업이 어떤 상태인지 알고 싶어지고,
태스크 정보 취득의 vtaskList를 호출하면 지원 밖이었다.
신경이 쓰여서 작업 정보를 얻을 수 있는 방법을 찾았습니다.
(2021/7/16 추가) Espressif32v3.2에서 확인한 기사입니다.
2 준비
2.1 ESP-IDF 준비
htps : // 이 m / ld 또는 st / ms / c6d 2a 3a 09 예 d58 a 894
3.2 esp-idf 준비를 참조하십시오.
2.2 ESP-IDF.CMD를 엽니다.
2.3 빌드 가능한 프로젝트로 이동
cd\exmple\get-start\hello_world
2.3 프로젝트 설정 메뉴를 엽니다.
idf.py menuconfig
2.4 freertos로 이동

2.5 vtasklist를 활성화하는 옵션을 설정합니다.

2.6 vTaskGetRunTimeStats를 활성화하는 옵션을 설정합니다.

2.7 save하고 종료
2.8 빌드
idf.py build
2.9 라이브러리 복사
만약을 위해 덮어 쓰는 동안 라이브러리를 백업하는 것이 좋습니다.
복사 소스
esp-idf\examples\get-started\hello_world\build\esp-idf\freertos\libfreertos.a
복사 대상
platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libfreertos.a
준비가 완료
3 함수 설명
3.1 태스크의 상태 취득
함수 이름
void vTaskList (char * pcWriteBuffer);
설명
htps //w w. f r와 s. rg / 00021. html#v sk ぃst
예: 결과
~~~
vtasklist
loopTask R 1 6200 12 1
IDLE0 R 0 1108 6 0
IDLE1 R 0 1092 7 1
Tmr Svc B 1 1564 8 0
ipc0 B 24572 2 0
esp_timer B 22 4148 1 0
ipc1 B 24540 3 1
~~~
작업 이름
작업 실행 상태
현재 스택 크기
작업 번호
xTaskCreate로 설정된 문자열
‘B’(Blocked) ‘R’(Ready) ‘D’(Deleted:waiting clean up) ‘S’(Suspended, or Blocked without a timeout)
3.2 작업 실행 시간
함수 이름
void vTaskGetRunTimeStats (char * pcWriteBuffer);
설명
htps //w w. f r와 s. rg / 00021. HTML #v sk 게 t 룬치메 S ts
예: 결과
vruntime
loopTask 159393 <1%
IDLE0 36000081 49%
IDLE1 35852602 49%
Tmr Svc 727 <1%
esp_timer 29 <1%
ipc1 21132 <1%
ipc0 2610 <1%
4 샘플 전체 코드
4.1 헤더 코드
PRIVILEGED_FUNCTION을 주석 처리합니다.
변경할 task.h 폴더
platformio\packages\framework-arduinoespressif32\tools\sdk\include\freertos\freertos\task.h
task.hvoid vTaskList( char * pcWriteBuffer );// PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
void vTaskGetRunTimeStats( char *pcWriteBuffer ); // PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
4.2 소스 코드
B 버튼을 누를 때마다 작업 정보와 작업 시간을 출력합니다.
#include <M5StickC.h>
#include <LovyanGFX.hpp>
static LGFX lcd;
// button gpio number
const uint8_t buttonA_GPIO = 37;
const uint8_t buttonB_GPIO = 39;
static void buttonA_isr(void) {
M5.update();
Serial.printf("%d A interrupt\n", millis() );
}
static void buttonB_isr(void) {
M5.update();
Serial.printf("%d B interrupt\n", millis() );
}
void setup() {
char msg_buffer[512];
// put your setup code here, to run once:
Serial.begin(115200);
// Initialize the M5Stack object
M5.begin();
lcd.init(); // 初期化
// START
lcd.fillScreen(BLACK);
lcd.setCursor(10, 10);
lcd.setTextColor(WHITE);
lcd.setTextSize(1);
lcd.printf("START");
attachInterrupt(digitalPinToInterrupt(buttonA_GPIO), buttonA_isr, CHANGE);
attachInterrupt(digitalPinToInterrupt(buttonB_GPIO), buttonB_isr, CHANGE);
vTaskList(msg_buffer);
Serial.println("vtasklist");
Serial.printf("%s", msg_buffer);
}
void loop() {
// put your main code here, to run repeatedly:
if(M5.BtnB.wasPressed() != 0 ) {
char msg_buffer[512];
Serial.printf("%d was pressB\n", millis() );
lcd.println("was pressB");
vTaskList(msg_buffer);
Serial.println("vtasklist");
Serial.printf("%s", msg_buffer);
Serial.println("vruntime");
vTaskGetRunTimeStats(msg_buffer);
Serial.printf("%s", msg_buffer);
delay(10);
}
delay(1);
}
Reference
이 문제에 관하여(M5StickC의 FreeRTOS 태스크 정보 취득을 실현합니다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/Oldcastle/items/0b89b25412f31e111175
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
2.1 ESP-IDF 준비
htps : // 이 m / ld 또는 st / ms / c6d 2a 3a 09 예 d58 a 894
3.2 esp-idf 준비를 참조하십시오.
2.2 ESP-IDF.CMD를 엽니다.
2.3 빌드 가능한 프로젝트로 이동
cd\exmple\get-start\hello_world
2.3 프로젝트 설정 메뉴를 엽니다.
idf.py menuconfig
2.4 freertos로 이동

2.5 vtasklist를 활성화하는 옵션을 설정합니다.

2.6 vTaskGetRunTimeStats를 활성화하는 옵션을 설정합니다.

2.7 save하고 종료
2.8 빌드
idf.py build
2.9 라이브러리 복사
만약을 위해 덮어 쓰는 동안 라이브러리를 백업하는 것이 좋습니다.
복사 소스
esp-idf\examples\get-started\hello_world\build\esp-idf\freertos\libfreertos.a
복사 대상
platformio\packages\framework-arduinoespressif32\tools\sdk\lib\libfreertos.a
준비가 완료
3 함수 설명
3.1 태스크의 상태 취득
함수 이름
void vTaskList (char * pcWriteBuffer);
설명
htps //w w. f r와 s. rg / 00021. html#v sk ぃst
예: 결과
~~~
vtasklist
loopTask R 1 6200 12 1
IDLE0 R 0 1108 6 0
IDLE1 R 0 1092 7 1
Tmr Svc B 1 1564 8 0
ipc0 B 24572 2 0
esp_timer B 22 4148 1 0
ipc1 B 24540 3 1
~~~
작업 이름
작업 실행 상태
현재 스택 크기
작업 번호
xTaskCreate로 설정된 문자열
‘B’(Blocked) ‘R’(Ready) ‘D’(Deleted:waiting clean up) ‘S’(Suspended, or Blocked without a timeout)
3.2 작업 실행 시간
함수 이름
void vTaskGetRunTimeStats (char * pcWriteBuffer);
설명
htps //w w. f r와 s. rg / 00021. HTML #v sk 게 t 룬치메 S ts
예: 결과
vruntime
loopTask 159393 <1%
IDLE0 36000081 49%
IDLE1 35852602 49%
Tmr Svc 727 <1%
esp_timer 29 <1%
ipc1 21132 <1%
ipc0 2610 <1%
4 샘플 전체 코드
4.1 헤더 코드
PRIVILEGED_FUNCTION을 주석 처리합니다.
변경할 task.h 폴더
platformio\packages\framework-arduinoespressif32\tools\sdk\include\freertos\freertos\task.h
task.hvoid vTaskList( char * pcWriteBuffer );// PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
void vTaskGetRunTimeStats( char *pcWriteBuffer ); // PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
4.2 소스 코드
B 버튼을 누를 때마다 작업 정보와 작업 시간을 출력합니다.
#include <M5StickC.h>
#include <LovyanGFX.hpp>
static LGFX lcd;
// button gpio number
const uint8_t buttonA_GPIO = 37;
const uint8_t buttonB_GPIO = 39;
static void buttonA_isr(void) {
M5.update();
Serial.printf("%d A interrupt\n", millis() );
}
static void buttonB_isr(void) {
M5.update();
Serial.printf("%d B interrupt\n", millis() );
}
void setup() {
char msg_buffer[512];
// put your setup code here, to run once:
Serial.begin(115200);
// Initialize the M5Stack object
M5.begin();
lcd.init(); // 初期化
// START
lcd.fillScreen(BLACK);
lcd.setCursor(10, 10);
lcd.setTextColor(WHITE);
lcd.setTextSize(1);
lcd.printf("START");
attachInterrupt(digitalPinToInterrupt(buttonA_GPIO), buttonA_isr, CHANGE);
attachInterrupt(digitalPinToInterrupt(buttonB_GPIO), buttonB_isr, CHANGE);
vTaskList(msg_buffer);
Serial.println("vtasklist");
Serial.printf("%s", msg_buffer);
}
void loop() {
// put your main code here, to run repeatedly:
if(M5.BtnB.wasPressed() != 0 ) {
char msg_buffer[512];
Serial.printf("%d was pressB\n", millis() );
lcd.println("was pressB");
vTaskList(msg_buffer);
Serial.println("vtasklist");
Serial.printf("%s", msg_buffer);
Serial.println("vruntime");
vTaskGetRunTimeStats(msg_buffer);
Serial.printf("%s", msg_buffer);
delay(10);
}
delay(1);
}
Reference
이 문제에 관하여(M5StickC의 FreeRTOS 태스크 정보 취득을 실현합니다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/Oldcastle/items/0b89b25412f31e111175
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
vruntime
loopTask 159393 <1%
IDLE0 36000081 49%
IDLE1 35852602 49%
Tmr Svc 727 <1%
esp_timer 29 <1%
ipc1 21132 <1%
ipc0 2610 <1%
4.1 헤더 코드
PRIVILEGED_FUNCTION을 주석 처리합니다.
변경할 task.h 폴더
platformio\packages\framework-arduinoespressif32\tools\sdk\include\freertos\freertos\task.h
task.h
void vTaskList( char * pcWriteBuffer );// PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
void vTaskGetRunTimeStats( char *pcWriteBuffer ); // PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
4.2 소스 코드
B 버튼을 누를 때마다 작업 정보와 작업 시간을 출력합니다.
#include <M5StickC.h>
#include <LovyanGFX.hpp>
static LGFX lcd;
// button gpio number
const uint8_t buttonA_GPIO = 37;
const uint8_t buttonB_GPIO = 39;
static void buttonA_isr(void) {
M5.update();
Serial.printf("%d A interrupt\n", millis() );
}
static void buttonB_isr(void) {
M5.update();
Serial.printf("%d B interrupt\n", millis() );
}
void setup() {
char msg_buffer[512];
// put your setup code here, to run once:
Serial.begin(115200);
// Initialize the M5Stack object
M5.begin();
lcd.init(); // 初期化
// START
lcd.fillScreen(BLACK);
lcd.setCursor(10, 10);
lcd.setTextColor(WHITE);
lcd.setTextSize(1);
lcd.printf("START");
attachInterrupt(digitalPinToInterrupt(buttonA_GPIO), buttonA_isr, CHANGE);
attachInterrupt(digitalPinToInterrupt(buttonB_GPIO), buttonB_isr, CHANGE);
vTaskList(msg_buffer);
Serial.println("vtasklist");
Serial.printf("%s", msg_buffer);
}
void loop() {
// put your main code here, to run repeatedly:
if(M5.BtnB.wasPressed() != 0 ) {
char msg_buffer[512];
Serial.printf("%d was pressB\n", millis() );
lcd.println("was pressB");
vTaskList(msg_buffer);
Serial.println("vtasklist");
Serial.printf("%s", msg_buffer);
Serial.println("vruntime");
vTaskGetRunTimeStats(msg_buffer);
Serial.printf("%s", msg_buffer);
delay(10);
}
delay(1);
}
Reference
이 문제에 관하여(M5StickC의 FreeRTOS 태스크 정보 취득을 실현합니다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/Oldcastle/items/0b89b25412f31e111175텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)