|
| 1 | +# Cross Compiling configuration for Luckfox Pico embedded SBC. |
| 2 | +# |
| 3 | +# To build on Ubuntu x86_64: rake MRUBY_CONFIG=build_config/luckfox_pico.rb |
| 4 | +# Uses Buildroot SDK for this board. Binaries run on the corresponding Linux image. |
| 5 | +# Requires: https://github.com/LuckfoxTECH/luckfox-pico |
| 6 | +# |
| 7 | +# NOTE: default config includes all standard mrbgems, EXCEPT: mruby-cmath |
| 8 | +# |
| 9 | +MRuby::CrossBuild.new("luckfox_pico") do |conf| |
| 10 | + # Clone the luckfox-pico repo above next to (same directory level) as mruby. |
| 11 | + SDK_BASE = File.realpath(File.expand_path("../../../", File.expand_path(__FILE__)) + "/luckfox-pico") |
| 12 | + TOOLCHAIN_BASE = "#{SDK_BASE}/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf" |
| 13 | + SYSROOT = "#{TOOLCHAIN_BASE}/arm-rockchip830-linux-uclibcgnueabihf/sysroot" |
| 14 | + |
| 15 | + toolchain :gcc |
| 16 | + |
| 17 | + # C compiler settings |
| 18 | + conf.cc do |cc| |
| 19 | + cc.command = "#{TOOLCHAIN_BASE}/bin/arm-rockchip830-linux-uclibcgnueabihf-gcc" |
| 20 | + |
| 21 | + cc.include_paths << "#{TOOLCHAIN_BASE}/lib/gcc/arm-rockchip830-linux-uclibcgnueabihf/8.3.0/include" |
| 22 | + cc.include_paths << "#{TOOLCHAIN_BASE}/lib/gcc/arm-rockchip830-linux-uclibcgnueabihf/8.3.0/include-fixed" |
| 23 | + cc.include_paths << "#{TOOLCHAIN_BASE}/arm-rockchip830-linux-uclibcgnueabihf/include/c++/8.3.0/arm-rockchip830-linux-uclibcgnueabihf" |
| 24 | + cc.include_paths << "#{SYSROOT}/usr/include" |
| 25 | + |
| 26 | + # Flags taken from the SDK's Makefile |
| 27 | + cc.flags << ["-march=armv7-a", "-mfpu=neon", "-mfloat-abi=hard"] |
| 28 | + cc.flags << ["-D_LARGEFILE_SOURCE", "-D_LARGEFILE64_SOURCE", "-D_FILE_OFFSET_BITS=64", "-ffunction-sections", "-fdata-sections"] |
| 29 | + cc.flags << ["-O2", "-fPIC"] |
| 30 | + cc.flags << ["-Wl,--copy-dt-needed-entries", "-Wl,-lc,-lgcc_s"] |
| 31 | + end |
| 32 | + |
| 33 | + # Linker settings |
| 34 | + conf.linker do |linker| |
| 35 | + linker.command = cc.command |
| 36 | + linker.library_paths << "#{TOOLCHAIN_BASE}/arm-rockchip830-linux-uclibcgnueabihf/lib" |
| 37 | + linker.flags = cc.flags |
| 38 | + end |
| 39 | + |
| 40 | + # Archiver settings |
| 41 | + conf.archiver do |archiver| |
| 42 | + archiver.command = "#{TOOLCHAIN_BASE}/bin/arm-rockchip830-linux-uclibcgnueabihf-ar" |
| 43 | + end |
| 44 | + |
| 45 | + # Do not build executable test |
| 46 | + conf.build_mrbtest_lib_only |
| 47 | + |
| 48 | + # Disable C++ exception |
| 49 | + conf.disable_cxx_exception |
| 50 | + |
| 51 | + # All standard gems. |
| 52 | + conf.gem 'mrbgems/mruby-array-ext/' |
| 53 | + conf.gem 'mrbgems/mruby-bigint/' |
| 54 | + conf.gem 'mrbgems/mruby-bin-config/' |
| 55 | + conf.gem 'mrbgems/mruby-bin-debugger/' |
| 56 | + conf.gem 'mrbgems/mruby-bin-mirb/' |
| 57 | + conf.gem 'mrbgems/mruby-bin-mrbc/' |
| 58 | + conf.gem 'mrbgems/mruby-bin-mruby/' |
| 59 | + conf.gem 'mrbgems/mruby-bin-strip/' |
| 60 | + conf.gem 'mrbgems/mruby-binding/' |
| 61 | + conf.gem 'mrbgems/mruby-catch/' |
| 62 | + conf.gem 'mrbgems/mruby-class-ext/' |
| 63 | + # SDK doesn't include complex math for uClibc |
| 64 | + # conf.gem 'mrbgems/mruby-cmath/' |
| 65 | + conf.gem 'mrbgems/mruby-compar-ext/' |
| 66 | + conf.gem 'mrbgems/mruby-compiler/' |
| 67 | + conf.gem 'mrbgems/mruby-complex/' |
| 68 | + conf.gem 'mrbgems/mruby-data/' |
| 69 | + conf.gem 'mrbgems/mruby-dir/' |
| 70 | + conf.gem 'mrbgems/mruby-enum-chain/' |
| 71 | + conf.gem 'mrbgems/mruby-enum-ext/' |
| 72 | + conf.gem 'mrbgems/mruby-enum-lazy/' |
| 73 | + conf.gem 'mrbgems/mruby-enumerator/' |
| 74 | + conf.gem 'mrbgems/mruby-errno/' |
| 75 | + conf.gem 'mrbgems/mruby-error/' |
| 76 | + conf.gem 'mrbgems/mruby-eval/' |
| 77 | + conf.gem 'mrbgems/mruby-exit/' |
| 78 | + conf.gem 'mrbgems/mruby-fiber/' |
| 79 | + conf.gem 'mrbgems/mruby-hash-ext/' |
| 80 | + conf.gem 'mrbgems/mruby-io/' |
| 81 | + conf.gem 'mrbgems/mruby-kernel-ext/' |
| 82 | + conf.gem 'mrbgems/mruby-math/' |
| 83 | + conf.gem 'mrbgems/mruby-metaprog/' |
| 84 | + conf.gem 'mrbgems/mruby-method/' |
| 85 | + conf.gem 'mrbgems/mruby-numeric-ext/' |
| 86 | + conf.gem 'mrbgems/mruby-object-ext/' |
| 87 | + conf.gem 'mrbgems/mruby-objectspace/' |
| 88 | + conf.gem 'mrbgems/mruby-os-memsize/' |
| 89 | + conf.gem 'mrbgems/mruby-pack/' |
| 90 | + conf.gem 'mrbgems/mruby-proc-binding/' |
| 91 | + conf.gem 'mrbgems/mruby-proc-ext/' |
| 92 | + conf.gem 'mrbgems/mruby-random/' |
| 93 | + conf.gem 'mrbgems/mruby-range-ext/' |
| 94 | + conf.gem 'mrbgems/mruby-rational/' |
| 95 | + conf.gem 'mrbgems/mruby-set/' |
| 96 | + conf.gem 'mrbgems/mruby-sleep/' |
| 97 | + conf.gem 'mrbgems/mruby-socket/' |
| 98 | + conf.gem 'mrbgems/mruby-sprintf/' |
| 99 | + conf.gem 'mrbgems/mruby-string-ext/' |
| 100 | + conf.gem 'mrbgems/mruby-struct/' |
| 101 | + conf.gem 'mrbgems/mruby-symbol-ext/' |
| 102 | + # conf.gem 'mrbgems/mruby-test-inline-struct/' |
| 103 | + # conf.gem 'mrbgems/mruby-test/' |
| 104 | + conf.gem 'mrbgems/mruby-time/' |
| 105 | + conf.gem 'mrbgems/mruby-toplevel-ext/' |
| 106 | +end |
0 commit comments