CND with bare metal target: module + netbeans modifications

Jan Breuer <[email protected]> Mon, 3 Apr 2017 11:29:46 +0200
Newsgroups gmane.comp.java.netbeans.devel
Message-ID <CAEEQaa_kqeOAdyXx0oqJp1ftVyVdUROGkJpm3gqa5LRe1NjMOw@mail.gmail.com>
--94eb2c05ff86daeb4f054c3fcca4
Content-Type: text/plain; charset=UTF-8

Hello,
I have developed a SCIDE <http://pck338-242.feld.cvut.cz/scide/>, the
development environment for bare metal ARM Cortex devices. It was designed
for my students at the university but now, I'm still using this IDE and my
colegues enjoy it also so I decided to upgrade the old base from NetBeans
7.4 to NetBeans 8 (or 9).
I would like to do it right now and open the source. And possibly separate
it to the standalone module for NetBeans in the future. Unexpectedly, there
are many blockers now in NetBeans sources. Currently, it is bad hack of
many cnd and dlight modules.

What I need is to provide seamless build, run and debug experience without
configuring paths to tools and running external tools manualy.
I can provide some patches to CND to support this usage but I would like to
do it right.

There are these issues for me:

Crosscompilation to bare metal - platform:
There are many checks in the source if the target platform is right (Linux,
Windows). This is not an issue for bare metal compilation, because it will
produce same result on all platforms.
(e.g. in
cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/configurations/ConfigurationMakefileWriter.java)
What is the right way to solve this? Introduce new platform
in org.netbeans.modules.cnd.makeproject.api.configurations.Platforms? How
to correctly force this platform in new project? Can I introduce new
platform in module and inject it using OpenIDE?

Program loading (Run button):
It is not possible to run the compiled code directly, but the code must be
loaded to target device. There is no SSH or so. Program loading is done by
flash tool. Remote platform dialog is completely useless for this. I would
like to provide flash tool in a module, so user should just select correct
tool and not path to it.
It seems like extending
of org.netbeans.modules.nativeexecution.api.NativeProcess
and org.netbeans.modules.nativeexecution.api.ExecutionEnvironment is good
idea, but they are so tightly coupled to SSH... Executing the application
on bare metal is something between isLocal() and isRemote() in sense of
NetBeans CND.
How to correctly hook to "Run" event and execute the loader? Using own
ExecutionEnvironment? How to force own ExecutionEnvironment in the CND
project?

Debugger:
Again, it is something between local and remote debuging in sense of
NetBeans CND. I'm using OpenOCD as "gdb remote" but it is possible to run
it using pipes, not tcp ports.
OpenOCD is executed by the IDE so no need to run anything manually. Just
press "debug button".
In conjuction with OpenOCD, some commands are missing. E.g. it is not
possible to execute gdb command "-exec-run", but instead, just
"-exec-continue" is supported.
There is need to chain some commands to standard debug commands e.g.
"monitor reset run", "monitor reset halt", ...
There is also need to preload the program to the device by external command
before debug (same as running the code)
How to correctly hook to these events without changing or reimplementing
org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl?

Any ideas are welcome.

Best regards,
Jan Breuer

--94eb2c05ff86daeb4f054c3fcca4
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<div>I have developed a <a href=3D"http://pck338-242=
.feld.cvut.cz/scide/">SCIDE</a>, the development environment for bare metal=
 ARM Cortex devices. It was designed for my students at the university but =
now, I&#39;m still using this IDE and my colegues enjoy it also so I decide=
d to upgrade the old base from NetBeans 7.4 to NetBeans 8 (or 9).</div><div=
>I would like to do it right now and open the source. And possibly separate=
 it to the standalone module for NetBeans in the future. Unexpectedly, ther=
e are many blockers now in NetBeans sources. Currently, it is bad hack of m=
any cnd and dlight modules.</div><div><br></div><div>What I need is to prov=
ide seamless build, run and debug experience without configuring paths to t=
ools and running external tools manualy.<br></div><div>I can provide some p=
atches to CND to support this usage but I would like to do it right.<br></d=
iv><div><br></div><div>There are these issues for me:</div><div><br></div><=
div>Crosscompilation to bare metal - platform:</div><div>There are many che=
cks in the source if the target platform is right (Linux, Windows). This is=
 not an issue for bare metal compilation, because it will produce same resu=
lt on all platforms.<br></div><div>(e.g. in cnd.makeproject/src/org/netbean=
s/modules/cnd/makeproject/configurations/ConfigurationMakefileWriter.java)<=
/div><div>What is the right way to solve this? Introduce new platform in=C2=
=A0org.netbeans.modules.cnd.makeproject.api.configurations.Platforms? How t=
o correctly force this platform in new project? Can I introduce new platfor=
m in module and inject it using OpenIDE?</div><div><br></div><div>Program l=
oading (Run button):</div><div>It is not possible to run the compiled code =
directly, but the code must be loaded to target device. There is no SSH or =
so. Program loading is done by flash tool. Remote platform dialog is comple=
tely useless for this.=C2=A0I would like to provide flash tool in a module,=
 so user should just select correct tool and not path to it.</div><div>It s=
eems like extending of=C2=A0org.netbeans.modules.nativeexecution.api.Native=
Process and=C2=A0org.netbeans.modules.nativeexecution.api.ExecutionEnvironm=
ent is good idea, but they are so tightly coupled to SSH... Executing the a=
pplication on bare metal is something between isLocal() and isRemote() in s=
ense of NetBeans CND.</div><div>How to correctly hook to &quot;Run&quot; ev=
ent and execute the loader? Using own ExecutionEnvironment? How to force ow=
n ExecutionEnvironment in the CND project?</div><div><br></div><div>Debugge=
r:</div><div>Again, it is something between local and remote debuging in se=
nse of NetBeans CND. I&#39;m using OpenOCD as &quot;gdb remote&quot; but it=
 is possible to run it using pipes, not tcp ports.</div><div>OpenOCD is exe=
cuted by the IDE so no need to run anything manually. Just press &quot;debu=
g button&quot;.</div><div>In conjuction with OpenOCD, some commands are mis=
sing. E.g. it is not possible to execute gdb command &quot;-exec-run&quot;,=
 but instead, just &quot;-exec-continue&quot; is supported.</div><div>There=
 is need to chain some commands to standard debug commands e.g. &quot;monit=
or reset run&quot;, &quot;monitor reset halt&quot;, ...</div><div>There is =
also need to preload the program to the device by external command before d=
ebug (same as running the code)</div><div>How to correctly hook to these ev=
ents without changing or reimplementing org.netbeans.modules.cnd.debugger.g=
db2.GdbDebuggerImpl?</div><div><br></div><div>Any ideas are welcome.<br></d=
iv><div><br></div><div>Best regards,</div><div>Jan Breuer</div><div><br></d=
iv><div><br></div></div>

--94eb2c05ff86daeb4f054c3fcca4--