Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed May 4, 2021
2 parents a9ec774 + 0156b6c commit 65f4100
Show file tree
Hide file tree
Showing 24 changed files with 83 additions and 37 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
See the CHANGELOG.md
draft: false
prerelease: false
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Develop

## v1.5.2

- Fix missing region parameter in some allocation or reallocation cases

## v1.5.1

- Fix memory cleanup macro setup
Expand Down
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 <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef LWMEM_HDR_OPTS_H
#define LWMEM_HDR_OPTS_H
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
'includehidden': True,
'titles_only': False
}
html_logo = 'static/images/logo_tm.png'
html_logo = 'static/images/logo.svg'
github_url = 'https://github.com/MaJerle/lwmem'
html_baseurl = 'https://docs.majerle.eu/projects/lwmem/'

Expand Down
2 changes: 0 additions & 2 deletions docs/examples/examples.csv

This file was deleted.

43 changes: 30 additions & 13 deletions docs/get-started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@
Getting started
===============

Getting started may be the most challenging part of every new library.
This guide is describing how to start with the library quickly and effectively

.. _download_library:

Download library
^^^^^^^^^^^^^^^^

Library is primarly hosted on `Github <https://github.com/MaJerle/lwmem>`_.

* Download latest release from `releases area <https://github.com/MaJerle/lwmem/releases>`_ on Github
* Clone `develop` branch for latest development
You can get it with:

* Downloading latest release from `releases area <https://github.com/MaJerle/lwmem/releases>`_ on Github
* Cloning ``master`` branch for latest stable version
* Cloning ``develop`` branch for latest development

Download from releases
**********************
Expand All @@ -24,7 +30,9 @@ Clone from Github
First-time clone
""""""""""""""""

* Download and install ``git`` if not already
This is used when you do not have yet local copy on your machine.

* Make sure ``git`` is installed.
* Open console and navigate to path in the system to clone repository to. Use command ``cd your_path``
* Clone repository with one of available ``3`` options

Expand All @@ -38,7 +46,8 @@ Update cloned to latest version
"""""""""""""""""""""""""""""""

* Open console and navigate to path in the system where your resources repository is. Use command ``cd your_path``
* Run ``git pull origin master --recurse-submodules`` command to pull latest changes and to fetch latest changes from submodules
* Run ``git pull origin master --recurse-submodules`` command to pull latest changes and to fetch latest changes from submodules on ``master`` branch
* Run ``git pull origin develop --recurse-submodules`` command to pull latest changes and to fetch latest changes from submodules on ``develop`` branch
* Run ``git submodule foreach git pull origin master`` to update & merge all submodules

.. note::
Expand All @@ -49,36 +58,44 @@ Add library to project
^^^^^^^^^^^^^^^^^^^^^^

At this point it is assumed that you have successfully download library, either cloned it or from releases page.
Next step is to add the library to the project, by means of source files to compiler inputs and header files in search path

* Copy ``lwmem`` folder to your project
* Add ``lwmem/src/include`` folder to `include path` of your toolchain
* Add source files from ``lwmem/src/`` folder to toolchain build
* Copy ``lwmem`` folder to your project, it contains library files
* Add ``lwmem/src/include`` folder to `include path` of your toolchain. This is where `C/C++` compiler can find the files during compilation process. Usually using ``-I`` flag
* Add source files from ``lwmem/src/`` folder to toolchain build. These files are built by `C/C++` compiler
* Copy ``lwmem/src/include/lwmem/lwmem_opts_template.h`` to project folder and rename it to ``lwmem_opts.h``
* Build the project

Configuration file
^^^^^^^^^^^^^^^^^^

Configuration file is used to overwrite default settings defined for the essential use case.
Library comes with template config file, which can be modified according to needs.
This file shall be named ``lwmem_opts.h`` and its default template looks like the one below.
and it should be copied (or simply renamed in-place) and named ``lwmem_opts.h``

.. note::
Default configuration template file location: ``lwmem/src/include/lwmem/lwmem_opts_template.h``.
File must be renamed to ``lwmem_opts.h`` first and then copied to the project directory (or simply renamed in-place) where compiler
File must be renamed to ``lwmem_opts.h`` first and then copied to the project directory where compiler
include paths have access to it by using ``#include "lwmem_opts.h"``.

.. tip::
Check :ref:`api_lwmem_opt` section for possible configuration settings
List of configuration options are available in the :ref:`api_lwmem_opt` section.
If any option is about to be modified, it should be done in configuration file

.. literalinclude:: ../../lwmem/src/include/lwmem/lwmem_opts_template.h
:language: c
:linenos:
:caption: Template options file
:caption: Template configuration file

.. note::
If you prefer to avoid using configuration file, application must define
a global symbol ``LWMEM_IGNORE_USER_OPTS``, visible across entire application.
This can be achieved with ``-D`` compiler option.

Minimal example code
^^^^^^^^^^^^^^^^^^^^

Run below example to test and verify library
To verify proper library setup, minimal example has been prepared.
Run it in your main application file to verify its proper execution

.. literalinclude:: ../examples_src/example_minimal.c
:language: c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef LWMEM_HDR_OPTS_H
#define LWMEM_HDR_OPTS_H
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32/lwmem_rtos_stm32l496_discovery/inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef __MAIN_H
#define __MAIN_H
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32/lwmem_rtos_stm32l496_discovery/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#include "main.h"
#include "cmsis_os.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32/lwmem_stm32l496_discovery/inc/lwmem_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef LWMEM_HDR_OPTS_H
#define LWMEM_HDR_OPTS_H
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32/lwmem_stm32l496_discovery/inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef __MAIN_H
#define __MAIN_H
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32/lwmem_stm32l496_discovery/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#include "main.h"
#include "lwmem/lwmem.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/win32/lwmem/lwmem_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef LWMEM_HDR_OPTS_H
#define LWMEM_HDR_OPTS_H
Expand Down
2 changes: 1 addition & 1 deletion examples/win32/lwmem_multi_ins_multi_region/lwmem_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef LWMEM_HDR_OPTS_H
#define LWMEM_HDR_OPTS_H
Expand Down
2 changes: 1 addition & 1 deletion examples/win32/lwmem_multi_region/lwmem_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef LWMEM_HDR_OPTS_H
#define LWMEM_HDR_OPTS_H
Expand Down
2 changes: 1 addition & 1 deletion examples/win32/lwmem_os/lwmem_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef LWMEM_HDR_OPTS_H
#define LWMEM_HDR_OPTS_H
Expand Down
2 changes: 1 addition & 1 deletion lwmem/src/include/lwmem/lwmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef LWMEM_HDR_H
#define LWMEM_HDR_H
Expand Down
2 changes: 1 addition & 1 deletion lwmem/src/include/lwmem/lwmem_opt.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef LWMEM_HDR_OPT_H
#define LWMEM_HDR_OPT_H
Expand Down
2 changes: 1 addition & 1 deletion lwmem/src/include/lwmem/lwmem_opts_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef LWMEM_HDR_OPTS_H
#define LWMEM_HDR_OPTS_H
Expand Down
2 changes: 1 addition & 1 deletion lwmem/src/include/system/lwmem_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#ifndef LWMEM_HDR_SYS_H
#define LWMEM_HDR_SYS_H
Expand Down
6 changes: 3 additions & 3 deletions lwmem/src/lwmem/lwmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#include <limits.h>
#include <string.h>
Expand Down Expand Up @@ -467,7 +467,7 @@ prv_realloc(lwmem_t* const lw, const lwmem_region_t* region, void* const ptr, co
return NULL;
}
if (ptr == NULL) {
return prv_alloc(lw, NULL, size);
return prv_alloc(lw, region, size);
}

/* Try to reallocate existing pointer */
Expand Down Expand Up @@ -648,7 +648,7 @@ prv_realloc(lwmem_t* const lw, const lwmem_region_t* region, void* const ptr, co
*
* Final solution is to find completely new empty block of sufficient size and copy content from old one to new one
*/
retval = prv_alloc(lw, NULL, size); /* Try to allocate new block */
retval = prv_alloc(lw, region, size); /* Try to allocate new block */
if (retval != NULL) {
block_size = (block->size & ~LWMEM_ALLOC_BIT) - LWMEM_BLOCK_META_SIZE; /* Get application size from input pointer */
LWMEM_MEMCPY(retval, ptr, size > block_size ? block_size : size); /* Copy content to new allocated block */
Expand Down
2 changes: 1 addition & 1 deletion lwmem/src/system/lwmem_sys_cmsis_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#include "system/lwmem_sys.h"

Expand Down
2 changes: 1 addition & 1 deletion lwmem/src/system/lwmem_sys_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#include "system/lwmem_sys.h"

Expand Down
2 changes: 1 addition & 1 deletion lwmem/src/system/lwmem_sys_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <[email protected]>
* Version: v1.5.1
* Version: v1.5.2
*/
#include "system/lwmem_sys.h"

Expand Down

0 comments on commit 65f4100

Please sign in to comment.