As I shortly mentioned yesterday in LibreELEC post, Kodi has now lost its only Android developer earlier this year due to some disagreements, and the project is now (mostly) maintained in Kodi forks such as SPMC or MrMC. The situation is not yet critical, but if Android developers are not found soon, there may not be an Android version in the future, as mentioned on the latest blog post on Kodi.tv. Here’s the excerpt of that developer post specific to Android: A Call for Android Devs (and Windows and iOS) As many of you know, we are a bit shorthanded in the Android development department. While there are actually two projects SPMC and MrMC that have Android devs committing code, the upstream project Kodi has no one at the moment. If you are familiar with C++ and Android development (particularly recent Android TV development) and would like to help, feel […]
GNU Complexity Command Line Tool Measures Complexity of C Code
GNU complexity is a command line tool that computes a complexity measure of C source code, similar to pmccabe, but with a different method of calculating results with short functions scoring lower than pmccabe and highly nested functionality can score considerably higher. It can be useful to locate suspicious areas in unfamiliar code, get an idea of the efforts required to either understand the code or test it, or self-assess your own code. Bruce Korb, the maintainer, has just released version 1.5 with some bug fixes, so I’ve given it a quick try. We’ll need to get the code, build and install it first:
1 2 3 4 5 6 |
wget ftp://ftp.gnu.org/gnu/complexity/complexity-1.5.tar.gz tar xvf complexity-1.5.tar.gz cd complexity-1.5 ./configure make -j8 sudo make install |
The user’s manual provides some insights and an example, which I’ve used against a directory in Linux source code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
cd ~/edev/linux/arch/arm64/kernel complexity --histogram --score --thresh=3 `ls *.c` procedure fpsimd_pm_init in fpsimd.c ended before final close bracket procedure fpsimd_hotplug_init in fpsimd.c ended before final close bracket Complexity Scores Score | ln-ct | nc-lns| file-name(line): proc-name 3 28 17 perf_callchain.c(111): perf_callchain_user 3 20 18 insn.c(337): aarch64_insn_decode_immediate 3 21 19 io.c(27): __memcpy_fromio 3 21 19 io.c(56): __memcpy_toio 3 30 19 cpufeature.c(860): verify_local_cpu_capabilities 3 21 20 module.c(74): reloc_data 3 24 20 setup.c(199): request_standard_resources 3 27 20 alternative.c(89): __apply_alternatives 3 29 20 cpu_ops.c(53): cpu_read_enable_method 3 29 24 insn.c(362): aarch64_insn_encode_immediate 3 31 24 ptrace.c(76): ptrace_hbptriggered 3 54 24 kgdb.c(159): kgdb_arch_handle_exception 3 28 25 armv8_deprecated.c(145): update_insn_emulation_mode 3 32 25 debug-monitors.c(334): aarch32_break_handler 3 35 26 smp.c(413): acpi_map_gic_cpu_interface 3 42 26 process.c(249): copy_thread 3 58 27 perf_event.c(572): armv8pmu_handle_irq 3 32 28 hw_breakpoint.c(544): toggle_bp_registers 3 34 28 insn.c(1019): aarch64_insn_gen_data3 3 34 29 insn.c(519): aarch64_insn_gen_comp_branch_imm 3 56 29 setup.c(121): smp_build_mpidr_hash 3 35 30 insn.c(397): aarch64_insn_encode_register 3 42 31 signal.c(167): setup_sigframe 3 37 33 hw_breakpoint.c(349): arch_bp_generic_fields 3 49 34 setup.c(232): relocate_initrd 3 41 35 insn.c(708): aarch64_insn_gen_add_sub_imm 3 63 38 setup.c(292): setup_arch 3 109 57 cpufeature.c(469): update_cpu_features 4 46 26 smp.c(477): of_parse_and_init_cpus 4 38 31 traps.c(335): call_undef_hook 4 36 32 insn.c(924): aarch64_insn_gen_data1 4 49 33 armv8_deprecated.c(464): cp15barrier_handler 4 71 34 stacktrace.c(41): unwind_frame 4 42 35 ptrace.c(437): hw_break_set 4 42 37 insn.c(968): aarch64_insn_gen_data2 4 49 37 smp.c(708): handle_IPI 4 58 37 hw_breakpoint.c(231): hw_breakpoint_control 4 47 40 insn.c(757): aarch64_insn_gen_bitfield 4 54 44 ptrace.c(376): hw_break_get 4 60 44 armv8_deprecated.c(378): swp_handler 5 28 27 hw_breakpoint.c(198): hw_breakpoint_slot_setup 5 45 35 ptrace.c(672): compat_gpr_get 5 50 36 hw_breakpoint.c(764): reinstall_suspended_bps 5 59 37 hw_breakpoint.c(476): arch_validate_hwbkpt_settings 5 48 42 insn.c(811): aarch64_insn_gen_movewide 5 49 42 insn.c(868): aarch64_insn_gen_add_sub_shifted_reg 5 60 44 psci.c(36): cpu_psci_cpu_init_idle 5 49 46 insn.c(277): aarch64_get_imm_shift_mask 5 95 89 asm-offsets.c(34): main 6 34 32 cpufeature.c(792): __raw_read_system_reg 6 67 37 signal.c(332): do_signal 6 43 39 topology.c(50): parse_core 6 54 41 ptrace.c(724): compat_gpr_set 6 74 44 traps.c(147): dump_backtrace 6 55 49 insn.c(646): aarch64_insn_gen_load_store_pair 6 76 49 hw_breakpoint.c(393): arch_build_bp_info 6 71 52 hw_breakpoint.c(584): breakpoint_handler 6 61 54 insn.c(1062): aarch64_insn_gen_logical_shifted_reg 6 73 59 ptrace.c(1120): compat_arch_ptrace 8 50 30 cpuinfo.c(102): c_show 8 64 50 topology.c(97): parse_cluster 8 97 65 hw_breakpoint.c(660): watchpoint_handler 9 44 32 traps.c(59): dump_mem 11 71 55 signal32.c(129): copy_siginfo_to_user32 31 198 172 module.c(184): apply_relocate_add Complexity Histogram Score-Range Lin-Ct 0-9 2206 ************************************************************ 10-19 55 * 20-29 0 30-39 172 ***** Scored procedure ct: 65 Non-comment line ct: 2433 Average line score: 7 25%-ile score: 3 (75% in higher score procs) 50%-ile score: 5 (half in higher score procs) 75%-ile score: 6 (25% in higher score procs) Highest score: 31 (apply_relocate_add() in module.c) |
The resulting table shows six information per line: the computed score, the number of lines between the opening and closing curly braces (ln-ct), the number […]
Embedded Systems Conference 2016 Schedule – April 13-14
The Embedded Systems Conference 2016 will take place in Boston on April 13-14, and the organizers have now released the schedule, minus some keynotes, which features four main tracks: Embedded Hardware, Embedded Software, Connected Devices and the Internet of Things (IoT), and the ESC Engineering Theatre. As usual, I’ve gone through the list of talks and composed my own little virtual schedule which ended up with sessions focusing on power management, IoT, and security, as well some optimization and drivers development talks among others, such as patents, and the origin of Gerber files. Wednesday 13 8:00 – 9:00 – Power Management in Embedded Systems by Colin Walls, Embedded Software Technologist, Mentor Graphics The importance of power management in today’s embedded designs has been steadily growing as an increasing number of battery powered devices are developed. In this session, we will discuss design considerations that should be made when starting a […]
Light Biz OS Firmware, Android and Ubuntu Image, and Android SDK Released for GeekBox (RK3368)
GeekBox is an upcoming Android TV box based on Rockchip RK3368 octa-core processor that doubles as a system-on-module and development board. The company has now uploaded the Android 5.1 SDK, including Linux 3.10.79 kernel, on github. It’s not for the Android SDK for RK3368, but at least it’s not just an outdated tarball, and will hopefully be regularly updated directly on github. Beside the source code, the company also released three firmware image including Rockchip’s Light Biz OS desktop operating system based on Lollipop: Biz OS for GeekBox – V151208 (8th of December 2015) Android and Lubuntu dual boot image – V151129 (29th of November 2015) Android 5.1 image – V151129 (29th of November 2015) It’s quite possible those images will also work on other Rockchip RK3368 platform with some modifications, e.g. an updated device tree file for a given hardware. I’ve downloaded Biz OS adn the dual boot image, […]
Allwinner A64 Android 5.1 SDK and Linux Source Code
Allwinner A64 is likely to become quite popular as it will be used in PINE A64 board, Olimex open source hardware laptop featuring A64-OLinuXino board, and some low cost tablets. We’ve already got some documentation such as Allwinner A64 datasheet and user’s manual, but AFAIK, there was no source code released for the board. The good news is that you can now download Android 5.1 SDK and Linux source code on Baidu with four files available: lichee_A64_A5.1_V1.0.tar.gz – Linux source code android_A64_A5.1_V1.0.tar.gz– Android 5.1 SDK android_prebuilts_A64_A5.1_V1.0.tar.gz – Some pre-built binaries for Android A64硬件资料.zip – Documentation including the datasheet, product brief, and user’s manual which we’ve already got, but also some hardware with reference schematics, PCB layout files, and BoM for an Allwinner A64 tablet. That’s about 7.4GB to download, and apart from the documentation, the download is not quite complete yet, so I could not look into the details of […]
Free Electrons Releases Buildroot Training Materials
Free Electrons develops embedded Linux & Android software, and also provides related training. On-site training sessions are scheduled from time to time, or organized on request, and they usually release their training materials for free, as they did for their Embedded Linux training in 2012, or their Yocto Project / OpenEmbedded course more recently. Thomas Petazzoni, Free Electrons’ Chief Technical Officer, recently informed me that the company also released training materials for Buildroot, which like the Yocto Project is a build system, but it had been around for much longer, and the company is actively participating in its development with over 2,800 patches submitted upstream over the years. Four main resources have been released for the course, under a Creative Commons BY-SA license: training materials for Buildroot – 325 pages Practical labs instructions (PDF) with BeagleBone Black – 32 pages Practical labs data (.tar.xz) – Patchsets for drivers, rootfs, and […]
Linaro 15.05 Release with Linux 4.1 and Android 5.1
Linaro 15.04 has been released with Linux 4.1-rc4, Linux 3.10.79 and 3.14.42 (LSK), and Android 5.1_r3. The Ubuntu image is now based on Vivid instead of Utopic. Android and Debian builds/images have been released for Hikey’s 96boards, Ubuntu Vivid and Android builds have been setup for Qualcomm’s Dragonboard 410c. A new platform, Socionext M8M, has also show in Linaro changelog. I could not find details about M8M, but Socionext is a “new company that designs, develops and delivers System-on-Chip products” and focuses on “imaging, networking and other dynamic technologies”. Their latest press release mentions a 4K media processor with build-in HDMI 2.0 Tx and Rx, so maybe M8M is based on that processor, but I can’t know for sure as they have several chips. Highlights of this release: Linux Linaro 4.1-rc4-2015.05 GATOR updated to version 5.21.1 updated integration-linaro-vexpress64 topic by ARM LT: PCI support added – for Juno r1. Linaro […]
NodeMCU is both a Breadboard-Friendly ESP8266 Wi-Fi Board and a LUA based Firmware
NodeMCU is a LUA based interactive firmware for Expressif ESP8622 Wi-Fi SoC, as well as an open source hardware board that contrary to the $3 ESP8266 Wi-Fi modules includes a CP2102 TTL to USB chip for programming and debugging, is breadboard-friendly, and can simply be powered via its micro USB port. Let’s checkout the hardware first. The latest version of the board (V1.0) has the following specifications and features: Wi-Fi Module – ESP-12E module similar to ESP-12 module but with 6 extra GPIOs. USB – micro USB port for power, programming and debugging Headers – 2x 2.54mm 15-pin header with access to GPIOs, SPI, UART, ADC, and power pins Misc – Reset and Flash buttons Power – 5V via micro USB port Dimensions – 49 x 24.5 x 13mm The hardware documentation for the board can be found on nodemcu-devkit repo, including schematics and PCB layout designed with Altium Designer, […]