Upload
others
View
55
Download
3
Embed Size (px)
Citation preview
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 1
N720 OpenLinux
Source Code Developer
Guide
Version 1.0
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd ii
Copyright
Copyright © 2017 Neoway Technology Co., Ltd. All rights reserved.
No part of this document may be reproduced or transmitted in any form or by any means without
prior written consent of Shenzhen Neoway Technology Co., Ltd.
is the trademark of Shenzhen Neoway Technology Co., Ltd.
All other trademarks and trade names mentioned in this document are the property of their respective
holders.
Notice
This document provides guide for users to use the N720 OpenLinux.
This document is intended for system engineers (SEs), development engineers, and test engineers.
The information in this document is subject to change without notice due to product version update or
other reasons.
Every effort has been made in preparation of this document to ensure accuracy of the contents, but all
statements, information, and recommendations in this document do not constitute a warranty of any kind,
express or implied.
Shenzhen Neoway provides customers complete technical support. If you have any question, please
contact your account manager or email to the following email addresses:
Website: http://www.neoway.com
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd iii
Revision Record
Revision Record
Version Changes Date
Version 1.0 Initial draft 2017-07
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd iv
Contents
1 Compilation Commands .................................................................................................. 1
2 Software Upgrade .............................................................................................................. 2
2.1 Files .................................................................................................................................................... 2
2.2 Burning Files ...................................................................................................................................... 2
3 Code Examples ................................................................................................................... 4
3.1 Adding New Apps .............................................................................................................................. 4
3.2 Adding Nodes ..................................................................................................................................... 7
3.3 Adding Config File in /etc .................................................................................................................. 9
3.4 Commissioning UART ..................................................................................................................... 10
3.4.1 Modifying inittab .................................................................................................................... 10
3.4.2 Modify Source Code ............................................................................................................... 11
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 1
1 Compilation Commands
Compilation:
/build_N720_sdk.sh
Compile kernel
./build_N720_sdk.sh kernel
Compile system
./build_N720_sdk.sh system
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 2
2 Software Upgrade
Files generated after compilation are saved in the version directory.
2.1 Files
N720 IOS image files:
Appsboot.mbn aboot
Mdm9607-boot.img boot
Mdm9607-sysfs.ubi system
NON-HLOS.ubi modem
2.2 Burning Files
1. Enter the fastboot mode: adb reboot bootloader
2. Burn boot.
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 3
3. Burn system.
4. Burn modem.
5. Restart the module.
See N720_OpenLinux_Upgrade_Guide_V1.0.
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 4
3 Code Examples
3.1 Adding New Apps
Apps are stored in the data directory. For details, see port-bridge.
Follow the steps below to add a UART.
1. Save the UART app to the data directory.
2. Add makefile in the data/configure.ac file.
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 5
3. Add the UART directory to the /data/Makefile.am file.
4. Add debian folder and modify relevant files.
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 6
5. Compile after cleaning.
cd oe-core/
source build/conf/set_bb_env.sh
buildclean
cd ..
./build_N720_sdk.sh
6. Check the generated directories and files after the compilation.
(oe-core/build/tmp-glibc/work/mdm9607_perf-oe-linux-gnueabi/mdm-perf-image/1.0-r0/rootf
s/usr/bin)
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 7
3.2 Adding Nodes
Follow the steps below to add an I2C node to the device tree.
1. Modify N720_mdm9607.dtsi and N720_mdm9607-pinctrl.dtsi in /kernel/arch/arm/boot/dts/jsr.
2. Define the GPIO used for the I2C function in N720_mdm9607-pinctrl.dtsi.
i2c_4 {
i2c_4_active: i2c_4_active {
/* active state */
mux {
pins = “gpio18”, “gpio19”; /*SDA and SCL signals for
I2C*/
/*SDA uses GPIO18, and SCL uses GPIO19*/
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 8
function = “blsp_i2c4”; /*The GPIO supports
multiplexing. In i2c_4_active, the GPIO is used as blsp_i2c4.*/
};
config {
pins = "gpio18", "gpio19";
drive-strength = <2>; /*Set the drive strength of
GPIO18 and GPIO19 to 2 mA.*/
bias-disable; /*Options: bias-pull-up,
bias-pull-down, and bias-disable. Bias-disable indicates no-pull*/
};
};
i2c_4_sleep: i2c_4_sleep { /*i2c is in
sleep mode*/
/* suspended state */
mux {
pins = "gpio18", "gpio19";
function = “gpio”; /*Set pins to GPIO. */
};
config {
pins = "gpio18", "gpio19";
drive-strength = <2>; /*The drive
strength is 2 mA.*/
bias-pull-down;
};
};
};
3. Add a new I2C node to the device tree in N720_mdm9607.dtsi.
4. Obtain physical address and interrupt number according to spec.
i2c_4: i2c@78b8000 { /* BLSP1 QUP4 */ /*i2c_4 uses BLSP1
QUP4, the physical address of which is 78b8000. */
compatible = "qcom,i2c-msm-v2";
#address-cells = <1>;
#size-cells = <0>;
reg-names = "qup_phys_addr";
reg = <0x78b8000 0x600>; /*physical address
of i2c_4*/
interrupt-names = "qup_irq";
interrupts = <0 98 0>; /*according to spec, the
interrupt number of BLSP1 QUP4 is 98. Meaning of the third parameter:*/
/*1: low-to-high edge triggered;2: high-to-low edge triggered;3:
active high-level-sensitive;4: active low-level-sensitive*/
qcom,clk-freq-out = <400000>; /*I2C clock frequency
output, Hz*/
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 9
qcom,clk-freq-in = <19200000>; /*Clock frequency
input, HZ*/
clock-names = "iface_clk", "core_clk";
clocks = <&clock_gcc clk_gcc_blsp1_ahb_clk>,
<&clock_gcc clk_gcc_blsp1_qup4_i2c_apps_clk>;
pinctrl-names = “i2c_active”, “i2c_sleep”;
/*pinctrl used*/
pinctrl-0 = <&i2c_4_active>;
pinctrl-1 = <&i2c_4_sleep>;
qcom,noise-rjct-scl = <0>;
qcom,noise-rjct-sda = <0>;
qcom,master-id = <86>;
dmas = <&dma_blsp1 18 64 0x20000020 0x20>,
<&dma_blsp1 19 32 0x20000020 0x20>;
dma-names = "tx", "rx";
status = "ok";
};
5. Confirm whether I2C is configured successfully:
adb shell
cd /dev/
ls i2c*
The added I2C device is displayed.
3.3 Adding Config File in /etc
To add config_test.xml and nvdata.binnew in the /etc/data directory, follow steps below:
Step 1 Save the new config file and bin file in the /data directory.
Step 2 Modify data_git.bb and add file link.
\oe-core\meta-qcom\recipes\data\data_git.bb
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 10
Step 3 Check the comipilation.
3.4 Commissioning UART
UART can be commissioned in two methods: delete #cmdparams=’noinitrd rw
console=ttyHSL0 ,115200’ from oe-core/meta-msm/recipes/linux-quic/linux-quic_git.bb, or add
S:2345:respawn:/sbin/getty -L ttyHSL0 115200 console in inittab.
3.4.1 Modifying inittab
Step 1 Pull inittab from the system.
Step 2 Modify the inittab file.
N720_OpenLinux_Source_Code_Developer_Guide
Copyright © Neoway Technology Co., Ltd 11
Step 3 Import the modified inittab file into the system.
Step 4 UART login system: user name root; password oelinux123.
3.4.2 Modify Source Code
Delete #cmdparams=’noinitrd rw console=ttyHSL0 ,115200’ from
oe-core/meta-msm/recipes/linux-quic/linux-quic_git.bb.