To use the Assembly Language in WebOS, you need to use the PDK given by HP. For more information, see this address: https://developer.palm.com/content/api/dev-guide/pdk/overview.html.
If you are developing a PDK, you can find the PDK path on the user interface. If it is under Mac, it will be loaded into/OPT. Because this path cannot be displayed in the finder, you can use the Unix CP command to copy the/opt/palmpdk directory to the display location in the finder, this facilitates editing, compilation, and debugging.
Suppose I put this directory under/users/zenny_chen. You can open palmpdk and see some sample code provided by HP in the share/samplecode/directory. Let's start with simple.
1. Open terminal under your Mac OS X. Note that you should first set your location to the Mac directory in the simple example. CD/users/zenny_chen/palmpdk/share/samplecode/simple/MAC/
2. Set the project directory and compiler directory like android. In Mac OS X, there is a compilation template bash file -- buildit_for_device.sh. Therefore, we can easily compile and connect to this project by modifying this bash file. In terminal, enter Path = "/users/zenny_chen/palmpdk/ARM-gcc/bin"
Export path
Palmpdk = "/users/zenny_chen/palmpdk"
Export palmpdk
3. After completion, we can add the new Assembly source file -- hey. s under the src directory and edit it:
.text
.align 4
.arm
.globl my_real_arm
my_real_arm:
add r0, r0, #256
vmov q0, q1
vdup.32 q0, r0
bx lr
4. Add extern "C" int my_real_arm (INT dummy) to simple. cpp, and then call it in a function.
5. Modify the buildit_for_device.sh file.
First, we need to add hey. S. Let's add a symbol -- src2, enter: Export src2 = "Hey. s" under export src = "Simple. cpp"
Note that there cannot be spaces before and after the equal sign (=.
Then, we find $ CC $ deviceopts $ cppflags $ ldflags $ libs-o $ builddir/$ OUTFILE $ srcdir/$ SRC at the end.
Change it to $ CC $ deviceopts $ cppflags $ ldflags $ libs-o $ builddir/$ OUTFILE $ srcdir/$ SRC $ srcdir/$ src2
After saving the information, run./buildit_for_device.sh pre in terminal.
We will add pre later to tell the script that we use the armv7a architecture to enable the neon feature. If there is no pre, the script will be compiled using the arm11 option.
If you see an error in mkdir, manually add the build_device directory in the Mac directory before executing the script.