mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-07 01:18:33 +00:00
Added 'optimize for debug' option
This commit is contained in:
@@ -5,18 +5,17 @@ import { Deferred } from '@theia/core/lib/common/promise-util';
|
||||
import { FileSystem } from '@theia/filesystem/lib/common';
|
||||
import {
|
||||
BoardsService, AttachedSerialBoard, BoardPackage, Board, AttachedNetworkBoard, BoardsServiceClient,
|
||||
Port, BoardDetails, Tool, ToolLocations, BoardDetailLocations
|
||||
Port, BoardDetails, Tool
|
||||
} from '../common/protocol/boards-service';
|
||||
import {
|
||||
PlatformSearchReq, PlatformSearchResp, PlatformInstallReq, PlatformInstallResp, PlatformListReq,
|
||||
PlatformListResp, Platform, PlatformUninstallResp, PlatformUninstallReq
|
||||
} from './cli-protocol/commands/core_pb';
|
||||
import { CoreClientProvider } from './core-client-provider';
|
||||
import { BoardListReq, BoardListResp, BoardDetailsReq, BoardDetailsResp, RequiredTool } from './cli-protocol/commands/board_pb';
|
||||
import { BoardListReq, BoardListResp, BoardDetailsReq, BoardDetailsResp } from './cli-protocol/commands/board_pb';
|
||||
import { ToolOutputServiceServer } from '../common/protocol/tool-output-service';
|
||||
import { Installable } from '../common/protocol/installable';
|
||||
import { ConfigService } from '../common/protocol/config-service';
|
||||
import * as path from 'path';
|
||||
|
||||
@injectable()
|
||||
export class BoardsServiceImpl implements BoardsService {
|
||||
@@ -237,59 +236,18 @@ export class BoardsServiceImpl implements BoardsService {
|
||||
const tools = await Promise.all(resp.getRequiredToolsList().map(async t => <Tool>{
|
||||
name: t.getName(),
|
||||
packager: t.getPackager(),
|
||||
version: t.getVersion(),
|
||||
locations: await this.getToolLocations(t),
|
||||
version: t.getVersion()
|
||||
}));
|
||||
|
||||
return {
|
||||
item: {
|
||||
name: resp.getName(),
|
||||
fqbn: options.id,
|
||||
requiredTools: tools,
|
||||
locations: await this.getBoardLocations(resp)
|
||||
requiredTools: tools
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: these location should come from the CLI/daemon rather than us botching them together
|
||||
protected async getBoardLocations(details: BoardDetailsResp): Promise<BoardDetailLocations | undefined> {
|
||||
const config = await this.configService.getConfiguration();
|
||||
const datadir = await this.fileSystem.getFsPath(config.dataDirUri);
|
||||
if (!datadir) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
debugScript: path.join(datadir, "packages", "arduino", "hardware", "samd", "1.8.4", "variants", "arduino_zero", "openocd_scripts", "arduino_zero.cfg")
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: these location should come from the CLI/daemon rather than us botching them together
|
||||
protected async getToolLocations(t: RequiredTool): Promise<ToolLocations | undefined> {
|
||||
const config = await this.configService.getConfiguration();
|
||||
const datadir = await this.fileSystem.getFsPath(config.dataDirUri);
|
||||
if (!datadir) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const toolBasePath = path.join(datadir, "packages", "arduino", "tools");
|
||||
let loc: ToolLocations = {
|
||||
main: path.join(toolBasePath, t.getName(), t.getVersion())
|
||||
};
|
||||
|
||||
switch (t.getName()) {
|
||||
case "openocd":
|
||||
loc.scripts = path.join(loc.main, "share", "openocd", "scripts");
|
||||
loc.main = path.join(loc.main, "bin", "openocd");
|
||||
break;
|
||||
case "arm-none-eabi-gcc":
|
||||
["gdb", "objdump"].forEach(s => loc[s] = path.join(loc.main, "bin", `arm-none-eabi-${s}`));
|
||||
break;
|
||||
}
|
||||
|
||||
return loc;
|
||||
}
|
||||
|
||||
async search(options: { query?: string }): Promise<{ items: BoardPackage[] }> {
|
||||
const coreClient = await this.coreClientProvider.getClient();
|
||||
if (!coreClient) {
|
||||
|
||||
Reference in New Issue
Block a user