Merge remote-tracking branch 'origin/dev' into release-candidate
This commit is contained in:
		
						commit
						f82484d447
					
				
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							| @ -148,3 +148,7 @@ format: | ||||
| guruguru: | ||||
| 	@echo "ぐるぐる回る" | ||||
| 	@$(PROJECT_ROOT)/scripts/guruguru.py $(PROJECT_ROOT) | ||||
| 
 | ||||
| .PHONY: generate_compile_db | ||||
| generate_compile_db: | ||||
| 	@$(MAKE) -C $(PROJECT_ROOT)/firmware -j$(NPROCS) generate_compile_db | ||||
| @ -298,7 +298,7 @@ int32_t music_player_app(void* p) { | ||||
|         if(p) { | ||||
|             string_cat_str(file_path, p); | ||||
|         } else { | ||||
|             char* file_name = malloc(256); | ||||
|             char file_name[256] = {0}; | ||||
|             DialogsApp* dialogs = furi_record_open("dialogs"); | ||||
|             bool res = dialog_file_select_show( | ||||
|                 dialogs, | ||||
| @ -315,7 +315,6 @@ int32_t music_player_app(void* p) { | ||||
|             string_cat_str(file_path, MUSIC_PLAYER_APP_PATH_FOLDER); | ||||
|             string_cat_str(file_path, "/"); | ||||
|             string_cat_str(file_path, file_name); | ||||
|             free(file_name); | ||||
|         } | ||||
| 
 | ||||
|         if(!music_player_worker_load(music_player->worker, string_get_cstr(file_path))) { | ||||
|  | ||||
| @ -23,6 +23,7 @@ static void music_player_cli(Cli* cli, string_t args, void* context) { | ||||
|         } | ||||
| 
 | ||||
|         printf("Press CTRL+C to stop\r\n"); | ||||
|         music_player_worker_set_volume(music_player_worker, 1.0f); | ||||
|         music_player_worker_start(music_player_worker); | ||||
|         while(!cli_cmd_interrupt_received(cli)) { | ||||
|             osDelay(50); | ||||
|  | ||||
| @ -102,6 +102,8 @@ MusicPlayerWorker* music_player_worker_alloc() { | ||||
|     furi_thread_set_context(instance->thread, instance); | ||||
|     furi_thread_set_callback(instance->thread, music_player_worker_thread_callback); | ||||
| 
 | ||||
|     instance->volume = 1.0f; | ||||
| 
 | ||||
|     return instance; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -155,6 +155,22 @@ generate_cscope_db: | ||||
| 	@cscope -b -k -i $(OBJ_DIR)/source.list -f $(OBJ_DIR)/cscope.out | ||||
| 	@rm -rf $(OBJ_DIR)/source.list $(OBJ_DIR)/source.list.p | ||||
| 
 | ||||
| .PHONY: generate_compile_db | ||||
| generate_compile_db: | ||||
| 	@echo "$(ASM_SOURCES)" | tr ' ' '\n' > $(OBJ_DIR)/db.asm_source.list | ||||
| 	@echo "$(C_SOURCES)" | tr ' ' '\n' > $(OBJ_DIR)/db.c_source.list | ||||
| 	@echo "$(CPP_SOURCES)" | tr ' ' '\n' > $(OBJ_DIR)/db.cpp_source.list | ||||
| 	@echo "$(AS)$(CFLAGS)" | tr ' ' '\n' > $(OBJ_DIR)/db.asm_flags.list | ||||
| 	@echo "$(CC)$(CFLAGS)" | tr ' ' '\n' > $(OBJ_DIR)/db.c_flags.list | ||||
| 	@echo "$(CPP)$(CFLAGS)$(CPPFLAGS)" | tr ' ' '\n' > $(OBJ_DIR)/db.cpp_flags.list | ||||
| 	@$(PROJECT_ROOT)/scripts/compile_db.py generate -p $(OBJ_DIR) | ||||
| 	@rm $(OBJ_DIR)/db.asm_source.list | ||||
| 	@rm $(OBJ_DIR)/db.c_source.list | ||||
| 	@rm $(OBJ_DIR)/db.cpp_source.list | ||||
| 	@rm $(OBJ_DIR)/db.asm_flags.list | ||||
| 	@rm $(OBJ_DIR)/db.c_flags.list | ||||
| 	@rm $(OBJ_DIR)/db.cpp_flags.list | ||||
| 
 | ||||
| # Prevent make from searching targets for real files
 | ||||
| %.d: ; | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										77
									
								
								scripts/compile_db.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										77
									
								
								scripts/compile_db.py
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,77 @@ | ||||
| #!/usr/bin/env python3 | ||||
| 
 | ||||
| from flipper.app import App | ||||
| import json | ||||
| import pathlib | ||||
| 
 | ||||
| 
 | ||||
| class Main(App): | ||||
|     def init(self): | ||||
|         self.subparsers = self.parser.add_subparsers(help="sub-command help") | ||||
| 
 | ||||
|         # generate | ||||
|         self.parser_generate = self.subparsers.add_parser( | ||||
|             "generate", help="Check source code format and file names" | ||||
|         ) | ||||
|         self.parser_generate.add_argument("-p", dest="path", required=True) | ||||
|         self.parser_generate.set_defaults(func=self.generate) | ||||
| 
 | ||||
|     def parse_sources(self, path, source_path, flags_path): | ||||
|         flags = "" | ||||
|         with open(path + "/" + flags_path) as f: | ||||
|             for line in f: | ||||
|                 if line.strip(): | ||||
|                     flags += line.strip() + " " | ||||
| 
 | ||||
|         local_path = str(pathlib.Path().resolve()) | ||||
| 
 | ||||
|         data = [] | ||||
|         with open(path + "/" + source_path) as f: | ||||
|             for line in f: | ||||
|                 if line.strip(): | ||||
|                     file = line.strip() | ||||
|                     data.append( | ||||
|                         { | ||||
|                             "directory": local_path, | ||||
|                             "command": flags + "-c " + file, | ||||
|                             "file": file, | ||||
|                         } | ||||
|                     ) | ||||
|         return data | ||||
| 
 | ||||
|     def generate(self): | ||||
|         DB_SOURCE = [ | ||||
|             { | ||||
|                 "name": "ASM", | ||||
|                 "source": "db.asm_source.list", | ||||
|                 "flags": "db.asm_flags.list", | ||||
|             }, | ||||
|             {"name": "C", "source": "db.c_source.list", "flags": "db.c_flags.list"}, | ||||
|             { | ||||
|                 "name": "CPP", | ||||
|                 "source": "db.cpp_source.list", | ||||
|                 "flags": "db.cpp_flags.list", | ||||
|             }, | ||||
|         ] | ||||
| 
 | ||||
|         path = self.args.path | ||||
|         out_data = [] | ||||
|         out_path = path + "/" + "compile_commands.json" | ||||
|         out_file = open(out_path, mode="w") | ||||
| 
 | ||||
|         for record in DB_SOURCE: | ||||
|             self.logger.info( | ||||
|                 f"Processing {record['name']} ({record['source']}, {record['flags']})" | ||||
|             ) | ||||
|             data = self.parse_sources(path, record["source"], record["flags"]) | ||||
|             out_data += data | ||||
| 
 | ||||
|         self.logger.info(f"Saving") | ||||
|         json.dump(out_data, out_file, indent=2) | ||||
| 
 | ||||
|         self.logger.info(f"Compilation DB written to " + out_path) | ||||
|         return 0 | ||||
| 
 | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
|     Main()() | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Aleksandr Kutuzov
						Aleksandr Kutuzov