Home > Forum > obsolete > SlimLine (Linux) > How to write my first "HelloWorld" program
- This topic has 6 replies, 3 participants and was last updated 11 years, 6 months ago da Sergio Bertana.
-
AuthorPost
-
April 21, 2012 at 8: 02 am #35204Sergio BertanaAdministrator Forum
The module CPU SlimLine Linux is based on a Computer on Modules (CoMs) module produced by Tile. It is supplied by us with the operating system already pre-installed linux embedded - kernel 2.6.31 karo-axel with busybox, bash and various applications and no linux graphical manager. At boot the system runs the boot-loader RedBoot which installs the Linux kernel.
Connect a serial terminal emulation program (Example Toolly in Windows or Putty in Linux), configured a 115200, e, 8, 1 to the COM0 serial port of the CPU module SlimLine. When the module is switched on on the terminal, it is possible to have a report of the operations performed during start-up. You will see something like:
RedBoot> fis load linux
..
Uncompressing Linux………………………………………………………………………………………………………. done, booting the kernel.
Linux version 2.6.31 (gcc version 4.4.1 (GCC) ) #7 PREEMPT Wed Nov 30 10:48:25 CET 2011
CPU: ARM926EJ-S [41069264] revision 4 (ARMv5TEJ), cr=00053177
…If the card is connected to the ethernet network and a DHCP server is present on the network, the module will request a lease of an IP address from the server and will configure itself with the assigned IP. To know the IP it is necessary to view all the information returned by the serial port and search for those referring to DHCP. We will have something like:
dhcpcd[1150]: eth0: broadcasting for a lease
dhcpcd[1150]: eth0: offered 192.168.0.86 from 192.168.0.1
dhcpcd[1150]: eth0: acknowledged 192.168.0.86 from 192.168.0.1
dhcpcd[1150]: eth0: checking for 192.168.0.86
dhcpcd[1150]: eth0: leased 192.168.0.86 for 86400 secondsSo at this point we can abandon the serial connection and reach our module from the ethernet network at the assigned address (in the example it is 192.168.0.86). At all subsequent power-ups, the module will always receive the same IP address from the DHCP server.
April 21, 2012 at 8: 41 am #37226Sergio BertanaAdministrator ForumFor the development of the programs it is necessary to use a Linux PC (VMware virtual machine provided by Elsist) or any Linux PC with all the necessary applications installed. From a command shell it is possible to connect in Telnet with the card simply by typing Telnet followed by the IP, you will be connected to the command interface of the card (Screenshot). With comamdi ls you can run the listing of the current directory and with the command cd date you can go to the directory date where our first program will be transferred.
For the implementation of the program we use CodeLite, an open-source, cross platform IDE for C / C ++. The program is the classic string printing hello world. We provide a CodeLite project with the source files, just compile it to have the file in the Debug directory HelloWorld to be transferred to the CPU SlimLine (Project download).
For the transfer it is necessary to use any FTP client (Example FileZilla), but in our example project we configured CodeLite to perform the transfer via Ftp itself at the end of the compilation of the project. By right-clicking on the name of the project and selecting Settings, the settings window will open; in the Post-Build command the Ftp command of the executable file on the CPU is invoked at the IP address defined in the data directory (Screenshot).
April 21, 2012 at 9: 18 am #37227Sergio BertanaAdministrator ForumCompleted the transfer of the project to the CPU SlimLine from Telnet it is possible to verify that the executable file has actually been transferred to the system's data directory and has all the necessary execution attributes to be executed. With command Ls -l you can view the file attributes, and possibly with the command chmod 777 HelloWorld you can assign run attributes.
At this point, typing ./HelloWorld followed by return the program is executed and the writing hello world returned from the system (Screenshot).
June 13, 2012 at 7: 59 am #37370StefanoParticipantOk, untilHelloWorld it seems clear to me ... Then, where can I find specific documentation / tutorials / manuals related to programming in "C" for the ARM9 module? I am not referring so much to programming in "C" but to libraries to be used to operate with inputs / outputs?
Is it possible to test something with some emulator or do I necessarily have to have the physical cpu module to do some experiments? I was evaluating it for use in home automation (my house) and while I am quite familiar with Linux / Networks / ... PLCs I remember something about LADDER and that's it and therefore I was more inclined towards the "Open" solution.
August 10, 2012 at 1: 56 pm #37371Sergio BertanaAdministrator ForumWe are proceeding with the drafting of the system support library SlimLine, the library which is named "eSLLinuxLib”Is currently available in beta. I created a simple project with CodeLite to generate an executable, which using the library (Supplied with the project) allows you to manage the logical I / O on the expansion bus.
The example with a simple menu of commands from telnet allows you to read the logic inputs, activate the logic outputs, and activate a thread to manage the flashing of a logic output (Download source program).
Unfortunately there is no hardware emulator, so to test the program you need the CPU module SlimLine ARM9 (Linux Open).
October 10, 2012 at 10: 53 am #37441AuthorlessIdleI would like to know if there is a library for managing both RTU and TCP Modbus. I saw that there is a definition of the function that calculates the CRC of modbus packets, but I have not found documentation on how to establish a modbus dialogue.
Also I would like to know if the implementation of analog IO management is planned.
October 10, 2012 at 2: 12 pm #37442Sergio BertanaAdministrator ForumThere is a utility library ElSLUtility (SFR069 **** code) where you can find the class CModbus for the management of the modbus server, the class supports the modbus Ascii, the modbus RTU and the modbus OverIP.
Regarding the analogical management in the library ElSLLinux (SFR064 **** code) you can find the appropriate functions for the management of analog modules.
-
AuthorPost
- You must be logged in to reply to this topic.