Skip to content

CM3DS Maintenance Pull Request: Memory changes (2/4) #6168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2018

Conversation

hug-dev
Copy link
Contributor

@hug-dev hug-dev commented Feb 22, 2018

This pull request contains memory changes for the CM3DS target.
It is the pull request 2 among the 4 concerning CM3DS Maintenance. Please check #6119 for the full scope.

Other pull requests regarding this target:

* You can now run the tests :+1: :
```bash
mbed test --run -m ARM_CM3DS_MPS2 -t COMPILER
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theotherjimmy I think that's a bit dodgy. Is this use (bin->elf) case already supported by our tools?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@hug-dev From reading teh script, you just rename it. it's not real elf file is it? (I looked at function bin_to_elf).

+Because of the new memory configuration introduced in commit CM3DS: switch to +larger memories for code and data it
+has become more easy (and portable amoung all compilers) to use .elf files
+instead of .bin.

What portability issues are you having here? Can you elaborate?

I would expect a target to support bin/hex files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xc0170
It is real ELF files, the script changes the paths to use them instead on .bin files.
More details are written in the commit message of the commit in that PR.

The problem comes from that we are now loading at two different zones:

  • the vector table at 0x0, to allow the device to boot (boot address can not be changed)
  • the rest of the code + data at address 0x00400000

The ELF file produced contains the two load regions with the address information to where to load them.
The .bin file, however, is just plain code and data with no information at all which means that the single .bin contains everything with padding in between the end of the first load region and the beginnning of the second one. Consequence is that this .bin file will be huge, at least 4 MiB and hence the flash operation will take a much longer time than with ELF files.

@bulislaw
I made sure that using ELF files were working with the testing tools, issuing the necessary pull requests or firmware changes of our target. The pull request ARMmbed/htrun#181, now merged works with the bin_to_elf script to use ELF files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The target does not support hex ? that would work out of the box.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, only .bin and .elf files are supported currently by the MPS2+ board firmware.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bulislaw No .bin to .elf is not a transformation we support. You could force the build system to produce an .elf file by setting target.OUTPUT_EXT to "elf" to skip the .elf -> .bin step, and therefore eliminate the .bin -> .elf step.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, these patches do not add any transformation from .bin to .elf, they just make the test tools point to the .elf files (already produced with the compilation) instead of the .bin files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I just read the code. You're renaming.

* Because greentea works with `.bin` files, you will have to first compile the
tests:
```bash
mbed test --compile -m ARM_CM3DS_MPS2 -t COMPILER
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide an application configuration that overrides the config Variable target.OUTPUT_EXT to "elf". Then pass --app-config with the path to you're application configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know that this variable existed! Thanks for the tip, it indeed makes the script useless and I will delete it.

I have tried it locally, to compile the tests with that variable overridden and it successfully uses the .elf files in test_spec.json and the .bin are not generated.

I had however to make the following changes in the mbed OS compilation system as it seems to contain a bug when the OUTPUT_EXT variable is used with elf extension.

diff --git a/tools/toolchains/__init__.py b/tools/toolchains/__init__.py
index c73ca54..ae3968b 100644
--- a/tools/toolchains/__init__.py
+++ b/tools/toolchains/__init__.py
@@ -1130,7 +1130,7 @@ class mbedToolchain:
 
         filename = name+'.'+ext
         elf = join(tmp_path, name + '.elf')
-        bin = None if ext is 'elf' else join(tmp_path, filename)
+        bin = None if ext == 'elf' else join(tmp_path, filename)
         map = join(tmp_path, name + '.map')
 
         r.objects = sorted(set(r.objects))
@@ -1154,6 +1154,9 @@ class mbedToolchain:
         self.var("compile_succeded", True)
         self.var("binary", filename)
 
+        if not bin:
+            bin = elf
+
         return bin, needed_update
 
     # THIS METHOD IS BEING OVERRIDDEN BY THE MBED ONLINE BUILD SYSTEM

bin variable was None, the function returns it and we then lose the path of the .elf file. This is a dirty hacky version just to make it work but I am happy to make changes in that pull request as well and take your advices on how I should do it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Did you need to do the first part of that change? or do you prefer == over is?


This is a dirty hacky version just to make it work

It's a bug fix version. Please submit that change as another PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Did you need to do the first part of that change? or do you prefer == over is?

Thanks. Yes, it is needed. It was the original bug, it seems that in Python is compares the address of the objects while == compares their content. With is, the bin variable was not None which triggered the elf2bin conversion and leading to another issue further in the code.

It's a bug fix version. Please submit that change as another PR.

Allright! I will submit another PR.

Can I also suggest to add "OUTPUT_EXT": "elf" in the targets/target.json file part for CM3DS instead of giving an application configuration? After this change, elf files should become the "normal" binary type for CM3DS anyway. What do you think?

Copy link
Contributor

@theotherjimmy theotherjimmy Feb 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explination! I was incorrectly under the impression that python interned small strings.


Yes, lets' have it in targets/targets.json. That'll be easiest for everyone. Bonus: You no longer need two commands for test! you should be able to mbed test -m ... -t ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I will change that in the new patch.

* Then use the script to change from `.bin` files to `.elf` in the test
specification file:
```bash
./targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/scripts/bin_to_elf.py BUILD/tests/ARM_CM3DS_MPS2/COMPILER/test_spec.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After doing the above step, remove this step, and the bin_to_elf.py script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, after the above step the compilation will only be one line now.

@@ -0,0 +1,84 @@
#!/usr/bin/env python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script is completely unnecessary. Please remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely. Will remove it.

@hug-dev
Copy link
Contributor Author

hug-dev commented Feb 27, 2018

A pull request has been created to address the bug found in the discussion with @theotherjimmy #6229
I am going to push the other review changes now.

@hug-dev
Copy link
Contributor Author

hug-dev commented Feb 27, 2018

New changes in 🔨 !

@cmonr
Copy link
Contributor

cmonr commented Feb 27, 2018

#6229 has been merged!

theotherjimmy
theotherjimmy previously approved these changes Feb 28, 2018
Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@theotherjimmy
Copy link
Contributor

@0xc0170 Could you take a look at the C? I was only reviewing tools changes.

Because of the new memory configuration introduced in commit `CM3DS: switch to
larger memories for code and data` it
has become more easy (and portable amoung all compilers) to use `.elf` files
instead of `.bin`. `.elf` files are now the default for CM3DS projects and only them
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"...and only they"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

* The space left is a bit bigger than is necessary based on the number of
* interrupt handlers.
/*
* WARNING: these symbols are the same than the defines in ../memory_zones.h but
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for the warning

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the same than" -> "the same as"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@theotherjimmy
Copy link
Contributor

@AnotherButler A new README is included in this PR. Could you edit it?

* is necessary based on the number of exception handlers.
*/
#include "../memory_zones.h"
#include "../cmsis_nvic.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like all includes in this PR, not using relative paths, #include "memory_zones.h"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add the relative path because during the preprocessing step of the linker script, all folders are not included in the search path as it is done during compilation.

When I use #include "memory_zones.h", the following command generates an error during mbed OS compilation process (compiling a random test as example):

arm-none-eabi-cpp -E -P /fake_path/BUILD/tests/ARM_CM3DS_MPS2/GCC_ARM/targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/device/TOOLCHAIN_GCC_ARM/MPS2.ld -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n -mcpu=cortex-m3 -mthumb -o /fake_path/BUILD/tests/ARM_CM3DS_MPS2/GCC_ARM/./TESTS/mbed_hal/ticker/.link_script.ld

Adding -I /fake_path/BUILD/tests/ARM_CM3DS_MPS2/GCC_ARM/targets/TARGET_ARM_SSG/TARGET_CM3DS_MPS2/device/, which is the folder containing memory_zones.h, at the end of the command resolves the issue. It is the same story for ARM compiler.

Looking at it a bit closer:
For GCC_ARM, the link function in tools/toolchains/gcc.py preprocess the linker script before calling the link command (using preproc_output path). I guess the preprocessing command could be enhanced with the path of every folder?
For ARM compiler, the preprocessor is executed on the linker script thanks to the shebang at the beginning of the file so I could add the include path there. However the correct_scatter_shebang function in tools/toolchains/arm.py will change it if it is not beginning with the correct format. This function could also add the path of every folder in the command.

I am happy to raise an issue about it 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I had to rebase for the code to compile after #6229 was merged.

Copy link
Contributor

@0xc0170 0xc0170 Mar 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info. I was not aware linker does not have the paths. Assuming not often linker needs to include another file.

@theotherjimmy What do you think? If a linker file needs an include, should it work with relative paths?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should never use absolute paths. They are not only not portable, but also not ever portable between users!


@0xc0170 You probably meant something other than absolute paths.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I corrected the last reply from me, relative paths I meant as mentioned earlier above. OK to be in here ?
Thus the issue described #6168 (comment) is not an issue, by design and the only way to get inclusion in linker scripts is used relative paths?

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 7, 2018

@hug-dev just a small change requested, the rest looks good ! We can trigger CI once my latest comment is addressed

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 8, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 8, 2018

Build : SUCCESS

Build number : 1387
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6168/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Mar 8, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 9, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 9, 2018

@hug-dev Can you look at the failures? Some exports fail with that include in the linker script file

Amanda Butler added 2 commits March 12, 2018 16:25
Copy edit for branding, consistent tense and consistent style.
Copy edit for active voice, branding, spelling and other minor grammar fixes.
@hug-dev
Copy link
Contributor Author

hug-dev commented Mar 12, 2018

Hi @0xc0170
I have rebased the three commits pushed on the latest master and tried the blinky example as the export test seems to be doing. I did not have any errors though.
The startup_MPS2.S file is compiled on my computer with the --via option which includes a file that contains the path of the folder containing memory_zones.h, file which was not found in the export test.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 13, 2018

I am able to reproduce the failures. Blinky example, fetched your branch. Did mbed export -m ARM_CM3DS_MPS2 -i uvision . uVision project fails to build with the same errors as reported above.

assembling startup_MPS2.S...
mbed-os\targets\TARGET_ARM_SSG\TARGET_CM3DS_MPS2\device\TOOLCHAIN_ARM_STD\startup_MPS2.S(25): error:  #5: cannot open source input file "memory_zones.h": No such file or directory

Is it because Asm does not define any include paths (there's tab Asm in the project settings, include paths there are empty) ?

Asm control string is

--cpu Cortex-M3 -g --apcs=interwork --cpreproc --cpreproc_opts=-D__ASSERT_MSG,-D__CMSIS_RTOS,-D__MBED_CMSIS_RTOS_CM,-DCMSDK_CM3DS,-D__CORTEX_M3,-DARM_MATH_CM3 
-I .\RTE\_mbed-os-example-blinky 
-I C:\KEIL_V5\ARM\PACK\ARM\CMSIS\5.2.0\Device\ARM\ARMCM3\Include 
-I C:\KEIL_V5\ARM\CMSIS\Include 
-I C:\KEIL_V5\ARM\PACK\ARM\CMSIS\5.2.0 
--pd "__UVISION_VERSION SETA 524" --pd "ARMCM3 SETA 1" --list ".\BUILD\*.lst" --xref -o "*.o" --depend "*.d" 

@hug-dev
Copy link
Contributor Author

hug-dev commented Mar 13, 2018

Yes, that is correct. I did not know about the export command and that it was testing that 😃
I was then able to reproduce the error:

  • for the make_armc5 export, the ASM_FLAGS variable in the Makefile generated was not pointing to the good folder (a ../ was missing because it is executed inside the BUILD folder)
    This change fixed that:
diff --git a/tools/export/makefile/__init__.py b/tools/export/makefile/__init__.py
index 3c0fc2a..10d3475 100644
--- a/tools/export/makefile/__init__.py
+++ b/tools/export/makefile/__init__.py
@@ -121,6 +121,10 @@ class Makefile(Exporter):
                     'to_be_compiled']:
             ctx[key] = sorted(ctx[key])
         ctx.update(self.format_flags())
+        # Add the virtual path the the include option in the ASM flags
+        for index, flag in enumerate(ctx['asm_flags']):
+            if flag.startswith('-I'):
+                ctx['asm_flags'][index] = "-I" + ctx['vpath'][0] + "/" + ctx['asm_flags'][index][2:]
 
         for templatefile in \
             ['makefile/%s_%s.tmpl' % (self.TEMPLATE,
  • for the uvision export, there was no include folders, I have just added the option in the .tmpl file:
diff --git a/tools/export/uvision/uvision.tmpl b/tools/export/uvision/uvision.tmpl
index f49c796..49c708c 100644
--- a/tools/export/uvision/uvision.tmpl
+++ b/tools/export/uvision/uvision.tmpl
@@ -394,7 +394,7 @@
               <MiscControls>{{asm_flags}}</MiscControls>
               <Define></Define>
               <Undefine></Undefine>
-              <IncludePath></IncludePath>
+              <IncludePath>{{include_paths}}</IncludePath>
             </VariousControls>
           </Aads>
           <LDads>

Do you think that it makes sense @0xc0170 ? With that two changes, it seems to work on my side.

@theotherjimmy
Copy link
Contributor

@hug-dev Could you submit those patches as PRs?

hug-dev added a commit to hug-dev/mbed-os that referenced this pull request Mar 14, 2018
When exporting a mbed project to make_armc5, the include options (-I)
of the ASM flags are not pointing to the good folder. It should be
pointing to the root mbed-os folder and not the one in BUILD.
This issue was found in the pull request ARMmbed#6168.

Signed-off-by: Hugues de Valon <[email protected]>
hug-dev added a commit to hug-dev/mbed-os that referenced this pull request Mar 14, 2018
When exporting to a uvision project, the include flags are not put in
the assembly compilation line. When assembling the files containing
includes, the search path will then fail. This patch adds the include
paths to the Assembly sequence, as it is done for compilation.
This issue was found in the pull request ARMmbed#6168.

Signed-off-by: Hugues de Valon <[email protected]>
@hug-dev
Copy link
Contributor Author

hug-dev commented Mar 14, 2018

@theotherjimmy The PR #6356 has been created, with two commits for each one of the patch!

@hug-dev
Copy link
Contributor Author

hug-dev commented Mar 20, 2018

The preceding PR #6356 has been merged, I guess this PR is good to be CI tested again!

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 20, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 20, 2018

Build : SUCCESS

Build number : 1490
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6168/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Mar 20, 2018

@mbed-bot
Copy link

@0xc0170 0xc0170 merged commit 7b325f3 into ARMmbed:master Mar 21, 2018
adbridge pushed a commit that referenced this pull request Mar 26, 2018
When exporting a mbed project to make_armc5, the include options (-I)
of the ASM flags are not pointing to the good folder. It should be
pointing to the root mbed-os folder and not the one in BUILD.
This issue was found in the pull request #6168.

Signed-off-by: Hugues de Valon <[email protected]>
adbridge pushed a commit that referenced this pull request Mar 26, 2018
When exporting to a uvision project, the include flags are not put in
the assembly compilation line. When assembling the files containing
includes, the search path will then fail. This patch adds the include
paths to the Assembly sequence, as it is done for compilation.
This issue was found in the pull request #6168.

Signed-off-by: Hugues de Valon <[email protected]>
omarisai added a commit to omarisai/mbed-os that referenced this pull request Apr 7, 2018
* Copy edit README.md

Copy edit for branding, consistent tense and consistent style.

* Copy edit README.md

Copy edit for active voice, branding, spelling and other minor grammar fixes.

* littlefs: Fixed issue updating dir struct when extended dir chain

Like most of the lfs_dir_t functions, lfs_dir_append is responsible for
updating the lfs_dir_t struct if the underlying directory block is
moved. This property makes handling worn out blocks much easier by
removing the amount of state that needs to be considered during a
directory update.

However, extending the dir chain is a bit of a corner case. It's not
changing the old block, but callers of lfs_dir_append do assume the
"entry" will reside in "dir" after lfs_dir_append completes.

This issue only occurs when creating files, since mkdir does not use
the entry after lfs_dir_append. Unfortunately, the tests against
extending the directory chain were all made using mkdir.

Found by schouleu

* Add lorawan and nvstore examples for testing.

* Corrected lwip adaptation TCP flagging

* Added deprecation notes to old cellular interfaces.

* Moved APN_db.h under new cellular.

* MBED_DEPRECATED_SINCE taken into use

* PR review findings, updated deprecated comments.

* Cellular: Fixed sms unit tests.

* STM32L486: fix two ram region define for GCC ARM

Based on the changes for other targets, these 2 were left.

* WISE_1570: use hex as output

Fixes ARMmbed#6252. Use hex rather than binary - use the hex format validation.

* Fixed correct includes so that compile log is not polluted.

* Cellular: update attach test

* Disabled exporters for lorawan example

* Actually disabled exporters for lorawan example

* STM32 RTC init

When LSE is configured for RTC, LSI is not affected

* Enable iar export option for MTB_ADV_WISE_1510

* Add ASM flags virtual path for make export

When exporting a mbed project to make_armc5, the include options (-I)
of the ASM flags are not pointing to the good folder. It should be
pointing to the root mbed-os folder and not the one in BUILD.
This issue was found in the pull request ARMmbed#6168.

Signed-off-by: Hugues de Valon <[email protected]>

* Add ASM include flags in uvision export

When exporting to a uvision project, the include flags are not put in
the assembly compilation line. When assembling the files containing
includes, the search path will then fail. This patch adds the include
paths to the Assembly sequence, as it is done for compilation.
This issue was found in the pull request ARMmbed#6168.

Signed-off-by: Hugues de Valon <[email protected]>

* Update mbed-coap to version 4.4.0

Make sn_coap_protocol_send_rst as public needed for CoAP ping sending
Allow disabling resendings by defining SN_COAP_DISABLE_RESENDINGS

* Convert option list to unicode

* NVStore: add comments in header file for Doxygen formatting sake.

* Removed mbed 2 builds from Travis

* dir seek fixed - dptr was not updated before checking

* fix mbed-ci build  error L6216E

fix mbed-ci build  error L6216E
* (.ARM.exidx) and *(.init_array) must be placed explicitly, otherwise it is shared between two regions, and the linker is unable to decide where to place it.

* Removed strncmp

* Fix on chip flash minimal programmable unit size

- sector size is 0x800 bytes
- writeable unit size is 0x8 bytes
- flash start address is 0x0
- total ADuCM3029 on chip flash size is 0x40000 bytes
- total ADuCM4050 on chip flash size is 0x7F000 bytes

* Remove unnecessary casts

The volatile qualifier on the __LDREX/__STREX prototypes only means that
it's safe to use them on volatile objects. Doesn't mean you actually
have to pass them volatile pointers.

Adding the volatile is a bit like doing strlen((const char *) ptr)
because you've got a non-const pointer.

* Add volatile qualifiers to atomic functions

The atomic functions preserve volatile semantics - they only perform the
accesses specified. Add the volatile qualifier to the value pointer to
reflect this. This does not change existing caller code - it's
equivalent to adding a const qualifier to indicate we don't write to
a pointer - it means people can pass us qualified pointers without
casts, letting the compile check const- or volatile-correctness.

This is consistent with C11 <stdatomic.h>, which volatile-qualifies its
equivalent functions.

Note that this useage of volatile has nothing to do with the atomicity -
objects accessed via the atomic functions do not need to be volatile.
But it does permit these calls to be used on objects which have been
declared volatile.

* Fix doxygen for ITM HAL

* STM32 LPTICKER : optimize RTC wake up timer init

Division in a while loop is removed

* Replace runtime strip_path function with compiler intrinsic equivalents



Sleep manager tracing strips the path from filenames and uses the result as an
identifier to track drivers that unlock/lock sleep tracing. Replace the function
that strips the path from the string, replace this function with a new macro,
__FILENAME__ which performs the same action in a compiler specific manner.

- GCC_ARM, use __builtin_strrchr which is optimized out at compile time.
- ARM, use __MODULE__ which returns the filename without path.
- IAR, specifiy the --no_path_in_file_macros compiler flag.

* Refactor sleep tracing driver identifier to be pointer to the driver filepath.

The use of __FILE__ macro to get a usable identifier from the driver path
causes the path of the file to be stored in the .text region of the binary.
Given that this remains for the entire duration of the program, storing a
pointer to this string as an identifier is more efficient than copying the
contents of the string during lookup/insertion.

* equeue: Added profiling reports to Travis

* DISCO_L496AG: add PeripheralPins.c

* DISCO_L496AG: remove QSPI2

Base adress not found in registers map file but found in CubeMX xml file.

* DISCO_L496AG: add other pins related files

* DISCO_L496AG: add platform in targets.json file

* DISCO_L496AG: add system clock file (same as Nucleo)

* DISCO_L496AG: add entry in mbed_rtx.h

* DISCO_L496AG: remove morpho connector in targets.json

* Remove superfluous compiler check in macro

* Correct Realtek post-build script to work in the online compiler

* LoRa: LoRaMac need removed from LoRaMacCommand class

- LoRaMacCommand does not have any external dependencies anymore
- Also LoRaMacMlme is not using LoRaMacCommand anymore

* LoRa: get_phy_params() refactored

- get_phy_params function was very heavy weight and needed to be refactored.
- switch-case clauses have been refactored to be functions now and the complexity of the usage has been improved a lot.
- There are no functional changes, this is internal only change

* LoRa: Removed LoRaMac dependency from MIB and MLME classes

- Internal refactoring only, no functional changes

* LoRa: reset_mac_parameters put to correct place

* LoRa: LoRaMacMcps refactored to remove dependency to LoRaMac.

- This is internal logic only and there are no functionality changes
- Some compliance test stuff have been moved to end of files
- Some internal data structures removed as useless after refactor

* LoRA: Code cleanup + doxygen updates

- Internal changes only
- reset function is created to LoRaPHY to reset LoRaMAC parameters with default values
- Doxygen updates for newly created functions

* Added missing mac_cmd_buf_idx_to_repeat to LoRaMacCommand class

- Reordered LoRaWANStack internal variables for more compact code

* Correct syntax for mbed export in Py3

* Correct type issue in export arg parsing

* [Nuvoton] Remove unnecessary UART INT in UART DMA transfer

In UART DMA transfer, it is PDMA INT rather than UART INT to go INT path

* NVStore: key management enhancements

- Define an enum for predefined keys (later filled by internal users of NVStore)
- Add the set_alloc_key API, allocating a free key from the non predefined keys

* Remove IAR compiler flag change from PR

* Disabled flash clock and cache test for NRF52 MCUs.
This is meant to be a temporary fix until the issue has been root caused, and Jenkins CI is no longer intermittently failing.

* armcc - remove fromelf output before regenerating

Fix armcc recompile errors during elf2bin stage. Errors shown as follows:

Elf2Bin: mbed-os-example-wifi
Error: Q0147E: Failed to create Directory .\BUILD\REALTEK_RTL8195AM\ARM\mbed-os-example-wifi.bin\IMAGE2_TABLE: File exists
Finished: 0 information, 0 warning and 1 error messages.
[ERROR] Error: Q0147E: Failed to create Directory .\BUILD\REALTEK_RTL8195AM\ARM\mbed-os-example-wifi.bin\IMAGE2_TABLE: File exists
Finished: 0 information, 0 warning and 1 error messages.

Signed-off-by: Tony Wu <[email protected]>

* Enabled os5 support for VK_RZ_A1H & synced with rest Renesas targets !

Mbed-os 5.4.7 was the last unofficial working support for this target.
Since Mbed-os 5.6.0, the support is now official and VK_RZ_A1H is now "codebase aligned" with GR_PEACH (RZ_A1H) & GR_LYCHEE (RZ_A1LU) !

* PR template: fix task

* PR template: only one should be checked

* STM32L4 ADC Internal Channel : correct sampling time

* flash: add docs for user defined data

This should make some of the data more clear to a user

* Fix issues with __FILENAME__ macro

- Move macro definition to mbed_toolchain.h
- Remove double underscores from macro which are reserved.
- Fix macro for IAR until compiler flags to disable path are added again.

* Ensure DR_6 cannot be selected for IN865 region

* Changed RegionNextChannel function in order to return LoRaMacStatus_t instead of a boolean

Removed the while loop checking the return value from set_next_channel
(GitHub Issue Lora-net/LoRaMac-node#357)

The new return values are:

LORAWAN_STATUS_OK                    : A channel has been found.
LORAWAN_STATUS_NO_FREE_CHANNEL_FOUND : No free channel has been found (AS923 and KR920 regions)
LORAWAN_STATUS_DUTYCYCLE_RESTRICTED  : No channel found due to the duty-cycle or JoinReq back-off restrictions. Trial must be delayed.
LORAWAN_STATUS_NO_CHANNEL_FOUND      : No channel has been found. Re-enabled the default channels.

* Fix an issue with sequence calls.

This issue is only present for a device in class c mode, which
has perform unconfirmed uplinks.

Lora-net/LoRaMac-node#327

* Do only set the MacDone if the MAC is not in class c

* Fix rx slot handling

Store the rx slot temporarily. When in class C, this variable will be changed
in function OpenContinuousRx2Window.

* Fix calculation of the aggregated time-off.

Perform only an assignment.

Lora-net/LoRaMac-node#282

* Add the possibility to set the default antenna gain.

* Bug fix in RX timeout and RX error handling for class c nodes.

1. Do not stop the 2nd window timer, as it is not running.
2. Wait for the OnAckTimeout event, before setting MacDone
3. Process for class c also the 2nd window timeout part, as we do
   not have a 2nd window timer.

* Remove unused is_fPort_allowed method

* Changed mcps confirmation ul_frequency to channel

* Update handling for functions OnRadioRxError and OnRadioRxTimout.

This is especially important for class c devices.

* Update DevStatusAnd format

In the DevStatusAns format, the protocol requires RFU(7:6) value = 0

* Change minimum required channels from 6 to 2 (US915Hybrid)

Lora-net/LoRaMac-node#362

* Add set_device_class API to change active device class

This API can be used to runtime change device class.

Please note that only class A and C are supported at the moment.
Trying to set class B will return LORAWAN_STATUS_UNSUPPORTED.

Fix set_device_class documentation

fix documentation

* Fix reception of class C messages

- Do not put radio into sleep when message is received in class c mode
- Experimental feature for acknowledging confirmed downlink messages

* Simplify check for pending bit

* Remove redundant event from timer callbacks

Since our timers are now already using events, we no longer need to
defer timer callback calls.

* LoRa: LoRaWANInterface refactored.

- Only internal changes, no functionality changes
- Some minor improvements to LoRaWanStack

* LoRa: LoRaPHY dependency removed from LoRaMacStack

- This is internal change, no functionality has been changed
- LoRaWanInterface cleaned up and code moved to LoRaMacStack
- Compliance code in LoRaMacStack moved to EOF
- Green tea tests have been run manually
- Doxygen updated accordingly

LoRA: reorder class members

* LoRaWANStack is made independent of MAC sublayers

- Only internal changes, no API has been broke.
- Tested by manually running Green tea tests

* LoRa: LoRaMAC class refactored

- Internal change only, no functional changes
- Tested by running Green tea tests manually

* LoRa: Struct cleanups

- Unneeded structs removed and replaced by variables in functions

* LoRa: Added API break warnings for lorawan_channelplan_t struct and it's components

* LPC176X: Fix flash program size

This patch fix flash write issue when program size is more than page size (= 1024 bytes).  See detail - ARMmbed#6165
Source data always use aligned data in heap memory.

* STM32L4 ADC correct internal channel management

* rtl8195am: fix LogUART Tx interrupt crash

add Mask & UnMask Tx FIFO empty interrupt for LogUart
fix LogUart interrupt enable
fix LogUart interrupt handler
coding style fix

* lwIP: fix some IPv6 errors, eg TCP keepalive

Glue code was inspecting lwIP's netconn "type", checking directly for
NETCONN_UDP and NETCONN_TCP.

Unfortunately the type byte has some flag bits like
"IPv6", which means the tests fail if it's an IPv6 socket. So, for
example, TCP socket options were rejected for IPv6.

Add the necessary NETCONNTYPE_GROUP macros to fix this.

* PR template: do not use task list

* Add missing Doxygen descriptions for Nanostack

Fix couple of parameter issues as well.

* Fix compilance test compilation

Fix compilation of compilance test and at the same time refactor compliance
test handler. Renamed mcps_request as test_request as it is only used for
compliance test. Also fixed a bug with null buffer in send_compliance_test_frame_to_mac.

* Restore single-param InterruptIn ctor, to maintain binary compatibility (for Wi-Fi drivers).
Revert "simplify InterruptIn - default parameter instead of multiple constructors"; add comment.

This reverts commit d28dbf6.

* linebreaks

* Correct get_config imports

* [Nuvoton] Fix page size in flash IAP

In Mbed OS, page size is program unit, which is different than FMC definition.
After fixing page size, we can pass NVSTORE test (mbed-os-features-nvstore-tests-nvstore-functionality).

* [M487] Support v3.0 pin map

* Added SerialWireOutput to mbed namespace

* Modified apt-get retry logic with Travis CI retry feature

* Add overloaded get_erase_size API with address parameter to all block devices

* add support for the RAK811

* add RF_TXCO_EN on PH1 and set HSI calibration to its default value

* Avoid incorrect config errors on export

* Remove supertarget

* Added test for MbedCRC.h

* Default constructor for template class should be part of header file

* [Nuvoton] Remove unnecessary TIMER_Start in the end of lp_ticker_set_interrupt

* [Nuvoton] Check timer active flag after enabling timer counting in us_ticker/lp_ticker

* [Nuvoton] Add missing delay in lp_ticker

mbed-os-tests-mbed_drivers-lp_ticker/Test multi ticker test fails inconstantly.
This commit is mainly to fix the issue.

* Realtek: serial - line ending fix

One line had a window line ending

* Added Support for Toshiba TMPM46B

* Modified ESG reset process

* CI build - case sensitive include header resolved

* Dynamic vector relocation and formatting changes

* Low power consumption mode for deepsleep

* Revert "BLE: Gatt client unit tests"

* Renaming Ublox library for mbed cellular framework

(cherry picked from commit 737609736591d12ea369d5b364d132e7a6367ae2)

* Adding deprecated warnings for old name

* switch to stm32l151cb-a & work around flash size field width.

* KL82Z: Fix the clock selection for LPUART module

Signed-off-by: Mahesh Mahadevan <[email protected]>

* Moving deprecated warnings outside the class

* add the target to travis build script & sw4stm32 export script.

* Enable tickless mode on Silicon Labs targets

* fix device name (an mixed tab/space)

* Add alignment check in the flash_program_page

* Add source address word alignment check
* malloc and memcpy are called only if data is unaligned
* malloc size is now copySize (program page size), rather than whole buffer to be written

* Move filter dot into exporter base class

* Minimize include path size in uvision export

* Set up the ISR stack pointer in the right location on ARMCC

EFR32MG1, EFR32MG12 and EFM32PG12 didn't have a fixed ARMCC linker script yet.

* add IAR to the supported toolchain

* [BLE] Fixed inconsistent casing issue for SecurityDb

* Move Mbed 5 support check so that it affects the exporters

* Inrease thread stack size to 1024 bytes in NVStore test for NRF52

* Fix EV_COG_AD4050LZ `us_ticker_fire_interrupt()` minimal time interval

- ensure us_ticker_irq_handler() is called only when GP2 timer expires
- set us_ticker_set_interrupt() time interval to be 9.846 us
- set us_ticker_fire_interrupt() time interval to be 0.03846 us
- convert tab to space

* Fix EV_COG_AD3029LZ `us_ticker_fire_interrupt()` minimal time interval

- ensure us_ticker_irq_handler() is called only when GP2 timer expires
- set us_ticker_set_interrupt() time interval to be 9.846 us
- set us_ticker_fire_interrupt() time interval to be 0.03846 us

* Fix IPv4 address parsing due to not-so-portable scanf modifier

Bug is raised when using newlib-based toolchains.
%hh format is only avaliable in scanf if newlib is compiled
with _WANT_IO_C99_FORMATS option.

* Update mbed-coap to version 4.4.1

- Fixes error: IOTCLT-2539 Block wise messaging call-backs not working logically
- Allow TCP+TLS transport method to send larger messages without blockwising.

NOTE! These are internal changes required for cloud client. This has no direct relevance to any mbed-os functionality.

* Test line-ending problems

* LoRa: Small fixes

- changed few static variables to have const

* L1 ST CUBE V1.8.1

* Fix typos causing ARM build error

* STM32L1: allow redefinition of FLASH_SIZE macro

* Update stm32l151xba.h

* Exclude files like `.main.cpp` from builds

* Fix doxygen comments to reflect the deprecated functions

* Fix deep sleep locking for Timeout class

Detach in the Timeout::handler so deep sleep is properly unlocked.

* Error on invalid mbed_lib JSON

* LoRa: Fixed cflist decoding issue

- This fixes defect IOTCELL-754
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants