Open Peta-T opened 3 years ago
A quick look at the code this line seems to be the only Windows-ism in code: https://github.com/dapperfu/opensda_flasher/blob/aef0bddb5aa56f4e3aeffe76cf1b6c9491125529/opensda_flasher/server.py#L36
The other thing that may need some editing is the ini file. The binary probably doesn't have .exe
and the version of the plugin may change as well as root path to S32DS.
Let me know if that doesn't work and I can see about getting things working on Ubuntu. I've only tested on Windows thus far because the Model Toolboxes for Simulink are Windows only.
Thank you, I have changed config file opensda_flasher.ini
; Default init.
; S32 Settings.
[S32]
root = C:\NXP\S32DS_Power_v1.2
; Debug Server Settings.
[SERVER]
plugin = com.pemicro.debug.gdbjtag.ppc_1.6.9.201706282002
exe = pegdbserver_console
device = MPC5744P
port = USB1
speed = 5000
serverport = 7224
platform = win32
; GDB CLient Settings.
[CLIENT]
platform = powerpc-eabivle-4_9
exe = powerpc-eabivle-gdb
but i still have this result:
t@debian64ntb:/media/veracrypt1/DEVKIT-Makefile-master/lin$ opensda_flasher init
Traceback (most recent call last):
File "/home/petat/.local/bin/opensda_flasher", line 6, in <module>
from opensda_flasher.cli import main
File "/home/petat/.local/lib/python2.7/site-packages/opensda_flasher/__init__.py", line 4, in <module>
from .client import Client # noqa
File "/home/petat/.local/lib/python2.7/site-packages/opensda_flasher/client.py", line 33
return [self.executable, "--nx", f"--command={self.cmd_file}"]
^
SyntaxError: invalid syntax
Do you know how can I use pegdbserver_console manualy?
t@debian64ntb:/media/veracrypt1/DEVKIT-Makefile-master/lin$ ./pegdbserver_console
P&E GDB Server for Arm(R) devices, Version 7.86.00.00
Copyright 2018, P&E Microcomputer Systems Inc, All rights reserved
Loading library /media/veracrypt1/DEVKIT-Makefile-master/lin/gdi/unit_ngs_arm_internal.so ... Done.
Command line arguments:
List of valid parameters
-devicelist : Displays valid device name list and terminates
-device=n : Specify the device name being debugged
-startserver : Start the server listening for a connection from GDB
-serverport=n : Server TCP/IP port number is n (by default 7224)
-useexternalip : Server TCP/IP IP address is the PCs IP address (instead of localhost)
-serverip=n : Server TCP/IP IP address is nnn.nnn.nnn.nnn
-showhardware : Shows list of autodetected P&E debug hardware/ports
-interface=n : Specify P&E hardware interface
-port=n : Choose hardware number/ip/name/serialnumber n. Default is USB1
-attachonly : Do not reset the device on connection (default OFF)
-speed=n : Shift frequency is n KHz. Default is 5000 KHz.
-usejtag : Sets the communication style to JTAG. (default OFF)
-resetdelay=n : Delay n milliseconds after reset.
-showflashstatus : Show flash programming dialog during programming
-verbose : Displays messages of the debug and communications session
-singlesession : GDB Server will automatically close after GDB client disconnects
-configfile=config.ini : Specify an ini file to read settings from.
-corenum : Sets current device core. (defaults to 0)
-gdbmiport=n : Enables GDB/MI interface, using port number n
-kernel=OS : Enables kernel aware debugging for the specified OS. (Eg. freertos)
-uncensorpassword=n : Attempts to uncensor processor with password n (hexadecimal)
-streamingport=n : Enables Streaming Port, using port number n
-firmwareupdate=auto : Sets firmware update to: auto, force
-swostats= : Sets base directory for SWO Stats output files
-startprogrammer=n : Launches Interactive PROG using port number n
Example of a GDB Server Launch :
pegdbserver_console -startserver -device=Freescale_KL2x_KL25Z128M4
Thanks
I will take a look when I get a chance.
The way I reverse engineered it the first time on Windows was to use a process monitor to see what the calls were. If you could flash from S32DS's interface and run ps auxww | grep pegdbserver
to see what exactly how it is called on Linux.
During programming I had this output:
t@debian64ntb:~$ ps auxww | grep pegdbserver
petat 11611 4.2 0.3 973188 47124 tty2 Sl 08:38 0:00 /home/petat/NXP/S32DS_Power_v2017.R1/eclipse/plugins/com.pemicro.debug.gdbjtag.ppc_1.9.9.201907200403/lin/pegdbserver_power_console -device=MPC5744P -startserver -singlesession -serverport=7224 -gdbmiport=6224 -interface=OPENSDA -speed=5000 -port=USB1 -configfile=/home/petat/workspaceS32DS.Power.2017.R1/.metadata/.plugins/com.pemicro.debug.gdbjtag.ppc/config.ini
petat 11895 0.0 0.0 6232 876 pts/0 S+ 08:38 0:00 grep pegdbserver
config.ini contain:
[STARTUP]
USE_CYCLONEPRO_RELAYS=0
ECLIPSE_SHOW_CONNECTION_ASSISTANT=1
CPUTARGETTYPENAME=
CYCLONEPRO_POWEROFFONEXIT=0
CYCLONEPRO_CURRENTVOLTAGE=255
CYCLONEPRO_POWERDOWNDELAY=250
CYCLONEPRO_POWERUPDELAY=250
MULTILINK_POWERDOWNDELAY=250
MULTILINK_POWERUPDELAY=1000
IO_DELAY_CNT=0
FREQ_FX=4
FREQ_NORMAL=0
FREQ_OSJTAG=0
FREQ_CYCLONE=1
FREQ_TRACELINK=1
FREQ_LIGHTNING=1
FREQ_OPENSDA=1
RESET_DELAY=0
INTERFACE_SELECTION=1
SHOWDIALOG=1
[PEDEBUG]
CURRENT_ALGORITHM_INDEX=0
CURRENTDEVICE=mpc5744p
CURRENTMODE=4
[GENERAL]
CORBA_IDENTIFIER0=IOR:000000000000001a49444c3a4d794d6f64756c652f7069636b4c6973743a312e30000000000000010000000000000082000102000000000a3132372e302e312e310084d700000031afabcb000000002053ad473000000001000000000000000100000008526f6f74504f410000000008000000010000000014000000000
CORBA_IDENTIFIER1=000020000000100000020000000000001000100000002050100010001002000010109000000010001010000000026000000020002
[STARTUP12]
SHOW_HSTEP_ASSEMBLY_DETAILS_NEW=0
ICD_ALWAYS_RESET_ON_STARTUP=1
ICD_CONTINUALLY_POLL_DEVICE_STATUS=1
I am very sorry there was problem with python version (osf need Python3)
i had to reinstal with this command
pip3 install git+https://github.com/jed-frey/opensda_flasher.git#egg=opensda_flasher
I change opensda_flasher.ini file to this:
; Default init.
; S32 Settings.
[S32]
root = /home/petat/NXP/S32DS_Power_v2017.R1
; Debug Server Settings.
[SERVER]
plugin = com.pemicro.debug.gdbjtag.ppc_1.9.9.201907200403
exe = pegdbserver_power_console
device = MPC5744P
port = USB1
speed = 5000
serverport = 7224
platform = lin
; GDB CLient Settings.
[CLIENT]
platform = powerpc-eabivle-4_9
exe = powerpc-eabivle-gdb
and also on this line
self.process = delegator.run(["taskkill", "/f", "/im", os.path.basename(self.executable)], block=True)
i thing should be this
self.process = delegator.run(["killall", "", "", os.path.basename(self.executable)], block=True)
and I got this result and succesfuly flash DEVKIT
t@debian64ntb:/media/veracrypt1/DEVKIT-Makefile-master/Examples/MPC5744P/Hello_World$ make flash
osf flash Hello_World.elf
Waiting for GDB servers to complete startup ...... Done
DEBUG: /tmp/gdb_864hvjjc.txt
Waiting for GDB client to flash ...... Done
GNU gdb (GDB build.sh rev=gceb1328 s=F494 -i /opt/freescale ELe200 -V release_gceb1328_build_Fed_ELe200_ML3 (BLD = 1607)) 7.8.2
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=powerpc-eabivle".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
0x01000000 in ?? ()
Command Executed successfully: preserve1 0
The target architecture is assumed to be powerpc:vle
Loading section .init, size 0x1e lma 0x1800074
Loading section .text, size 0x1b4 lma 0x1800094
Loading section .fini, size 0x1a lma 0x1800248
Loading section .eh_frame, size 0x8 lma 0x1810264
Loading section .ctors, size 0x8 lma 0x181026c
Loading section .dtors, size 0x8 lma 0x1810274
Loading section .jcr, size 0x4 lma 0x181027c
Start address 0x1800094, load size 520
Transfer rate: 913 bytes/sec, 74 bytes/write.
Command Executed successfully: _reset
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) [answered Y; input not from terminal]
Thanks
Something is wrong, because after flashing is not new program in device Any error, but device is not reprogrammed and use same program as before programming I do not know why
Now I found new method how to load program into MPC5744P device.
I need 2 terminal console window.
First one I have to run gdbserver by this command:
/home/petat/NXP/S32DS_Power_v2017.R1/eclipse/plugins/com.pemicro.debug.gdbjtag.ppc_1.9.9.201907200403/lin/pegdbserver_power_console -device=MPC5744P -startserver
this cause next output on first console:
P&E GDB Server for Power devices, Version 7.50.00.00
Copyright 2018, P&E Microcomputer Systems Inc, All rights reserved
Loading library /home/petat/NXP/S32DS_Power_v2017.R1/eclipse/plugins/com.pemicro.debug.gdbjtag.ppc_1.9.9.201907200403/lin/gdi/unit_ngs_ppcnexus_internal.so ... Done.
Command line arguments: -device=MPC5744P -startserver
Device selected is mpc5744p
HW Auto-Selected : Interface=OPENSDA Port=A9F40E70 ; USB1 : OpenSDA (A9F40E70)
Connecting to target.
OpenSDA detected - Flash Version 1.10
Device IDCODE is $00000345
Device ID revision is $00000003
Starting reset script (/home/petat/NXP/S32DS_Power_v2017.R1/eclipse/plugins/com.pemicro.debug.gdbjtag.ppc_1.9.9.201907200403/lin/gdi/P&E/s32e200_mpc574xp.mac) ...
REM This script is compatible with MPC574xP devices.
REM Clean GPRs to remove residual data after using algorithm
REM Initialize all of the Main SRAM - 384KB
Initializing RAM from $40000000 to $4005FFFF.
Initializing Ram Block 0x40000000-0x4005FFFF.
Reset script (/home/petat/NXP/S32DS_Power_v2017.R1/eclipse/plugins/com.pemicro.debug.gdbjtag.ppc_1.9.9.201907200403/lin/gdi/P&E/s32e200_mpc574xp.mac) completed.
MPC5744P Device detected.
Device is mpc5744p.
Mode is In-Circuit Debug.
(C)opyright 2012, P&E Microcomputer Systems, Inc. (www.pemicro.com)
API version is 101
Server 1 running on 127.0.0.1:7224
Server 2 running on 127.0.0.1:7226
Server 3 running on 127.0.0.1:7228
Server 4 running on 127.0.0.1:7230
Server 5 running on 127.0.0.1:7232
Server 6 running on 127.0.0.1:7234
Server 7 running on 127.0.0.1:7236
Server 8 running on 127.0.0.1:7238
Server 9 running on 127.0.0.1:7240
Server 10 running on 127.0.0.1:7242
All Servers Running
and second terminal I have to run GDB debuger by this command:
powerpc-eabivle-gdb
On debugger console I have to use next commands for loading program to the RAM or flashing to the ROM and debuging
like this:
(gdb) target remote localhost:7224
Output: Remote debugging using localhost:7224
Output: 0x01000000 in ?? ()
(gdb) monitor preserve1 0
Output: Command Executed successfully: preserve1 0
(gdb) load /media/veracrypt1/DEVKIT-Makefile-master/Examples/MPC5744P/Hello_World_PLL_Interrupt/Debug/Hello_World_PLL_Interrupt.elf
This good experience I have with file generated from NXP S32 Design studio and if I use file from Debug folder program file will be flashing to the ROM.
if I use file from Debug_RAM folder, program file will be load to the RAM. Command generate this output:
Output: Loading section .rchw, size 0x4 lma 0xfa0000
Output: Loading section .cpu0_reset_vector, size 0x4 lma 0xfa0004
Output: Loading section .startup, size 0x212 lma 0x1000000
Output: Loading section .core_exceptions_table, size 0xf4 lma 0x1001000
Output: Loading section .intc_vector_table, size 0xb78 lma 0x1002000
Output: Loading section .text, size 0x9e0 lma 0x1002b80
Output: Loading section .ctors, size 0x8 lma 0x1003560
Output: Loading section .dtors, size 0x8 lma 0x1003568
Output: Loading section .eh_frame, size 0x8 lma 0x1003570
Output: Loading section .data, size 0x20 lma 0x1003578
Output: Start address 0x1000000, load size 6302
Output: Transfer rate: 779 bytes/sec, 450 bytes/write.
(gdb) file /media/veracrypt1/DEVKIT-Makefile-master/Examples/MPC5744P/Hello_World_PLL_Interrupt/Debug/Hello_World_PLL_Interrupt.elf
This command load debug information to the debugger and put next messages. Compiled file contain debug information.
Output: A program is being debugged already.
Output: Are you sure you want to change the file? (y or n) y
Output: warning: Selected architecture powerpc:common is not compatible with reported target architecture powerpc:vle
Output: Reading symbols from /media/veracrypt1/DEVKIT-Makefile-master/Examples/MPC5744P/Hello_World_PLL_Interrupt/Debug/Hello_World_PLL_Interrupt.elf...done.
Now we have loaded program in ROM and loaded debug informations and we can show program by pressing Ctrl+X+A keys We can put some breakpoints by command b N where b is Break and N is line number for breakpoint for example:
(gdb) b 134
Breakpoint 1 at 0x100336c: file ../src/Hello World + PLL + Interrupt.c, line 134
.
We can run program in MPC5744P device by command c (Continuing) for example:
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
Breakpoint 1, PIT0_isr () at ../src/Hello World + PLL + Interrupt.c:134
We can break running program by pressing keys Ctrl+C or program can break on some preakpoint line as you can se on last line.
We can also use command n for stepping on next line
(gdb) n
or use command s for seping out from block
(gdb) s
We can also use disassemble command
(gdb) set disassemble-next-line on
and after we can see output like this
(gdb) n
=> 0x010033fa <PIT0_isr+150>: 19 7f 80 10 e_addi r11,r31,16
0x010033fe <PIT0_isr+154>: 53 eb ff fc e_lwz r31,-4(r11)
0x01003402 <PIT0_isr+158>: 03 31 se_mfar r1,r11
0x01003404 <PIT0_isr+160>: 00 04 se_blr
Thanks for looking into that. I'm stuck getting S32DS installed on Ubuntu 20.04 right now due to java issues. But I'll try to look into it when I can.
Edit, note to self.
S32DS needs java 1.8
sudo apt-get install openjdk-8-jre
sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Hello, is it possible to use this flasher on linux? How (what i have to change). Thanks