mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 14:13:09 +00:00
0fb672b493
Fix #2428
251 lines
6.9 KiB
Plaintext
251 lines
6.9 KiB
Plaintext
if {!([have_spec nova])} {
|
|
puts "\nThe Noux GDB scenario is only supported for NOVA\n"
|
|
exit 0
|
|
}
|
|
|
|
source ${genode_dir}/repos/ports/run/noux_gdb.inc
|
|
|
|
if {[have_spec arm]} {
|
|
set tool_prefix "genode-arm-"
|
|
}
|
|
|
|
if {[have_spec x86]} {
|
|
set tool_prefix "genode-x86-"
|
|
}
|
|
|
|
#
|
|
# Uncomment the following line when working on the GDB source code. Otherwise,
|
|
# the package may get recompiled, yet it does not get reinstalled into 'bin/'.
|
|
#
|
|
#exec rm -rf noux-pkg/[noux_gdb_pkg_name]/ bin/[noux_gdb_pkg_name]/
|
|
|
|
set build_components {
|
|
core init drivers/timer noux lib/libc_noux
|
|
drivers/framebuffer drivers/input drivers/usb
|
|
server/terminal server/terminal_crosslink
|
|
app/gdb_monitor
|
|
}
|
|
|
|
lappend build_components "lib/gdbserver_platform-$::env(KERNEL)"
|
|
|
|
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
|
|
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
|
|
return gpio_drv }
|
|
|
|
lappend_if [have_spec gpio] build_components drivers/gpio
|
|
|
|
lappend_if [have_spec nova] build_components lib/ld/nova
|
|
lappend_if [have_spec foc] build_components lib/ld/foc
|
|
|
|
lappend build_components noux-pkg/[noux_gdb_pkg_name]
|
|
|
|
# the application to be debugged with GDB
|
|
lappend build_components test/gdb_monitor
|
|
set gdb_target_binary_name test-gdb_monitor
|
|
|
|
source ${genode_dir}/repos/base/run/platform_drv.inc
|
|
append_platform_drv_build_components
|
|
|
|
build $build_components
|
|
|
|
# GDB loads symbols from 'bin/ld.lib.so'
|
|
if { [have_spec nova] } {
|
|
exec ln -sf ld-nova.lib.so bin/ld.lib.so
|
|
}
|
|
if { [have_spec foc] } {
|
|
exec ln -sf ld-foc.lib.so bin/ld.lib.so
|
|
}
|
|
|
|
# names of the binaries needed for the GDB monitor test
|
|
set gdb_target_binaries {
|
|
test-gdb_monitor
|
|
ld.lib.so
|
|
libc.lib.so
|
|
libm.lib.so
|
|
posix.lib.so
|
|
}
|
|
lappend gdb_target_binaries ${gdb_target_binary_name}
|
|
|
|
create_binary_and_source_tars ${gdb_target_binary_name} ${gdb_target_binaries}
|
|
|
|
create_boot_directory
|
|
|
|
append config {
|
|
<config verbose="yes">
|
|
<parent-provides>
|
|
<service name="ROM"/>
|
|
<service name="LOG"/>
|
|
<service name="RAM"/>
|
|
<service name="RM"/>
|
|
<service name="CPU"/>
|
|
<service name="PD"/>
|
|
<service name="IRQ"/>
|
|
<service name="IO_PORT"/>
|
|
<service name="IO_MEM"/>
|
|
</parent-provides>
|
|
<default-route>
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</default-route>
|
|
<default caps="100"/>
|
|
<start name="timer">
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides><service name="Timer"/></provides>
|
|
</start> }
|
|
|
|
append_if [have_spec sdl] config {
|
|
<start name="fb_sdl">
|
|
<resource name="RAM" quantum="4M"/>
|
|
<provides>
|
|
<service name="Input"/>
|
|
<service name="Framebuffer"/>
|
|
</provides>
|
|
</start>}
|
|
|
|
append_platform_drv_config
|
|
|
|
append_if [have_spec framebuffer] config {
|
|
<start name="fb_drv" caps="200">
|
|
<resource name="RAM" quantum="4M"/>
|
|
<provides><service name="Framebuffer"/></provides>
|
|
</start>}
|
|
|
|
append_if [have_spec ps2] config {
|
|
<start name="ps2_drv">
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides><service name="Input"/></provides>
|
|
</start>}
|
|
|
|
append_if [have_spec gpio] config "
|
|
<start name=\"[gpio_drv]\">
|
|
<resource name=\"RAM\" quantum=\"4M\"/>
|
|
<provides><service name=\"Gpio\"/></provides>
|
|
<config/>
|
|
</start>"
|
|
|
|
append_if [expr ![have_spec ps2] && [have_spec usb]] config {
|
|
<start name="usb_drv">
|
|
<resource name="RAM" quantum="12M"/>
|
|
<provides><service name="Input"/></provides>
|
|
<config uhci="yes" ehci="yes" xhci="yes"> <hid/> </config>
|
|
</start>}
|
|
|
|
append config {
|
|
|
|
<start name="terminal_noux">
|
|
<binary name="terminal"/>
|
|
<resource name="RAM" quantum="2M"/>
|
|
<provides><service name="Terminal"/></provides>
|
|
<config>
|
|
<keyboard layout="de"/>
|
|
</config>
|
|
</start>
|
|
<start name="terminal_gdb">
|
|
<binary name="terminal_crosslink"/>
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides> <service name="Terminal"/> </provides>
|
|
</start>
|
|
<start name="gdb_monitor">
|
|
<resource name="RAM" quantum="16M"/>
|
|
<route>
|
|
<service name="Terminal"><child name="terminal_gdb"/></service>
|
|
<any-service><parent/><any-child/></any-service>
|
|
</route>
|
|
<config>
|
|
<libc stdout="/dev/log" stderr="/dev/log">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
</libc> }
|
|
append config "
|
|
<target name=\"${gdb_target_binary_name}\"> "
|
|
append config {
|
|
<config>
|
|
<libc stdout="/dev/log" stderr="/dev/log">
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
</libc>
|
|
</config>
|
|
</target>
|
|
<preserve name="RAM" quantum="5M"/>
|
|
</config>
|
|
</start>
|
|
<start name="noux">
|
|
<resource name="RAM" quantum="1G"/>
|
|
<route>
|
|
<service name="Terminal" label="">
|
|
<child name="terminal_noux"/>
|
|
</service>
|
|
<service name="Terminal" label="/dev/gdb">
|
|
<child name="terminal_gdb"/>
|
|
</service>
|
|
<any-service><parent/><any-child/></any-service>
|
|
</route>
|
|
<config>
|
|
<fstab>
|
|
<tar name="gdb.tar" at="/"/>
|
|
<dir name="dev"><terminal name="gdb" label="/dev/gdb"/></dir>
|
|
<dir name="gdb"> }
|
|
append config "
|
|
<tar name=\"${gdb_target_binary_name}.tar\"/>
|
|
<dir name=\"src\"> <tar name=\"${gdb_target_binary_name}-src.tar\"/> </dir> "
|
|
append config {
|
|
</dir>
|
|
</fstab> }
|
|
append config "
|
|
<start name=\"/bin/${tool_prefix}gdb\">
|
|
<arg value=\"/gdb/ld.lib.so\"/> "
|
|
append config {
|
|
<arg value="-ex" /><arg value="set interactive-mode off" />
|
|
<arg value="-ex" /><arg value="directory /gdb/src" />
|
|
<arg value="-ex" /><arg value="target remote /dev/gdb" />
|
|
<arg value="-ex" /><arg value="b binary_ready_hook_for_gdb" />
|
|
<arg value="-ex" /><arg value="c" />
|
|
<arg value="-ex" /><arg value="delete 1" /> }
|
|
append config "
|
|
<arg value=\"-ex\" /><arg value=\"file /gdb/${gdb_target_binary_name}\" /> "
|
|
append config {
|
|
<arg value="-ex" /><arg value="b main" />
|
|
<arg value="-ex" /><arg value="set solib-search-path /gdb" />
|
|
<arg value="-ex" /><arg value="sharedlibrary" />
|
|
<arg value="-ex" /><arg value="c" />
|
|
<arg value="-ex" /><arg value="delete 2" />
|
|
<arg value="-ex" /><arg value="set interactive-mode auto" />
|
|
</start>
|
|
</config>
|
|
</start>
|
|
</config>
|
|
}
|
|
|
|
install_config $config
|
|
|
|
|
|
#
|
|
# Boot modules
|
|
#
|
|
|
|
# evaluated by the run tool
|
|
proc binary_name_gdbserver_platform_lib_so { } {
|
|
return "gdbserver_platform-$::env(KERNEL).lib.so"
|
|
}
|
|
|
|
# generic modules
|
|
set boot_modules {
|
|
core init timer ld.lib.so noux terminal terminal_crosslink
|
|
libc.lib.so libm.lib.so libc_noux.lib.so ncurses.lib.so expat.lib.so
|
|
libc_pipe.lib.so libc_terminal.lib.so
|
|
gdb_monitor gdbserver_platform.lib.so test-gdb_monitor
|
|
gdb.tar test-gdb_monitor.tar test-gdb_monitor-src.tar
|
|
}
|
|
|
|
# platform-specific modules
|
|
lappend_if [have_spec linux] boot_modules fb_sdl
|
|
lappend_if [have_spec framebuffer] boot_modules fb_drv
|
|
lappend_if [have_spec ps2] boot_modules ps2_drv
|
|
lappend_if [have_spec usb] boot_modules usb_drv
|
|
lappend_if [have_spec gpio] boot_modules [gpio_drv]
|
|
|
|
append_platform_drv_boot_modules
|
|
|
|
build_boot_image $boot_modules
|
|
|
|
|
|
run_genode_until forever
|
|
|