Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Dec 16, 2021
2 parents 06ffc8a + e14d4f5 commit f6a07f2
Show file tree
Hide file tree
Showing 129 changed files with 122,392 additions and 536 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
See the CHANGELOG.md
See the [CHANGELOG](CHANGELOG.md)
draft: false
prerelease: false
55 changes: 35 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,29 @@
*.i
*.txt
!docs/*.txt
!CMakeLists.txt
RTE/

# IAR Settings
**/settings/*.crun
**/settings/*.dbgdt
**/settings/*.cspy
**/settings/*.cspy.*
**/settings/*.xcl
**/settings/*.dni
**/settings/*.wsdt
**/settings/*.wspos

# IAR Debug Exe
**/Exe/*.sim

# IAR Debug Obj
**/Obj/*.pbd
**/Obj/*.pbd.*
**/Obj/*.pbi
**/Obj/*.pbi.*
*debug

# IAR Settings
**/settings/*.crun
**/settings/*.dbgdt
**/settings/*.cspy
**/settings/*.cspy.*
**/settings/*.xcl
**/settings/*.dni
**/settings/*.wsdt
**/settings/*.wspos

# IAR Debug Exe
**/Exe/*.sim

# IAR Debug Obj
**/Obj/*.pbd
**/Obj/*.pbd.*
**/Obj/*.pbi
**/Obj/*.pbi.*

*.TMP
/docs_src/x_Doxyfile.doxy
Expand All @@ -69,13 +72,15 @@ RTE/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
[Dd]ebug*/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
_build/
build/

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand Down Expand Up @@ -274,7 +279,7 @@ ClientBin/
*.publishsettings
orleans.codegen.cs

# Including strong name files can present a security risk
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk

Expand Down Expand Up @@ -370,7 +375,7 @@ __pycache__/
# OpenCover UI analysis results
OpenCover/

# Azure Stream Analytics local run output
# Azure Stream Analytics local run output
ASALocalRun/

# MSBuild Binary and Structured Log
Expand All @@ -383,3 +388,13 @@ log_file.txt
project.ioc
mx.scratch
*.tilen majerle


# Altium
Project outputs*
History/
*.SchDocPreview
*.$$$Preview

# VSCode projects
project_vscode_compiled.exe
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "third_party/embedded-libs"]
path = third_party/embedded-libs
url = https://github.com/MaJerle/embedded-libs
24 changes: 24 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": 4,
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}\\dev\\VisualStudio\\",
"${workspaceFolder}\\lwmem\\src\\include\\"
],
"defines": [
"WIN32",
"_DEBUG",
"UNICODE",
"_UNICODE",
"LWMEM_DEV"
],
"compilerPath": "c:\\msys64\\mingw64\\bin\\gcc.exe",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "windows-gcc-x86",
"configurationProvider": "ms-vscode.cmake-tools"
}
]
}
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}\\build\\LwLibPROJECT.exe",
"miDebuggerPath": "c:\\msys64\\mingw64\\bin\\gdb.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"console": "integratedTerminal"
}
]
}
54 changes: 54 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"version": "2.0.0",

/* For this builds, you need
*
* - Ninja build system
* - MSYS2 compiler with ninja support
* - C/C++ extension for VSCode
* - CMake-Tools extension for VSCode
*/
"tasks": [
{
"type": "cppbuild",
"label": "Build project",
"command": "cmake",
"args": ["--build", "\"build\""],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "Re-build project",
"command": "cmake",
"args": ["--build", "\"build\"", "--clean-first", "-v"],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": ["$gcc"],
},
{
"type": "shell",
"label": "Clean project",
"command": "cmake",
"args": ["--build", "\"build\"", "--target", "clean"],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"type": "shell",
"label": "Run application",
"command": "${workspaceFolder}\\build\\LwLibPROJECT.exe",
"args": [],
"problemMatcher": [],
},
]
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Develop

## v1.6.0

- Add option to define regions with array only, setting length to `0` by default
- Update documentation for functions

## v1.5.3

- Update CMSIS OS driver to support FreeRTOS aware kernel
Expand Down
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.0.0)
project(LwLibPROJECT VERSION 0.1.0)

include(CTest)
enable_testing()

add_executable(${PROJECT_NAME}
lwmem/src/lwmem/lwmem.c
lwmem/src/system/lwmem_sys_win32.c
tests/lwmem_test.c
dev/VisualStudio/main.c
)

target_include_directories(${PROJECT_NAME} PRIVATE
dev/VisualStudio
lwmem/src/include
)

target_compile_definitions(${PROJECT_NAME} PRIVATE
WIN32
_DEBUG
CONSOLE
LWMEM_DEV
)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
2 changes: 1 addition & 1 deletion dev/VisualStudio/lwmem_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <tilen@majerle.eu>
* Version: v1.5.3
* Version: v1.6.0
*/
#ifndef LWMEM_HDR_OPTS_H
#define LWMEM_HDR_OPTS_H
Expand Down
3 changes: 2 additions & 1 deletion docs/examples_src/example_minimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ lwmem_region_t regions[] = {
{ (void *)0x10000000, 0x00001000 },
{ (void *)0xA0000000, 0x00008000 },
{ (void *)0xC0000000, 0x00008000 },
{ NULL, 0}
};

/* Later in the initialization process */
/* Assign regions for manager */
lwmem_assignmem(regions, sizeof(regions) / sizeof(regions[0]));
lwmem_assignmem(regions, 0);

/* Usage in program... */

Expand Down
10 changes: 8 additions & 2 deletions docs/examples_src/example_regions_definitions.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "lwmem/lwmem.h"

/* Set to 1 to describe regions only with array */
#define DESCRIBE_REGIONS_WITH_ARRAY_ONLY 1

/*
* \brief Define regions for memory manager
*/
Expand All @@ -9,10 +12,13 @@ lwmem_region_t regions[] = {
{ (void *)0x10000000, 0x00001000 },
{ (void *)0xA0000000, 0x00008000 },
{ (void *)0xC0000000, 0x00008000 },
#if DESCRIBE_REGIONS_WITH_ARRAY_ONLY
{ NULL, 0},
#endif
};

/* Later in the initialization process */
/* Assign regions for manager */
lwmem_assignmem(regions, sizeof(regions) / sizeof(regions[0]));
lwmem_assignmem(regions, DESCRIBE_REGIONS_WITH_ARRAY_ONLY ? 0 : (sizeof(regions) / sizeof(regions[0])));
/* or */
lwmem_assignmem_ex(NULL, regions, sizeof(regions) / sizeof(regions[0]));
lwmem_assignmem_ex(NULL, regions, DESCRIBE_REGIONS_WITH_ARRAY_ONLY ? 0 : (sizeof(regions) / sizeof(regions[0])));
5 changes: 5 additions & 0 deletions docs/user-manual/how-it-works.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ First step is to define custom regions and assign them to memory manager.
.. note::
Order of regions must be lower address first. Regions must not overlap with their sizes.

.. tip::
Regions could be defined with array descriptor only, where last entry must be set to `NULL` address and `0` size.
This is useful for dynamic length definition with single descriptor file/address.
It allows application to define regions by setting linker scripts when compiling the code.

When calling :c:macro:`lwmem_assignmem`, manager prepares memory blocks and assigns default values.

.. figure:: ../static/images/structure_default.svg
Expand Down
4 changes: 2 additions & 2 deletions docs/user-manual/instances.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LwMEM architecture allows multiple instances, to completely isolate memory manag
This may allow separation of memory management at hardware level with different security feature.

By default, LwMEM has single instance created at library level, called *default instance*.
Default instance does need any special attention as it is embedded at library core,
Default instance does not need any special attention as it is embedded at library core,
instead application has to assign memory regions for the instance.

Every instance has:
Expand Down Expand Up @@ -54,4 +54,4 @@ These allow application to specify for which LwMEM instance specific operation i


.. toctree::
:maxdepth: 2
:maxdepth: 2
Loading

0 comments on commit f6a07f2

Please sign in to comment.