OpenCPU Solution

Last Updated on : 2024-11-20 08:51:49download

Overview

Typically, a Cat.1 module enables communication and connectivity to the cloud, and the MCU and peripherals handle device functionalities. An MCU is interfaced with a Cat.1 module through the serial port to exchange data with the cloud, as shown in the figure below.

OpenCPU Solution

This is a generic solution to connect to the Tuya Developer Platform with Cat.1 modules, giving you the flexibility to design peripherals and select an appropriate MCU. For smart devices with simple features, you can use the peripheral interfaces on the Cat.1 module to connect to external circuits without requiring an MCU. This makes the CPU of the Cat.1 module open for external development, as shown in the figure below.

OpenCPU Solution

The firmware that is originally run on the MCU will be run on the SoC on the Cat.1 module. The functions based on serial communication will be implemented by using OpenAPI. The OpenCPU SDK includes the OpenAPI used to interact with the external circuits as well as tools for compiling and flashing the external firmware.

OpenCPU Solution

How it works

This section uses UIS8910 to describe how to build with the OpenCPU solution.

OpenCPU Solution

In the development stage, write the OpenAPI list to core_export.list. Then, compile the core_export.list to generate core_export.o and core_stub.o by using the GCC compiler and dtools.

  • core_export.o
    Includes the definition of the appImageLoadStub function. This function is called when the system loads the user firmware to populate the real addresses of the OpenAPI functions called in the user firmware into the user firmware’s stub.
  • core_stub.o
    Stubs the OpenAPI functions exposed in the core_export.list. When building the user firmware, link all the OpenAPI functions called by the firmware to the stubs specified in the core_stub.o. When the system loads the user firmware, call the appImageLoadStub function defined in core_export.o to populate the real addresses of the OpenAPI functions (system firmware) into the corresponding stubs (user firmware).

In the build process, system firmware and user firmware are generated.

Stage Developer Dependency package Output
Build system firmware Cat.1 module developer Cat.1 module SDK Cat.1 module system firmware and OpenCPU SDK
Build user firmware Application developer OpenCPU SDK User firmware