Change Font size Increase/Decrease in file (Alt + Mouse scroll ball)
TIME and Date
__DATE__
__TIME__
using __TIME__ and __DATE__ with the xc8 compiler I’m able to get the time and date as strings. As I don’t have a RTCC and only limited program and data memory, I want to implement the time & date functionality as efficiently as possible. So I’ve tried to use macros and thought this would save some memory, but unfortunately it does not.
For example: this is the code I use to get the starting hour as an int:
#define BUILD_HOUR ((__TIME__[0] - '0') * 10 + __TIME__[1] - '0') int hour = BUILD_HOUR;// start value
I assumed that the preprocessor and compiler would optimize this, so I would not get a lot of addidtional memory usage. But the whole cumputation is done by the pic 12F1572 I use. Is there a better solution for this problem or any workaround ?
Lua RTOS is an open-source real-time operating system (RTOS) designed to run Lua applications on microcontrollers and other embedded systems. It aims to provide a lightweight and efficient platform for developing embedded applications with Lua scripting capabilities.Here will discuss ESP32 Lua RTOS Flash Firmware tutorial.
Overall, Lua RTOS is a versatile and lightweight operating system that empowers developers to build embedded applications with Lua scripting capabilities. Its integration with popular microcontroller platforms and active community support make it a compelling choice for IoT and embedded systems development. We tested with EPSressif ESP-Wroom-32 Dev Board and ESP32 Core firmware with the ESPressif Flash tool.
Lua RTOS is built on Lua, a lightweight scripting language. Lua is known for its simplicity, ease of use, and flexibility, making it ideal for embedded systems development.
Real-Time Operating System
Lua RTOS provides a real-time operating system (RTOS) environment for embedded systems. It offers task scheduling, inter-task communication, and synchronization mechanisms.
Supported Hardware
Lua RTOS supports various microcontroller architectures, including ESP32, ESP8266, STM32, and others. It is highly portable and can be adapted to different hardware platforms.
Multitasking
Lua RTOS enables multitasking, allowing multiple Lua scripts to run concurrently as separate tasks. Tasks can communicate and synchronize through message passing and semaphores.
File System
Lua RTOS includes a file system API for accessing files on external storage devices such as SD cards or SPI flash memory. It supports file operations like reading, writing, and listing.
Networking
Lua RTOS supports networking protocols such as TCP/IP, UDP, MQTT, and HTTP. It allows embedded devices to communicate over Ethernet, Wi-Fi, or other network interfaces.
Peripheral Support
Lua RTOS provides APIs for interfacing with various peripherals such as GPIO, UART, SPI, I2C, ADC, DAC, and more. Developers can easily control and communicate with hardware components.
Development Environment
Lua RTOS development can be done using lightweight text editors or integrated development environments (IDEs) with Lua support. It offers flexibility in choosing development tools.
Community
Lua RTOS has an active community of developers and users who contribute to its development, share knowledge, and provide support through forums, mailing lists, and social media.
This table summarizes the key features and characteristics of Lua RTOS, providing an overview of its capabilities and suitability for embedded systems development.
Setting up Lua RTOS
Step
Description
1. Obtain Lua RTOS
Download Lua RTOS from the official repository or source.
2. Install prerequisites
Install any required dependencies, such as Git and GCC, according to Lua RTOS documentation.
3. Set up development environment
Configure your development environment, including setting up a terminal and text editor.
4. Initialize project directory
Create a new directory for your Lua RTOS project.
5. Write your Lua code
Develop Lua scripts and application logic within the project directory.
6. Configure Lua RTOS
Customize Lua RTOS configuration files to match your project requirements.
7. Compile Lua RTOS
Use the provided build system to compile Lua RTOS for your target hardware platform.
8. Flash Lua RTOS
Flash the compiled Lua RTOS image to your target hardware using tools like esptool.py.
9. Test your application
Verify the functionality of your Lua RTOS application on the target hardware platform.
10. Iterate and improve
Continuously refine your Lua RTOS application based on testing feedback and requirements.
Firmware
Where to get Lua-RTOS firmware? (Pr-compiled binaries)
Download the appropriate firmware for your ESP32 board from the provided link. Once you’ve downloaded the appropriate firmware, unzip the file anywhere on your machine. Similarly, download the Flash tool from the same link and unzip it. Next, open the flash tool designed for ESP32 and configure the following parameters:
Baud rate: 921600
Flash mode: “dio”
Flash frequency: “40m”
For flashing the firmware, use the following addresses:
Once the flashing process is complete, you’re all set.
Note: Make sure to adjust the “esp-idf path” and “usb path” as per your requirements.
Connect to the Console
Connect any UART Serial Tool to your device and configure the following parameters:
Speed: 115200 bauds
Data bits: 8
Stop bits: 1
Parity: None
Terminal emulation: VT100
Ensure these settings are accurately configured for seamless communication between your devices.
after connecting esp32 to the PC you will see the following.
/\ /\
/ \_____/ \
/_____________\
W H I T E C A T
Lua RTOS beta 0.1 build 1479953238 Copyright (C) 2015 - 2017 whitecatboard.org
cpu ESP32 at 240 Mhz
spiffs0 start address at 0x180000, size 512 Kb
spiffs0 mounted
spi2 at pins sdi=012/sdo=013/sck=014/cs=015
sd0 is at spi2, pin cs=015
sd0 type II, size 1943552 kbytes, speed 15 Mhz
sd0a partition type 0b, sector 227, size 1943438 kbytes
fat init file system
fat0 mounted
redirecting console messages to file system ...
Lua RTOS beta 0.1 powered by Lua 5.3.4
Executing /system.lua ...
Executing /autorun.lua ...
/ >