2121#include "freertos/FreeRTOS.h"
2222#include "freertos/task.h"
2323#include "sdkconfig.h"
24- #include "soc/rtc_cntl_reg.h"
2524
2625#ifdef CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
2726 #define WITH_TASKS_INFO 1
3029static void register_free ();
3130static void register_heap_dump ();
3231static void register_restart ();
33- static void register_make ();
3432#if WITH_TASKS_INFO
3533static void register_tasks ();
3634#endif
@@ -39,7 +37,6 @@ void register_system() {
3937 register_free ();
4038 register_heap_dump ();
4139 register_restart ();
42- register_make ();
4340#if WITH_TASKS_INFO
4441 register_tasks ();
4542#endif
@@ -122,105 +119,3 @@ static void register_tasks() {
122119}
123120
124121#endif // WITH_TASKS_INFO
125-
126- /** This command helps maintain sanity when testing console example from a console */
127-
128- static int make (int argc , char * * argv ) {
129- int count = REG_READ (RTC_CNTL_STORE0_REG );
130- if (++ count >= 3 ) {
131- printf ("This is not the console you are looking for.\n" );
132- return 0 ;
133- }
134- REG_WRITE (RTC_CNTL_STORE0_REG , count );
135-
136- const char * make_output =
137- R "(LD build/console.elf
138- esptool .py v2 .1 - beta1
139- )";
140-
141- const char * flash_output [] = {
142- R "(Flashing binaries to serial port (*) (app at offset 0x10000)...
143- esptool .py v2 .1 - beta1
144- Connecting ....
145- )",
146- R "(Chip is ESP32D0WDQ6 (revision 0)
147- Uploading stub ...
148- Running stub ...
149- Stub running ...
150- Changing baud rate to 921600
151- Changed .
152- Configuring flash size ...
153- Auto - detected Flash size : 4 MB
154- Flash params set to 0x0220
155- Compressed 15712 bytes to 9345. ..
156- )",
157- R "(Wrote 15712 bytes (9345 compressed) at 0x00001000 in 0.1 seconds (effective 1126.9 kbit/s)...
158- Hash of data verified .
159- Compressed 333776 bytes to 197830. ..
160- )",
161- R "(Wrote 333776 bytes (197830 compressed) at 0x00010000 in 3.3 seconds (effective 810.3 kbit/s)...
162- Hash of data verified .
163- Compressed 3072 bytes to 82. ..
164- )",
165- R "(Wrote 3072 bytes (82 compressed) at 0x00008000 in 0.0 seconds (effective 1588.4 kbit/s)...
166- Hash of data verified .
167- Leaving ...
168- Hard resetting ...
169- )"};
170-
171- const char * monitor_output =
172- R "(MONITOR
173- )" LOG_COLOR_W R "(--- idf_monitor on (*) 115200 ---
174- -- - Quit : Ctrl + ] | Menu : Ctrl + T | Help : Ctrl + T followed by Ctrl + H --
175- )" LOG_RESET_COLOR ;
176-
177- bool need_make = false;
178- bool need_flash = false;
179- bool need_monitor = false;
180- for (int i = 1 ; i < argc ; ++ i ) {
181- if (strcmp (argv [i ], "all" ) == 0 ) {
182- need_make = true;
183- } else if (strcmp (argv [i ], "flash ") == 0 ) {
184- need_make = true;
185- need_flash = true;
186- } else if (strcmp (argv [i ], "monitor ") == 0 ) {
187- need_monitor = true;
188- } else if (argv [i ][0 ] == '- ') {
189- /* probably -j option */
190- } else if (isdigit ((int )argv [i ][0 ])) {
191- /* might be an argument to -j */
192- } else {
193- printf ("make : * * * No rule to make target `%s '. Stop .\n ", argv[i]);
194- /* Technically this is an error, but let's not spoil the output */
195- return 0 ;
196- }
197- }
198- if (argc == 1 ) {
199- need_make = true;
200- }
201- if (need_make ) {
202- printf ("%s" , make_output );
203- }
204- if (need_flash ) {
205- size_t n_items = sizeof (flash_output ) / sizeof (flash_output [0 ]);
206- for (int i = 0 ; i < n_items ; ++ i ) {
207- printf ("%s" , flash_output [i ]);
208- vTaskDelay (200 / portTICK_PERIOD_MS );
209- }
210- }
211- if (need_monitor ) {
212- printf ("%s" , monitor_output );
213- esp_restart ();
214- }
215- return 0 ;
216- }
217-
218- static void register_make () {
219- const esp_console_cmd_t cmd = {
220- .command = "make" ,
221- .help = NULL , /* hide from 'help' output */
222- .hint = "all | flash | monitor" ,
223- .func = & make ,
224- };
225- ESP_ERROR_CHECK (esp_console_cmd_register (& cmd ));
226- }
0 commit comments