one of onion omega developer(Lazar Demin) said below reasons
Since SPI flash cannot be easily connected and disconnected like USB storage or SD cards, the Linux kernel does not support automatic detection of SPI flash devices or partitions on the devices.
Instead, the SPI flash must be defined in the Kernel Device Tree.
See how the Omega's internal flash device and partitions are defined in the device tree specification (DTS) here: https://github.com/OnionIoT/source/blob/openwrt-18.06/target/linux/ramips/dts/OMEGA2.dtsi#L103
To support an external flash, you'll need to:
Add the SPI flash & it's partitions to the DTS
build a new firmware with the modified DTS.
I have verified it clearly. but I am worrying about onion guys are saying(Onion Corporation is not responsible for any damage to your device caused by using custom firmware or packages not built and released by Onion Corporation).
can you please help me sir how to add SPI code in custom firmware for detection of external SPI bus device.
Hi all! I glad to show my template of project Hello world that uses CMake build system, it's named as myapptemplate.
My last sample was use GNU Autotools, it's a difficult system. Today we have many projects with CMake (cmake.org). For new projects I recommend use CMake. But it will have problems with cross-compilation for beginners. Let's find it out!
Step 1. Creating you own CMake project
First you have to install git and cmake applications in the host if there are none.
Next follow into you projects directory in the host, e.g. $HOME/projects and clone there my CMake template myapptemplate project. Then enter new project directory and remove .git dir from there.
git clone --single-branch --branch CMake https://bitbucket.org/hlorka/myapptemplate.git <my_app_name>
rm -rf ./.git
The files CMakeSettings.json and myapptemplate.vcxproj for MS Visual Studio IDE and can be deleted too.
Step 2A. General compilation for the host machine
It's very simple. First you have to configure and make cache CMake's files. Look at the command below:
cmake . [--config Debug]
--config Debug will append debug information (symbols) and postfix -d to the output binary file (helloworld-d).
Then you can build (compile) project, using next commands below
cmake --build . [--clean-first]
Or via Makefile (make utility)
Step 2B. Cross-compilation using OpenWRT SDK
First open file cross-compile/openwrt-mips-toolchain.cmake for modify.
Fragment of this file below:
# Локальные переменные
# Экспортируемая переменная, в скрипт `xcmake.sh`
You have to check/modify OpenWRT SDK paths.
Next run cmake with parameters:
cmake -DCMAKE_TOOLCHAIN_FILE=./cross-compile/openwrt-mips-toolchain.cmake [--config Debug] [-DREMOTE_INSTALL_IP=<remote-IP> -DREMOTE_INSTALL_USER=root]
Parameters REMOTE_INSTALL_* will make targets to help you copy binary files to the Omega via rsync. You also need SSH access by key.
To build (cross-compile) project you have to run script:
./xcmake.sh --build . [--clean-first]
Step 3 (optional). Remote-installation
If you set REMOTE_INSTALL_* parameters, after build you able using remote-install, remote-uninstall targets for example below:
cmake --build . --target remote-install
Step 4 (optional). Making IPK-package
After cross-compilation you will see files openwrt-manifest-git.mk, openwrt-manifest-local.mk in the root project directory. There are two variants of manifest (renamed Makefile).
openwrt-manifest-git.mk - variant of manifest file of project to make package that sources will be download from Git repository.
openwrt-manifest-local.mk - variant of manifest file of project to make package localy. It's useful for debugging or internal using.
To make package, first you have to create feed directory outside this project, e.g. $HOME/my-openwrt-packages. Create sub-directory in it with you project name, e.g. $HOME/my-openwrt-packages/<my_app_name>
Then make symlink there for one of the Manifest file, e.g.:
ln -sf $HOME/projects/<my_app_name>/openwrt-manifest-local.mk $HOME/my-openwrt-packages/<my_app_name>/Makefile
Next change working dir to the root of OpenWRT SDK. Open file feeds.conf.default in any text editor and append your own feed there like below string.
src-link my_packages /home/<my_user_name>/projects/my-openwrt-packages
Then run once sequence of commands:
./scripts/feeds update my_packages
./scripts/feeds install <my_app_name>
Now you can build IPK-package:
Your IPK-files you can find in the directory <OpenWRT_SDK_dir>/bin/packages/mipsel_24kc/my_packages. It will named like <my_app_name>_1.0-1_mipsel_24kc.ipk
To install package from IPK-file in the Omega, run next command:
opkg install ./<my_app_name>_1.0-1_mipsel_24kc.ipk
@crispyoz Man thanks for this! I get regular DDoS attacks on my other home-hosted servers, so there's no reason to expect my little Onion device to escape, unfortunately.
I'll check out Nginx when I get the 2Pro and I'll also try lighttpd as well as that seems to have a low resource requirement. The device will only be running the web server and SSH so I don't anticipate too many resource issues, but we'll see!
I'll post something here when it's up and running!
@asyxcv, you should compile it manualy, next link will be usefull: How to compile C/C++ native applications
You are trying to use old manuals about LEDE.
Another way your project has also special manifest for the OpenWRT system (see snapcast/openWrt/Makefile.openwrt) it needs to make .ipk-files (packages) for the opkg util. But this file is old and needs to be fixed. And last: making your own packages for opkg is very difficult task for masters. More infirmations about it you can get from OpenWRT official documents, community and examples.
@Akash614 if you need a definitive answer you would need to give more specific details. @UFD is quite correct, the main issue would be that of capacity. The Pi has more RAM and a faster CPU, but if you don't require these then the Omega may well be suitable.
From your initial question:
Onion has UARTs available
Onion can run a database (I use SQLite3 on an sdcard)
You can run a web server, in fact I run 2 different web servers on my devices
So it comes down to capacity and performance.
@Victor-Lucio Please take a look at this: Official Onion Omega2 Documentation I2C Python Module.
'/usr/lib/python2.7/OmegaExpansion/onionI2C.so' is not empty - it's an ELF binary file.
The source code can be found in the Onion i2c-exp-driver GitHub Repo.
An example of how the onionI2C library is used can be found in the i2c-exp-driver repo.
The example code programs the Relay Expansion (an MCP23008 8-bit, general purpose, parallel I/O expansion IC for I2C) directly.
Thank you for responding, the real direction is 0x70 using 7 bits.
In other words is 111-0000.
If I include the bit of R/W, this will be 0 if i want to write a data in the slave(sensor).
.111000-R/W ----------> 11100000
11100000 Is E0 in hex. For this reason, I have several concerns about this module, but I hope to solve it later. Thans again for taking my doubt. I will try to send you 6 bits as data and include the CRC byte. It is likely that when I insert the writeBytes command, the R/W bit is inclued internally without me noticing.