Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Nov 15, 2020
2 parents 00dbdf7 + fa54b7c commit 5736774
Show file tree
Hide file tree
Showing 37 changed files with 429 additions and 313 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Lightweight dynamic memory manager

<h3><a href="http://docs.majerle.eu/projects/lwmem/">Documentation</a></h3>
<h3>Read first: <a href="http://docs.majerle.eu/projects/lwmem/">Documentation</a></h3>

## Features

Expand Down
19 changes: 8 additions & 11 deletions dev/VisualStudio/lwmem_config.h → dev/VisualStudio/lwmem_opts.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* \file lwmem_config_template.h
* \brief LwMEM configuration file
* \file lwmem_opts.h
* \brief LwMEM application options
*/

/*
Expand Down Expand Up @@ -29,23 +29,20 @@
* This file is part of Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <tilen@majerle.eu>
* Version: v1.3.0
* Version: v1.4.0
*/
#ifndef LWMEM_HDR_CONFIG_H
#define LWMEM_HDR_CONFIG_H
#ifndef LWMEM_HDR_OPTS_H
#define LWMEM_HDR_OPTS_H

/* Rename this file to "lwmem_config.h" for your application */
/* Rename this file to "lwmem_opts.h" for your application */

#include "windows.h"

/*
* Open "include/lwmem/lwmem_config_default.h" and
* Open "include/lwmem/lwmem_opt.h" and
* copy & replace here settings you want to change values
*/
#define LWMEM_CFG_OS 1
#define LWMEM_CFG_OS_MUTEX_HANDLE HANDLE

/* After user configuration, call default config to merge config together */
#include "lwmem/lwmem_config_default.h"

#endif /* OW_HDR_CONFIG_H */
#endif /* OW_HDR_OPTS_H */
4 changes: 2 additions & 2 deletions dev/VisualStudio/main.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <stdio.h>
#include "lwmem/lwmem.h"
#include "string.h"
#include "stdint.h"
#include <string.h>
#include <stdint.h>

extern void lwmem_test_run(void);
extern void lwmem_test_memory_structure(void);
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ List of all the modules:
:maxdepth: 2

lwmem
lwmem_config
lwmem_opt
lwmem_sys
12 changes: 0 additions & 12 deletions docs/api-reference/lwmem_config.rst

This file was deleted.

12 changes: 12 additions & 0 deletions docs/api-reference/lwmem_opt.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _api_lwmem_opt:

Configuration
=============

This is the default configuration of the middleware.
When any of the settings shall be modified, it shall be done in dedicated application config ``lwmem_opts.h`` file.

.. note::
Check :ref:`getting_started` for guidelines on how to create and use configuration file.

.. doxygengroup:: LWMEM_OPT
25 changes: 22 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,26 @@
author = 'Tilen MAJERLE'

# The full version, including alpha/beta/rc tags
release = '1.3.0'
version = '1.4.0'

# Try to get branch at which this is running
# and try to determine which version to display in sphinx
git_branch = ''
res = os.popen('git branch').read().strip()
for line in res.split("\n"):
if line[0] == '*':
git_branch = line[1:].strip()

# Decision for display version
try:
if git_branch.index('develop') >= 0:
version = "latest-develop"
except Exception:
print("Exception for index check")

# For debugging purpose
print("GIT BRANCH: " + git_branch)
print("VERSION: " + version)

# -- General configuration ---------------------------------------------------

Expand All @@ -45,7 +64,7 @@
'sphinx.ext.viewcode',
'sphinx_sitemap',

'breathe',
'breathe',
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -70,7 +89,7 @@
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,

'logo_only': False,

# Toc options
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Examples and demos
==================

Various examples are provided for fast library evaluation on embedded systems. These are optimized prepared and maintained for ``2`` platforms, but could be easily extended to more platforms:
Various examples are provided for fast library evaluation on embedded systems. These are prepared and maintained for ``2`` platforms, but could be easily extended to more platforms:

* WIN32 examples, prepared as `Visual Studio Community <https://visualstudio.microsoft.com/vs/community/>`_ projects
* ARM Cortex-M examples for STM32, prepared as `STM32CubeIDE <https://www.st.com/en/development-tools/stm32cubeide.html>`_ GCC projects
Expand Down
15 changes: 10 additions & 5 deletions docs/get-started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,27 @@ At this point it is assumed that you have successfully download library, either
* 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/src/include/lwmem/lwmem_config_template.h`` to project folder and rename it to ``lwmem_config.h``
* Copy ``lwmem/src/include/lwmem/lwmem_opts_template.h`` to project folder and rename it to ``lwmem_opts.h``
* Build the project

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

Library comes with template config file, which can be modified according to needs.
This file shall be named ``lwmem_config.h`` and its default template looks like the one below:
This file shall be named ``lwmem_opts.h`` and its default template looks like the one below.

.. 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
include paths have access to it by using ``#include "lwmem_opts.h"``.

.. tip::
Check :ref:`api_lwmem_config` section for possible configuration settings
Check :ref:`api_lwmem_opt` section for possible configuration settings

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

Minimal example code
^^^^^^^^^^^^^^^^^^^^
Expand Down
8 changes: 5 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
LwMEM documentation!
====================
LwMEM |version| documentation
=============================

Welcome to the documentation for version |version|.

LwMEM is lightweight dynamic memory manager optimized for embedded systems.

.. rst-class:: center
.. rst-class:: index_links

:ref:`download_library` · :ref:`getting_started` · `Open Github <https://github.com/MaJerle/lwmem>`_
:ref:`download_library` :ref:`getting_started` `Open Github <https://github.com/MaJerle/lwmem>`_

Features
^^^^^^^^
Expand Down
6 changes: 6 additions & 0 deletions docs/static/css/common.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/user-manual/thread-safety.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Thread safety
With default configuration, LwMEM library is *not* thread safe.
This means whenever it is used with operating system, user must resolve it with care.

Library has locking mechanism support for thread safety, which needs to be enabled.
Library has locking mechanism support for thread safety, which needs to be enabled manually.

.. tip::
To enable thread-safety support, parameter ``LWMEM_CFG_OS`` must be set to ``1``.
Please check :ref:`api_lwmem_config` for more information about other options.
Please check :ref:`api_lwmem_opt` for more information about other options.

After thread-safety features has been enabled, it is necessary to implement
``4`` low-level system functions.
Expand All @@ -20,7 +20,7 @@ After thread-safety features has been enabled, it is necessary to implement

Example code for ``CMSIS-OS V2``

.. note::
.. note::
Check :ref:`api_lwmem_sys` section for function description

.. literalinclude:: ../../lwmem/src/system/lwmem_sys_cmsis_os.c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>LwMEM_STM32L496G_Discovery_RTOS</name>
<name>lwmem_stm32l496g_discovery_rtos</name>
<comment></comment>
<projects>
</projects>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* \file lwmem_config_template.h
* \brief LwMEM configuration file
* \file lwmem_opts.h
* \brief LwMEM application options
*/

/*
Expand Down Expand Up @@ -29,23 +29,20 @@
* This file is part of LwMEM - Lightweight dynamic memory manager library.
*
* Author: Tilen MAJERLE <tilen@majerle.eu>
* Version: v1.3.0
* Version: v1.4.0
*/
#ifndef LWMEM_HDR_CONFIG_H
#define LWMEM_HDR_CONFIG_H
#ifndef LWMEM_HDR_OPTS_H
#define LWMEM_HDR_OPTS_H

/* Rename this file to "lwmem_config.h" for your application */
/* Rename this file to "lwmem_opts.h" for your application */

#include "cmsis_os.h"

/*
* Open "include/lwmem/lwmem_config_default.h" and
* Open "include/lwmem/lwmem_opt.h" and
* copy & replace here settings you want to change values
*/
#define LWMEM_CFG_OS 1
#define LWMEM_CFG_OS_MUTEX_HANDLE osMutexId

/* After user configuration, call default config to merge config together */
#include "lwmem/lwmem_config_default.h"

#endif /* LWMEM_HDR_CONFIG_H */
#endif /* LWMEM_HDR_OPTS_H */
16 changes: 8 additions & 8 deletions examples/stm32/lwmem_rtos_stm32l496_discovery/inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@

/*
* Copyright (c) 2020 Tilen MAJERLE
*
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Author: Tilen MAJERLE <tilen@majerle.eu>
* Version: v1.3.0
* Version: v1.4.0
*/
#ifndef __MAIN_H
#define __MAIN_H
Expand Down Expand Up @@ -60,7 +60,7 @@

/* ########################## Assert Selection ############################## */
/**
* @brief Uncomment the line below to expanse the "assert_param" macro in the
* @brief Uncomment the line below to expanse the "assert_param" macro in the
* HAL drivers code
*/
/* #define USE_FULL_ASSERT 1U */
Expand Down
Loading

0 comments on commit 5736774

Please sign in to comment.