skyeye-sdk-js 1.3.4 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ export declare class RequestFactory {
11
11
  quitCommand(): JSONRequest;
12
12
  getCpuList(): JSONRequest;
13
13
  getMemoryValue(cpuName: string, baseAddr: string, length: string): JSONRequest;
14
+ setMemoryValue(cpuName: string, baseAddr: string, value: string, length: string): JSONRequest;
14
15
  enableDeviceWork(deviceName: string): JSONRequest;
15
16
  disableDeviceWork(deviceName: string): JSONRequest;
16
17
  changeDir(path: string): JSONRequest;
@@ -20,7 +21,7 @@ export declare class RequestFactory {
20
21
  getCurrentPC(cpuName: string): JSONRequest;
21
22
  getCpuMips(cpuName: string): JSONRequest;
22
23
  getGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType): JSONRequest;
23
- setGlobalVarValue(cpuName: string, varName: string, bytesNum: string, valueType: GlobalVarType, value: string): JSONRequest;
24
+ setGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType, value: string): JSONRequest;
24
25
  getDeviceList(): JSONRequest;
25
26
  getDeviceTree(): JSONRequest;
26
27
  setRegisterValue(machName: string, deviceName: string, regName: string, value: string): JSONRequest;
@@ -60,6 +60,19 @@ class RequestFactory {
60
60
  request.setRequest(baseRequest.toJSONString());
61
61
  return request;
62
62
  }
63
+ setMemoryValue(cpuName, baseAddr, value, length) {
64
+ const baseRequest = new BaseRequest_1.BaseRequest("SE_set_memory_value");
65
+ const args = {};
66
+ args.cpuname = cpuName;
67
+ args.baseaddr = "0x" + baseAddr;
68
+ args.value = value;
69
+ args.length = length;
70
+ baseRequest.setArgs(args);
71
+ const request = new skyeye_rpc_pb_1.JSONRequest();
72
+ request.setRequest(baseRequest.toJSONString());
73
+ console.log("setMemoryValue:", request);
74
+ return request;
75
+ }
63
76
  enableDeviceWork(deviceName) {
64
77
  const baseRequest = new BaseRequest_1.BaseRequest("SE_enable_device_work");
65
78
  const args = {};
@@ -145,12 +158,13 @@ class RequestFactory {
145
158
  const args = {};
146
159
  args.cpu_name = cpuName;
147
160
  args.var_name = varName;
148
- args.value_bytes_number = String(bytesNum);
161
+ args.value_bytes_number = bytesNum;
149
162
  args.value_type = valueType;
150
163
  args.value = value;
151
164
  baseRequest.setArgs(args);
152
165
  const request = new skyeye_rpc_pb_1.JSONRequest();
153
166
  request.setRequest(baseRequest.toJSONString());
167
+ console.log('setGlobalVarValue:', request);
154
168
  return request;
155
169
  }
156
170
  getDeviceList() {
@@ -42,12 +42,14 @@ export declare class SkyEyeClient extends JSONTransmissionClient {
42
42
  getCurrentCpuMips(): Promise<any>;
43
43
  getGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType): Promise<any>;
44
44
  getGlobalVarValueDefault(varName: string, valueType: GlobalVarType): Promise<any>;
45
- setGlobalVarValue(cpuName: string, varName: string, bytesNum: string, valueType: GlobalVarType, value: string): Promise<any>;
45
+ setGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType, value: string): Promise<any>;
46
46
  setGlobalVarValueDefault(varName: string, valueType: GlobalVarType, value: string): Promise<any>;
47
- getMemoryValue(cpuName: string, baseAddr: string, length: string): Promise<any>;
48
47
  getAddressingSpace(cpuName: string, baseAddr: string, length: string): Promise<any>;
48
+ getMemoryValue(cpuName: string, baseAddr: string, length: string): Promise<any>;
49
49
  getMemoryValueDefault(baseAddr: string, length: string): Promise<any>;
50
50
  getAddressingSpaceDefault(baseAddr: string, length: string): Promise<any>;
51
+ setMemoryValue(cpuName: string, baseAddr: string, value: string, length: string): Promise<any>;
52
+ setMemoryValueDefault(baseAddr: string, value: string, length: string): Promise<any>;
51
53
  getCpuRegisters(cpuName: string): Promise<GetCpuRegisterInfoResponse>;
52
54
  getCpuRegistersDefault(): Promise<GetCpuRegisterInfoResponse>;
53
55
  setCpuRegisterValueDefault(register: Register, value: string): Promise<any>;
@@ -465,7 +465,7 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
465
465
  const cpuList = (yield this.getCpuList()).getCpuList();
466
466
  if (cpuList != null && cpuList.length > 0) {
467
467
  try {
468
- return yield this.call(RequestFactory_1.RequestFactory.getInstance().setGlobalVarValue(cpuList[0].getName(), varName, "4", valueType, value));
468
+ return yield this.call(RequestFactory_1.RequestFactory.getInstance().setGlobalVarValue(cpuList[0].getName(), varName, 8, valueType, value));
469
469
  }
470
470
  catch (error) {
471
471
  console.error("Error during setGlobalVarValueDefault:", error);
@@ -478,24 +478,24 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
478
478
  }
479
479
  });
480
480
  }
481
- getMemoryValue(cpuName, baseAddr, length) {
481
+ getAddressingSpace(cpuName, baseAddr, length) {
482
482
  return __awaiter(this, void 0, void 0, function* () {
483
483
  try {
484
- return this.getAddressingSpace(cpuName, baseAddr, length);
484
+ return yield this.call(RequestFactory_1.RequestFactory.getInstance().getMemoryValue(cpuName, baseAddr, length));
485
485
  }
486
486
  catch (error) {
487
- console.error("Error during getMemoryValue:", error);
487
+ console.error("Error during getAddressingSpace:", error);
488
488
  throw error;
489
489
  }
490
490
  });
491
491
  }
492
- getAddressingSpace(cpuName, baseAddr, length) {
492
+ getMemoryValue(cpuName, baseAddr, length) {
493
493
  return __awaiter(this, void 0, void 0, function* () {
494
494
  try {
495
- return yield this.call(RequestFactory_1.RequestFactory.getInstance().getMemoryValue(cpuName, baseAddr, length));
495
+ return this.getAddressingSpace(cpuName, baseAddr, length);
496
496
  }
497
497
  catch (error) {
498
- console.error("Error during getAddressingSpace:", error);
498
+ console.error("Error during getMemoryValue:", error);
499
499
  throw error;
500
500
  }
501
501
  });
@@ -529,6 +529,35 @@ class SkyEyeClient extends skyeye_rpc_grpc_pb_1.JSONTransmissionClient {
529
529
  }
530
530
  });
531
531
  }
532
+ setMemoryValue(cpuName, baseAddr, value, length) {
533
+ return __awaiter(this, void 0, void 0, function* () {
534
+ try {
535
+ return yield this.call(RequestFactory_1.RequestFactory.getInstance().setMemoryValue(cpuName, baseAddr, value, length));
536
+ }
537
+ catch (error) {
538
+ console.error("Error during getAddressingSpaceDefault:", error);
539
+ throw error;
540
+ }
541
+ });
542
+ }
543
+ setMemoryValueDefault(baseAddr, value, length) {
544
+ return __awaiter(this, void 0, void 0, function* () {
545
+ const cpuList = (yield this.getCpuList()).getCpuList();
546
+ if (cpuList != null && cpuList.length > 0) {
547
+ try {
548
+ return yield this.setMemoryValue(cpuList[0].getName(), baseAddr, value, length);
549
+ }
550
+ catch (error) {
551
+ console.error("Error during getAddressingSpaceDefault:", error);
552
+ throw error;
553
+ }
554
+ }
555
+ else {
556
+ console.error("无法获取cpu,请确认cpu是否存在:");
557
+ throw new SkyEyeSDKException_1.SkyEyeSDKException("无法获取cpu,请确认cpu是否存在:");
558
+ }
559
+ });
560
+ }
532
561
  getCpuRegisters(cpuName) {
533
562
  return __awaiter(this, void 0, void 0, function* () {
534
563
  const response = new GetCpuRegisterInfoResponse_1.GetCpuRegisterInfoResponse();
package/dist/test.js CHANGED
@@ -203,13 +203,15 @@ function test() {
203
203
  // const port = "50051"
204
204
  // const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
205
205
  // await client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir)
206
- const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
207
- const fileName = "c6713_fc_1553b.skyeye";
208
- const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe";
206
+ // const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
207
+ // const fileName = "c6713_fc_1553b.skyeye";
208
+ // const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
209
209
  const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
210
210
  // const response =await client.getCurrentRunningState()
211
211
  // const response = await client.getMemoryValueDefault("128","4")
212
- const response = yield client.getGlobalVarValueDefault("number_b", "int");
212
+ const response = yield client.getGlobalVarValueDefault("number_a", "int");
213
+ // const response = await client.setGlobalVarValueDefault("number_a", "int", "12")
214
+ // const response = await client.getMemoryValueDefault("10001", "1")
213
215
  console.log("response:", response);
214
216
  //启动多个skyeye
215
217
  // const count = 5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skyeye-sdk-js",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "gRPC to SkyEye",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,6 +27,7 @@
27
27
  "google-protobuf": "^3.21.2",
28
28
  "lodash": "^4.6.1",
29
29
  "minimist": "^1.2.0",
30
- "protobufjs": "^7.2.6"
30
+ "protobufjs": "^7.2.6",
31
+ "skyeye-sdk-js": "^1.3.2"
31
32
  }
32
33
  }
@@ -73,6 +73,21 @@ export class RequestFactory {
73
73
  request.setRequest(baseRequest.toJSONString());
74
74
  return request;
75
75
  }
76
+ public setMemoryValue(cpuName: string, baseAddr: string, value: string, length: string) {
77
+ const baseRequest = new BaseRequest("SE_set_memory_value");
78
+ const args: { [key: string]: string } = {};
79
+ args.cpuname = cpuName;
80
+ args.baseaddr = "0x" + baseAddr;
81
+ args.value = value;
82
+ args.length = length;
83
+ baseRequest.setArgs(args)
84
+ const request = new JSONRequest()
85
+ request.setRequest(baseRequest.toJSONString());
86
+ console.log("setMemoryValue:",request)
87
+ return request;
88
+ }
89
+
90
+
76
91
 
77
92
  public enableDeviceWork(deviceName: string) {
78
93
  const baseRequest = new BaseRequest("SE_enable_device_work");
@@ -163,22 +178,23 @@ export class RequestFactory {
163
178
  baseRequest.setArgs(args)
164
179
  const request = new JSONRequest()
165
180
  request.setRequest(baseRequest.toJSONString());
166
- console.log("request:",request)
181
+ console.log("request:", request)
167
182
  return request;
168
183
  }
169
184
 
170
185
 
171
- public setGlobalVarValue(cpuName: string, varName: string, bytesNum: string, valueType: GlobalVarType, value: string) {
186
+ public setGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType, value: string) {
172
187
  const baseRequest = new BaseRequest("SE_set_global_variable_value");
173
- const args: { [key: string]: string } = {};
188
+ const args: { [key: string]: any } = {};
174
189
  args.cpu_name = cpuName;
175
190
  args.var_name = varName;
176
- args.value_bytes_number = String(bytesNum);
191
+ args.value_bytes_number = bytesNum
177
192
  args.value_type = valueType;
178
193
  args.value = value;
179
194
  baseRequest.setArgs(args)
180
195
  const request = new JSONRequest()
181
196
  request.setRequest(baseRequest.toJSONString());
197
+ console.log('setGlobalVarValue:', request)
182
198
  return request;
183
199
  }
184
200
 
@@ -214,7 +230,7 @@ export class RequestFactory {
214
230
  return request;
215
231
  }
216
232
 
217
-
233
+
218
234
  public getAllDeviceInfo() {
219
235
  const baseRequest = new BaseRequest("SE_get_all_fault_inject_device_info");
220
236
  const request = new JSONRequest()
@@ -223,7 +239,7 @@ export class RequestFactory {
223
239
  }
224
240
 
225
241
 
226
- public getRamAddrInfo(machName:string,addr:string){
242
+ public getRamAddrInfo(machName: string, addr: string) {
227
243
  const baseRequest = new BaseRequest("SE_get_mem_device_addr_info");
228
244
  const args: { [key: string]: string } = {};
229
245
  args.machName = machName;
@@ -237,7 +253,7 @@ export class RequestFactory {
237
253
 
238
254
 
239
255
 
240
- public setFaultInject(machName:string,deviceName:string,addr:string,bit:string,mode:string){
256
+ public setFaultInject(machName: string, deviceName: string, addr: string, bit: string, mode: string) {
241
257
  const baseRequest = new BaseRequest("SE_set_fault_inject");
242
258
  const args: { [key: string]: string } = {};
243
259
  args.machName = machName;
@@ -253,7 +269,7 @@ export class RequestFactory {
253
269
 
254
270
 
255
271
 
256
- public deleteFaultInject(machName:string,deviceName:string,addr:string,bit:string,mode:string){
272
+ public deleteFaultInject(machName: string, deviceName: string, addr: string, bit: string, mode: string) {
257
273
  const baseRequest = new BaseRequest("SE_delete_fault");
258
274
  const args: { [key: string]: string } = {};
259
275
  args.machName = machName;
@@ -268,7 +284,7 @@ export class RequestFactory {
268
284
  }
269
285
 
270
286
 
271
-
287
+
272
288
 
273
289
  public getFaultInjectList() {
274
290
  const baseRequest = new BaseRequest("SE_get_fault_inject_list");
@@ -279,11 +295,11 @@ export class RequestFactory {
279
295
 
280
296
 
281
297
 
282
- public getDisassembleInfo(cpuName:string,startAddr:string,nums:string){
298
+ public getDisassembleInfo(cpuName: string, startAddr: string, nums: string) {
283
299
  const baseRequest = new BaseRequest("SE_get_disassemble_info");
284
300
  const args: { [key: string]: string } = {};
285
301
  args.cpuname = cpuName;
286
- args.startAddr = "0x"+startAddr
302
+ args.startAddr = "0x" + startAddr
287
303
  args.length = nums
288
304
  baseRequest.setArgs(args)
289
305
  const request = new JSONRequest()
@@ -295,7 +311,7 @@ export class RequestFactory {
295
311
 
296
312
 
297
313
 
298
- public singleStep(cpuName:string){
314
+ public singleStep(cpuName: string) {
299
315
  const baseRequest = new BaseRequest("SE_system_step");
300
316
  const args: { [key: string]: string } = {};
301
317
  args.cpuname = cpuName;
@@ -306,7 +322,7 @@ export class RequestFactory {
306
322
  }
307
323
 
308
324
 
309
- public getcpuRegisterInfo(cpuName:string){
325
+ public getcpuRegisterInfo(cpuName: string) {
310
326
  const baseRequest = new BaseRequest("SE_get_cpu_register_info");
311
327
  const args: { [key: string]: string } = {};
312
328
  args.cpuname = cpuName;
@@ -402,7 +402,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
402
402
 
403
403
 
404
404
 
405
- public async setGlobalVarValue(cpuName: string, varName: string, bytesNum: string, valueType: GlobalVarType, value: string) {
405
+ public async setGlobalVarValue(cpuName: string, varName: string, bytesNum: number, valueType: GlobalVarType, value: string) {
406
406
  try {
407
407
  return await this.call(RequestFactory.getInstance().setGlobalVarValue(cpuName, varName, bytesNum, valueType, value))
408
408
  } catch (error) {
@@ -415,7 +415,7 @@ export class SkyEyeClient extends JSONTransmissionClient {
415
415
  const cpuList = (await this.getCpuList()).getCpuList();
416
416
  if (cpuList != null && cpuList.length > 0) {
417
417
  try {
418
- return await this.call(RequestFactory.getInstance().setGlobalVarValue(cpuList[0].getName(), varName, "4", valueType, value));
418
+ return await this.call(RequestFactory.getInstance().setGlobalVarValue(cpuList[0].getName(), varName, 8, valueType, value));
419
419
  } catch (error) {
420
420
  console.error("Error during setGlobalVarValueDefault:", error);
421
421
  throw error;
@@ -427,14 +427,6 @@ export class SkyEyeClient extends JSONTransmissionClient {
427
427
  }
428
428
 
429
429
 
430
- public async getMemoryValue(cpuName: string, baseAddr: string, length: string) {
431
- try {
432
- return this.getAddressingSpace(cpuName, baseAddr, length);
433
- } catch (error) {
434
- console.error("Error during getMemoryValue:", error);
435
- throw error;
436
- }
437
- }
438
430
 
439
431
 
440
432
  public async getAddressingSpace(cpuName: string, baseAddr: string, length: string) {
@@ -445,9 +437,14 @@ export class SkyEyeClient extends JSONTransmissionClient {
445
437
  throw error;
446
438
  }
447
439
  }
448
-
449
-
450
-
440
+ public async getMemoryValue(cpuName: string, baseAddr: string, length: string) {
441
+ try {
442
+ return this.getAddressingSpace(cpuName, baseAddr, length);
443
+ } catch (error) {
444
+ console.error("Error during getMemoryValue:", error);
445
+ throw error;
446
+ }
447
+ }
451
448
  public async getMemoryValueDefault(baseAddr: string, length: string) {
452
449
  try {
453
450
  return this.getAddressingSpaceDefault(baseAddr, length);
@@ -456,8 +453,6 @@ export class SkyEyeClient extends JSONTransmissionClient {
456
453
  throw error;
457
454
  }
458
455
  }
459
-
460
-
461
456
  public async getAddressingSpaceDefault(baseAddr: string, length: string) {
462
457
  const cpuList = (await this.getCpuList()).getCpuList();
463
458
  if (cpuList != null && cpuList.length > 0) {
@@ -473,6 +468,30 @@ export class SkyEyeClient extends JSONTransmissionClient {
473
468
  }
474
469
  }
475
470
 
471
+ public async setMemoryValue(cpuName: string, baseAddr: string, value: string, length: string) {
472
+ try {
473
+ return await this.call(RequestFactory.getInstance().setMemoryValue(cpuName, baseAddr, value, length));
474
+ } catch (error) {
475
+ console.error("Error during getAddressingSpaceDefault:", error);
476
+ throw error;
477
+ }
478
+ }
479
+ public async setMemoryValueDefault(baseAddr: string, value: string, length: string) {
480
+ const cpuList = (await this.getCpuList()).getCpuList();
481
+ if (cpuList != null && cpuList.length > 0) {
482
+ try {
483
+ return await this.setMemoryValue(cpuList[0].getName(), baseAddr, value, length)
484
+ } catch (error) {
485
+ console.error("Error during getAddressingSpaceDefault:", error);
486
+ throw error;
487
+ }
488
+ } else {
489
+ console.error("无法获取cpu,请确认cpu是否存在:");
490
+ throw new SkyEyeSDKException("无法获取cpu,请确认cpu是否存在:");
491
+ }
492
+ }
493
+
494
+
476
495
 
477
496
  public async getCpuRegisters(cpuName: string) {
478
497
  const response = new GetCpuRegisterInfoResponse();
package/test.ts CHANGED
@@ -215,18 +215,23 @@ async function test() {
215
215
  // const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
216
216
  // await client.initSkyEyeAndRun2(pathSkyEye, fileName, port, skyeyeDir)
217
217
 
218
- const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
219
- const fileName = "c6713_fc_1553b.skyeye";
220
- const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
218
+ // const pathSkyEye = "D:/data/case/workspace_c6713/targets/c6713_fc_1553b";
219
+ // const fileName = "c6713_fc_1553b.skyeye";
220
+ // const skyeyeDir = "D:/install/skyeye/opt/skyeye/bin/skyeye.exe"
221
221
 
222
222
 
223
223
  const client = SkyEyeClientFactory.instance.createClient('127.0.0.1', '50051');
224
+
224
225
  // const response =await client.getCurrentRunningState()
225
226
  // const response = await client.getMemoryValueDefault("128","4")
226
- const response = await client.getGlobalVarValueDefault("number_b","int")
227
- console.log("response:", response)
227
+ const response = await client.getGlobalVarValueDefault("number_a","int")
228
+ // const response = await client.setGlobalVarValueDefault("number_a", "int", "12")
228
229
 
229
230
 
231
+
232
+ // const response = await client.getMemoryValueDefault("10001", "1")
233
+ console.log("response:", response)
234
+
230
235
  //启动多个skyeye
231
236
  // const count = 5;
232
237
  // const map = new Map<number, any>;