Re: CND with bare metal target: module + netbeans modifications

Jan Breuer <[email protected]> Mon, 3 Apr 2017 14:15:59 +0200
Newsgroups gmane.comp.java.netbeans.devel,gmane.comp.apache.community.devel
Message-ID <CAEEQaa_zPTqR9AsQ=QPBrBm7ERkgqPE9+stBoJ1VaQ-4qz4D3g@mail.gmail.com>
--94eb2c0b17284818bc054c421fbb
Content-Type: text/plain; charset=UTF-8

Hello Emilian,
thank you, I will repost it to apache incubator.

I have patched version of NetBeans 7.4 but all patches are ugly. It does
not run with clean NetBeans. I have also ported it to 8.2 without problems
but it remains the same ugly patches. I need to do it right and probably
push something upstream.

> Sounds like you need some API based on GdbDebuggerImpl? How did things
work before?
Some API will be nice. I had heavily modified version of GdbDebuggerImpl.

> This sounds like isRemote() to me, although communication is not via SSH.
Mainly yes, but it is not true in all cases. It is few years I have done
the patching of GdbDebuggerImpl and cnd.makeproject so it may be better in
recent versions. I must investigate it.

> PS: I assume you heard of https://en.wikipedia.org/wiki/Sleepycat_Software
It was school project so the name was not important. Now, I can rename it,
because of this colision.

--Jan

2017-04-03 13:47 GMT+02:00 Emilian Bold <[email protected]>:

> Jan, NetBeans is becoming part of Apache so it would be best to
> (cross-)post on [email protected]
>
> It seems to me that right now everything runs without patching NetBeans
> 7.4?
>
> So the problem is that your existing hooks no longer work? (They probably
> never were and official API, no?)
>
> Even if you have to patch NetBeans, open-sourcing the tool + patches +
> modules seems valuable.
>
> I haven't worked on the cnd modules but I'll throw my 2c:
>
>  > 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.
>
> If it's not an issue, it shouldn't matter. You could either use
> PlatformTypes. PLATFORM_GENERIC or the default platform, etc.
>
> > Program loading (Run button): [...] Executing the application on bare
> metal is something between isLocal() and isRemote() in sense of NetBeans
> CND.
>
> This sounds like isRemote() to me, although communication is not via SSH.
>
> > Debugger [...]
>
> Sounds like you need some API based on GdbDebuggerImpl? How did things
> work before?
>
> PS: I assume you heard of https://en.wikipedia.org/wiki/Sleepycat_Software
>
> --emi
>
>
> On Mon, Apr 3, 2017 at 12:29 PM, Jan Breuer <[email protected]> wrote:
>
>> 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/con
>> figurations/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
>>
>>
>>
>

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

<div dir=3D"ltr"><div class=3D"gmail_extra">Hello Emilian,</div><div class=
=3D"gmail_extra">thank you, I will repost it to apache incubator.</div><div=
 class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">I have patched =
version of NetBeans 7.4 but all patches are ugly. It does not run with clea=
n NetBeans. I have also ported it to 8.2 without problems but it remains th=
e same ugly patches. I need to do it right and probably push something upst=
ream.</div><div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">=
&gt; Sounds like you need some API based on GdbDebuggerImpl? How did things=
 work before?</div><div>Some API will be nice. I had heavily modified versi=
on of GdbDebuggerImpl.</div><div><br></div><div>&gt;=C2=A0This sounds like =
isRemote() to me, although communication is not via SSH.</div><div>Mainly y=
es, but it is not true in all cases. It is few years I have done the patchi=
ng of=C2=A0GdbDebuggerImpl and cnd.makeproject so it may be better in recen=
t versions. I must investigate it.</div><div><br></div><div>&gt; PS: I assu=
me you heard of=C2=A0<a href=3D"https://en.wikipedia.org/wiki/Sleepycat_Sof=
tware" target=3D"_blank">https://en.wikipedia.org/wi<wbr>ki/Sleepycat_Softw=
are</a></div><div>It was school project so the name was not important. Now,=
 I can rename it, because of this colision.</div><div><br></div><div>--Jan<=
/div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">2017-04-03 1=
3:47 GMT+02:00 Emilian Bold <span dir=3D"ltr">&lt;<a href=3D"mailto:emilian=
[email protected]" target=3D"_blank">[email protected]</a>&gt;</span>:<b=
r><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;borde=
r-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div>J=
an, NetBeans is becoming part of Apache so it would be best to (cross-)post=
 on <a href=3D"mailto:[email protected]" target=3D"_blank">=
[email protected].<wbr>org</a></div><div><br></div><div>It seem=
s to me that right now everything runs without patching NetBeans 7.4?</div>=
<div><br></div><div>So the problem is that your existing hooks no longer wo=
rk? (They probably never were and official API, no?)</div><div><br></div><d=
iv>Even if you have to patch NetBeans, open-sourcing the tool + patches + m=
odules seems valuable.</div><div><div><br class=3D"m_9075540081269166238gma=
il-m_-5866099445060126352gmail-Apple-interchange-newline">I haven&#39;t wor=
ked on the cnd modules but I&#39;ll throw my 2c:</div></div><span class=3D"=
m_9075540081269166238gmail-"><div><br></div><div>=C2=A0&gt; Crosscompilatio=
n to bare metal - platform: There are many checks in the source if the targ=
et platform is right (Linux, Windows). This is not an issue for bare metal =
compilation, because it will produce same result on all platforms.</div><di=
v><br></div></span><div>If it&#39;s not an issue, it shouldn&#39;t matter. =
You could either use PlatformTypes. PLATFORM_GENERIC or the default platfor=
m, etc.</div><div><br></div><div>&gt;=C2=A0Program loading (Run button): [.=
..]=C2=A0Executing the application on bare metal is something between isLoc=
al() and isRemote() in sense of NetBeans CND.</div><div><br></div><div>This=
 sounds like isRemote() to me, although communication is not via SSH.</div>=
<div><br></div><div>&gt; Debugger [...]</div><div><br></div><div>Sounds lik=
e you need some API based on GdbDebuggerImpl? How did things work before?</=
div><div><br></div><div>PS: I assume you heard of=C2=A0<a href=3D"https://e=
n.wikipedia.org/wiki/Sleepycat_Software" target=3D"_blank">https://en.wikip=
edia.org/wi<wbr>ki/Sleepycat_Software</a><br></div><div class=3D"gmail_extr=
a"><br></div><div class=3D"gmail_extra"><div>--emi</div><div><br></div></di=
v><div><div class=3D"m_9075540081269166238gmail-h5"><div class=3D"gmail_ext=
ra">
<br><div class=3D"gmail_quote">On Mon, Apr 3, 2017 at 12:29 PM, Jan Breuer =
<span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_bl=
ank">[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex"><div dir=3D"ltr">Hello,<div>I have developed a <a=
 href=3D"http://pck338-242.feld.cvut.cz/scide/" target=3D"_blank">SCIDE</a>=
, the development environment for bare metal ARM Cortex devices. It was des=
igned for my students at the university but now, I&#39;m still using this I=
DE and my colegues enjoy it also so I decided to upgrade the old base from =
NetBeans 7.4 to NetBeans 8 (or 9).</div><div>I would like to do it right no=
w and open the source. And possibly separate it to the standalone module fo=
r NetBeans in the future. Unexpectedly, there are many blockers now in NetB=
eans sources. Currently, it is bad hack of many cnd and dlight modules.</di=
v><div><br></div><div>What I need is to provide seamless build, run and deb=
ug experience without configuring paths to tools and running external tools=
 manualy.<br></div><div>I can provide some patches to CND to support this u=
sage but I would like to do it right.<br></div><div><br></div><div>There ar=
e these issues for me:</div><div><br></div><div>Crosscompilation to bare me=
tal - platform:</div><div>There are many checks in the source if the target=
 platform is right (Linux, Windows). This is not an issue for bare metal co=
mpilation, because it will produce same result on all platforms.<br></div><=
div>(e.g. in cnd.makeproject/src/org/netbea<wbr>ns/modules/cnd/makeproject/=
con<wbr>figurations/ConfigurationMakef<wbr>ileWriter.java)</div><div>What i=
s the right way to solve this? Introduce new platform in=C2=A0<a href=3D"ht=
tp://org.netbeans.modules.cnd.ma" target=3D"_blank">org.netbeans.modules.cn=
d.ma</a><wbr>keproject.api.configurations.P<wbr>latforms? How to correctly =
force this platform in new project? Can I introduce new platform in module =
and inject it using OpenIDE?</div><div><br></div><div>Program loading (Run =
button):</div><div>It is not possible to run the compiled code directly, bu=
t 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.=C2=A0I would like to provide flash tool in a module, so user sho=
uld just select correct tool and not path to it.</div><div>It seems like ex=
tending of=C2=A0org.netbeans.modules.native<wbr>execution.api.NativeProcess=
 and=C2=A0org.netbeans.modules.nativ<wbr>eexecution.api.ExecutionEnviro<wbr=
>nment is good idea, but they are so tightly coupled to SSH... Executing th=
e application on bare metal is something between isLocal() and isRemote() i=
n sense of NetBeans CND.</div><div>How to correctly hook to &quot;Run&quot;=
 event and execute the loader? Using own ExecutionEnvironment? How to force=
 own ExecutionEnvironment in the CND project?</div><div><br></div><div>Debu=
gger:</div><div>Again, it is something between local and remote debuging in=
 sense 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 =
executed by the IDE so no need to run anything manually. Just press &quot;d=
ebug button&quot;.</div><div>In conjuction with OpenOCD, some commands are =
missing. E.g. it is not possible to execute gdb command &quot;-exec-run&quo=
t;, but instead, just &quot;-exec-continue&quot; is supported.</div><div>Th=
ere is need to chain some commands to standard debug commands e.g. &quot;mo=
nitor reset run&quot;, &quot;monitor reset halt&quot;, ...</div><div>There =
is also need to preload the program to the device by external command befor=
e debug (same as running the code)</div><div>How to correctly hook to these=
 events without changing or reimplementing org.netbeans.modules.cnd.debug<w=
br>ger.gdb2.GdbDebuggerImpl?</div><div><br></div><div>Any ideas are welcome=
.<br></div><div><br></div><div>Best regards,</div><div>Jan Breuer</div><div=
><br></div><div><br></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div>

--94eb2c0b17284818bc054c421fbb--