Skip to content

[REQ] Generation of plain, dependency-free C code for microcontrollers #2718

Open
@MelanieT

Description

@MelanieT

I'm using the openapi-generator extensively, but have so far been held back by the inability to generate dependency-free C-code that an be loaded onto an ESP-32 or similar, large microcontroller. Every server generator pulls in so many dependencies that the microcontroller's memory would filled up by the dependencies' code alone, if it were even possible to compile these dependencies for the target CPU at all. In order to open up the IoT to openapi, a simple C server stub would be a good solution.

It would, to be universal, probably need to work like this:

int default_api_process(const char *method, const char *url, const char *inputBuffer, int inputSize, char *outputBuffer, int *outputSize);

where the return value would be the HTTP status to send, the outputBuffer would be filled with the fully formatted (with all headers) html document, the inputBuffer represents the request body and the URL is the complete URL to process.

That would be useful on ESP8266, ESP-32 and other wifi-enabled IoT CPUs.

Using C++ would be possible as well, however, these small CPUs have no heap and therefore no operator new.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions