Skip to content
aztechskPublic

About

The sys-tools library provides various components for the AZTech framework.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sys-tools

The sys-tools C library provides terminal I/O, system diagnostics, CRC-16 calculations, and utility functions for the AZTech embedded framework. Terminal and diagnostic components integrate with FreeRTOS; CRC and Tools do not require its task services.

Library Modules

TIN - Terminal Input (tin.c, tin.h)

Runs a FreeRTOS task that reads bytes from an application-provided input callback. Handles CR-terminated lines, basic editing, and optional echo, then dispatches complete non-empty lines to an application callback. Optional sleep-aware mode.

Main API: init_tin().

TOUT - Terminal Output (tout.c, tout.h)

Provides asynchronous printf-style output using a circular buffer and an output task. A user-supplied callback handles the physical transmission. Messages can be dropped if the queue or buffer is full; counters track failures.

Main API: init_tout(), add_msg_tout(), v_add_msg_tout(), tout_stats().

TSKNFO - Task Diagnostics (tsknfo.c, tsknfo.h)

Reports a FreeRTOS task snapshot with states, priorities, task numbers, and stack high-water marks. Task listing requires the FreeRTOS trace facility. An optional stack-overflow hook reports detected task stack overflows.

Main API: print_task_info().

RAMNFO - Memory Diagnostics (ramnfo.c, ramnfo.h)

Reports linker-defined stack usage, heap statistics, and the physical layout of used and free heap blocks. Includes allocation alignment checks and an optional allocator self-test. Heap information comes from the project's allocator API.

Main API: print_stack_usage(), print_heap_usage(), list_heap(), test_heap_align(), and optionally test_heap().

CRC (crc.c, crc.h)

Table-based CRC-16 calculations with caller-supplied initial values: reflected CRC-16/ARC and MODBUS, plus non-reflected CCITT (IBM-3740 and XMODEM variants). Both functions support incremental processing of data buffers.

Main API: crc_16(), crc_ccit().

Tools (tools.c, tools.h)

Utility functions for text-table lookup, bit-value formatting and parsing, and integer operations. Optional bit-field extractors support typed arrays of 8-, 16-, 32-, or 64-bit elements and byte-oriented little-endian input.

Selected API: find_txt_item(), conv_bv_sz(), bit_pos(), long_division(), extract_bits(), extract_bits_le().

Heap Diagnostics Interface (malloc_diag.h)

Declares malloc_heap_get_stats() and malloc_heap_get_blocks() for heap statistics and physical block iteration. They are implemented by the project's allocator, not by the sys static library.

Configuration and Integration

Feature selection uses the application's sysconf.h and FreeRTOS configuration. Relevant options include TERMIN, TERMOUT, HEAP_TEST, CRC_16_FUNC, CRC_CCIT_FUNC, TOOLS_EXTRACT_BITS, TOOLS_EXTRACT_BITS_LE, and optional terminal sleep modes. Headers using these settings expect sysconf.h first.

TIN and TOUT need application-provided I/O callbacks. The terminal and runtime diagnostic APIs are intended for task context, not ISRs. The library also uses framework headers such as gentyp.h and criterr.h. See the Doxygen comments in src/*.h for the full API contracts and configuration requirements.

Build

The included Makefile builds sys.a using the parent project's mk/common.mk. The module also includes a CrossWorks project (sys.hzp). Both build paths expect the surrounding AZTech firmware project.

Library Features

  • Callback-based terminal input and asynchronous buffered output.
  • Compile-time selection of optional features and CRC/utility algorithms.
  • Diagnostics for FreeRTOS tasks, stacks, and heap memory.
  • Reusable CRC and bit/integer utility functions.

License

ISC license; see LICENSE.

About

The sys-tools library provides various components for the AZTech framework.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages