8.1. PikaScript configuration manual
You can consider configuring PikaScript when you have the following requirements:
faster speed
Smaller memory footprint
Replace dependencies (libc, pinrtf, etc.)
Replace memory management algorithm ( malloc )
Safer interruption protection
[Note]: For optimized configuration, the kernel version needs to be at least
Similar to GCC, PikaScript also provides different optimization modes. The currently available optimization modes are:
PIKA_OPTIMIZE_SPEED
performance mode maximizes running speed
User configuration is not enabled by default. The way to enable user configuration is to add compile-time macro definition PIKA_CONFIG_ENABLE
. Then create the pika_config.h
header file.
It should be noted that the PIKA_CONFIG_ENABLE
macro should be added to the compile options, such as keil:
Available configuration items and default configuration are in the header file.
https://github.com/pikastech/pikascript/blob/master/src/pika_config_valid.h
Intercept the important part for explanation:
default configuration
is the default value of the configuration item. When the PIKA_CONFIG_ENABLE
macro is defined, pika_config_valid.h
will import pika_config.h
, so User can override the above default configuration in pika_config.h
.
As can be seen from pika_config_valid.h
, the default optimization option of PikaScript PIKA_OPTIMIZE
is PIKA_OPTIMIZE_SIZE
, if you need to switch to speed optimization, you can write in pika_config.h
https://github.com/pikastech/pikascript/blob/master/bsp/stm32g070cb/Booter/pika_config.h
PikaScript can be configured by creating pika_config.c
, rewriting the weak functions in PikaPlagform.h ‘s dependencies.
Interrupt Protection - Provides an interrupt master switch to protect PikaScript memory safety
libC - select the implementation of libC
Memory management - replace malloc free memory management algorithm