Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
inbox:eclipse [2020/04/06 14:54] noblepepperinbox:eclipse [2021/10/15 08:21] – ↷ Links adapted because of a move operation bobafetthotmail
Line 17: Line 17:
 1. Get a functioning build system.  1. Get a functioning build system. 
  
-You can use the [[docs/guide-developer/using_the_sdk|OpenWrt SDK]] or you can [[docs/guide-developer/build-system/start|build your own]]. If you use the SDK, the instruction page hadn't been updated when this was written but 19.07.2 SDKs were available, this tutorial was tested with [[https://downloads.openwrt.org/releases/19.07.2/targets/ath79/generic/openwrt-sdk-19.07.2-ath79-generic_gcc-7.5.0_musl.Linux-x86_64.tar.xz|this SDK version]]. If you build your own you need to [[docs/guide-developer/build-system/install-buildsystem|install the build system]]+You can use the [[docs/guide-developer/using_the_sdk|OpenWrt SDK]] or you can [[docs/guide-developer/build-system/start|build your own]]. If you use the SDK, the instruction page hadn't been updated when this was written but 19.07.2 SDKs were available, this tutorial was tested with [[https://downloads.openwrt.org/releases/19.07.2/targets/ath79/generic/openwrt-sdk-19.07.2-ath79-generic_gcc-7.5.0_musl.Linux-x86_64.tar.xz|this SDK version]]. If you build your own you need to [[docs:guide-developer:toolchain:install-buildsystem|install the build system]]
 and [[docs/guide-developer/build-system/use-buildsystem|build an image for your platform]]. This tutorial was tested by checking out v19.07.2 with and configuring for a ATH79 Target System and Buffalo WZR-HP-300H Target Profile. and [[docs/guide-developer/build-system/use-buildsystem|build an image for your platform]]. This tutorial was tested by checking out v19.07.2 with and configuring for a ATH79 Target System and Buffalo WZR-HP-300H Target Profile.
  
Line 34: Line 34:
  
  
-3. Find your toolchain location and prefix.+3. Find your toolchain location and prefix and gdb executable.
  
 Toolchain location is <buildsystem root>/staging_dir/toolchain-<whatever>/bin Toolchain location is <buildsystem root>/staging_dir/toolchain-<whatever>/bin
  
 Toolchain prefix is the part of the filenames in the toolchain directory before the tool name. For example, if you see a file named mips-openwrt-linux-musl-gcc, the toolchain prefix is mips-openwrt-linux-musl-. Toolchain prefix is the part of the filenames in the toolchain directory before the tool name. For example, if you see a file named mips-openwrt-linux-musl-gcc, the toolchain prefix is mips-openwrt-linux-musl-.
 +
 +The gdb executable is in the toolchain location.
  
 You can find these by using these commands from the buildsystem root: You can find these by using these commands from the buildsystem root:
Line 44: Line 46:
 Toolchain location: Toolchain location:
 <code> <code>
-find $(pwd)/staging_dir -type f -name '*-gcc' -printf "%h/\n"+find $(pwd)/staging_dir -type f -name '*-gcc' -printf "%h/\n"|grep -v initial
 </code> </code>
 Toolchain prefix: Toolchain prefix:
Line 50: Line 52:
 find $(pwd)/staging_dir -type f -name '*-gcc' -printf "%f\n"|sed s/gcc// find $(pwd)/staging_dir -type f -name '*-gcc' -printf "%f\n"|sed s/gcc//
 </code> </code>
 +gdb executable: 
 +<code> 
 +find $(pwd)/staging_dir -type f -name '*-gdb'</code>
 4. Cross compile hello world 4. Cross compile hello world
  
Line 59: Line 63:
 <code>/home/pep/Hack/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/bin/</code>  <code>/home/pep/Hack/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/bin/</code> 
 For the test system using the SDK toolchain this directory is For the test system using the SDK toolchain this directory is
-<code>/home/pep/Hack/openwrt-sdk-19.07.2-ath79-generic_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/bin/</code> Enter your toolchain prefix in the Cross compiler prefix textbox The toolchain prefix for the test system is <code>mips-openwrt-linux-musl-</code>+<code>/home/pep/Hack/openwrt-sdk-19.07.2-ath79-generic_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/bin/</code> Enter your toolchain prefix in the Cross compiler prefix textbox The toolchain prefix for the test system is <code>mips-openwrt-linux-musl-</code> Click Finish
  
 If you are still on the Welcome Screen, click the Workbench icon in the upper right. Select the project you just created and on the main menubar use Project->Build project and you should see Build Finished. 0 errors, 0 warnings in the Console area. If you are still on the Welcome Screen, click the Workbench icon in the upper right. Select the project you just created and on the main menubar use Project->Build project and you should see Build Finished. 0 errors, 0 warnings in the Console area.
  
-5. Set up remote system +5. Set up remote target 
-  Select Window->Perspective->Open Perspective->Other... from the menubar. +Select Window->Show View->Others from the menubar. 
-   + 
-  Select Remote System Explorer from the dialog and click open. +Expand Remote Systems, select Remote Systems from the dialog and click open. 
-   + 
-  Select File->New->Other from the menubar +Select File->New->Other from the menubar 
-   + 
-  Expand Remote System Explorer in the dialog, select Connection and click Next +Expand Remote System Explorer in the dialog, select Connection and click Next 
-   + 
-  Select Linux and click next +Select Linux and click next 
-   + 
-  Enter your routers ipaddress in the Host name text box, click Next, +Enter your routers ipaddress in the Host name text box, click Next, 
-   + 
-  Check the ssh.files checkbox, select SSH Connector Service, click Next, +Check the ssh.files checkbox, select Ssh/Sftp File Service, click Next, 
-   + 
-  Check the processes.shell.linux checkbox, select Shell Process Service, click Next, +Check the processes.shell.linux checkbox, click Next, 
-   + 
-  Check the ssh.shells checkbox, select SSH Connector Service, and finally click Finish +Check the ssh.shells checkbox, and finally click Finish 
-  +
 6. Access files on remote system 6. Access files on remote system
  
-In the Remote Systems Tab expand the entry with your router's ipaddress, expand the Root entry+In the Remote Systems Tab expand the entry with your router's ipaddress, expand Sftp files, expand the Root entry
  
 In the Enter Password dialog change the User ID to root, enter your router's password, check Save User ID and Save Password checkboxes. Answer Yes to the questions about connecting over ssh. You can set a password hint if you want but it is not required. In the Enter Password dialog change the User ID to root, enter your router's password, check Save User ID and Save Password checkboxes. Answer Yes to the questions about connecting over ssh. You can set a password hint if you want but it is not required.
Line 96: Line 100:
 In the main tab: In the main tab:
  
-  Click the New button next to the Connection Dropdown, use the dropdown to select ssh,  +Click the New button next to the Connection Dropdown, use the dropdown to select ssh, Click OK 
-  enter your router's ipaddress for Host, root for User,  +Enter your router's ipaddress for Host, root for User,  
-  check password based checkbox, enter password in Password text box. Click Finish. +Check password based checkbox, enter password in Password text box. Click Finish. 
-   +Select Remote Host in Connection Dropdown 
-  Enter the program name in the Remote Absolute Path textbox+ 
 +Enter the program name in the Remote Absolute Path textbox, it must include a path (I use either /hellocpp or /root/hellocpp) 
  
 In the debugger tab: In the debugger tab:
  
-  In the GDB debugger text box enter the location of gdb in the toolchain location found in Step 3.  +In the GDB debugger text box enter the gdb executable found in step 
-  On the test system this is  +
-  /home/pep/Hack/openwrt-sdk-19.07.2-ath79-generic_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/bin/mips-openwrt-linux-musl-gdb +
- +
 Click Apply, Click Debug Click Apply, Click Debug
  
-Allow the IDE to switch to the Debug perspective. The program will launch on the router and stop at the first line in main, you can step, continue, etc with the icons on the toolbar+Allow the IDE to switch to the Debug perspective. The program will launch on the router and stop at the first line in main, you can step, continue, etc with the icons on the toolbar, the ide will follow in the source file tab and output will be shown in the Console tab.
      
 8. Using existing makefile programs 8. Using existing makefile programs
  • Last modified: 2021/10/15 09:06
  • by bobafetthotmail