Skip to content
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

[STM32F0] Add asynchronous serial #2415

Merged
merged 3 commits into from
Sep 24, 2016
Merged

Conversation

svastm
Copy link
Contributor

@svastm svastm commented Aug 10, 2016

This PR add the asynchronous serial for the following targets:

  • NUCLEO_F070RB
  • NUCLEO_F072RB
  • NUCLEO_F091RC

The struct serial_s move to common_objects.h.

I enable only this ones because the utest require at least 3 uarts to test the implementation. Should we enable non tested (automatically) targets ?

test report

For some reasons the cpputest is failing on IAR and GCC for at least NUCLEO_F070RB and NUCLEO_F072RB.

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 11, 2016

For some reasons the cpputest is failing on IAR and GCC for at least NUCLEO_F070RB and NUCLEO_F072RB.

Same as in the other pull request. Please have a look at failures.

I enable only this ones because the utest require at least 3 uarts to test the implementation.

3 ? you mean stdio + 2 uart (tx to rx) to test?

@svastm
Copy link
Contributor Author

svastm commented Aug 16, 2016

Yes by 3 uart, I mean 2 + stdio.

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 24, 2016

/morph test

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 24, 2016

For some reasons the cpputest is failing on IAR and GCC for at least NUCLEO_F070RB and NUCLEO_F072RB.

What are those failures?

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 699

Build failed!

@bridadan
Copy link
Contributor

The build failed for NUCLEO_F070RB and NUCLEO_F072RB for the IAR compiler, looks like some of the tests don't fit into memory

@sg-
Copy link
Contributor

sg- commented Aug 26, 2016

@svastm please rebase

@svastm
Copy link
Contributor Author

svastm commented Aug 29, 2016

rebased

@sg- sg- removed the needs: review label Sep 8, 2016
@sg-
Copy link
Contributor

sg- commented Sep 8, 2016

@mbed-bot: TEST

HOST_OSES=ALL
BUILD_TOOLCHAINS=ALL
TARGETS=ALL

@sg-
Copy link
Contributor

sg- commented Sep 8, 2016

/morph test

@mbed-bot
Copy link

mbed-bot commented Sep 8, 2016

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 786

Build failed!

@mbed-bot
Copy link

mbed-bot commented Sep 9, 2016

[Build ${MBED_BUILD_ID}]
FAILURE: Something went wrong when building and testing.

@sg-
Copy link
Contributor

sg- commented Sep 9, 2016

Needs further investigation as to why this change causes tests to not fit in the memory of the devices
TESTS-MBED_DRIVERS-C_STRINGS for NUCLEO_F070RB and NUCLEO_F072RB

@sg- sg- added the needs: work label Sep 9, 2016
@svastm
Copy link
Contributor Author

svastm commented Sep 9, 2016

The NUCLEO_F070RB have 16192 Bytes in the RAM section.

without this PR, the build of test-mbed_drivers-c_strings give:

[DEBUG] Output:    IAR ELF Linker V7.40.3.8902/W32 for ARM
[DEBUG] Output:    Copyright 2007-2015 IAR Systems AB.
[DEBUG] Output:
[DEBUG] Output:   35 678 bytes of readonly  code memory
[DEBUG] Output:    1 267 bytes of readonly  data memory
[DEBUG] Output:   15 782 bytes of readwrite data memory
[DEBUG] Output:
[DEBUG] Output: Errors: none
[DEBUG] Output: Warnings: none
[DEBUG] Output:

With the PR

[DEBUG] Output:    IAR ELF Linker V7.40.3.8902/W32 for ARM
[DEBUG] Output:    Copyright 2007-2015 IAR Systems AB.
[DEBUG] Output:
[DEBUG] Output:   35 950 bytes of readonly  code memory
[DEBUG] Output:    1 176 bytes of readonly  data memory
[DEBUG] Output:   16 274 bytes of readwrite data memory
[DEBUG] Output:
[DEBUG] Output: Errors: 1
[DEBUG] Output: Warnings: none
[DEBUG] Output:
[DEBUG] Output: Link time:   0.25 (CPU)   0.26 (elapsed)
[DEBUG] Errors: Error[Lp011]: section placement failed
[DEBUG] Errors:           unable to allocate space for sections/blocks with a total estimated
[DEBUG] Errors:                     minimum size of 0x3f98 bytes (max align 0x8) in
[DEBUG] Errors:                     <[0x200000c0-0x20003fff]> (total uncommitted space 0x3f40).

So the readwrite data memory increased by 492 bytes.

I did not do the math precisely but I found:

  • changed a unique global UART_HandleTypeDef to an array of 4. (+ ~360 bytes)
  • increase serial_t size (+ ~32 bytes)

The number does not look huge to me.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 12, 2016

We could optimize here?

From the diff:

+struct serial_s {
 +    UARTName uart;
 +    int index; // Used by irq
 +    uint32_t baudrate;
 +    uint32_t databits;
 +    uint32_t stopbits;
 +    uint32_t parity;
 +    PinName pin_tx;
 +    PinName pin_rx;
 +#if DEVICE_SERIAL_ASYNCH
 +    uint32_t events;
 +#endif
 +#if DEVICE_SERIAL_FC
 +    uint32_t hw_flow_ctl;
 +    PinName pin_rts;
 +    PinName pin_cts;
 +#endif
 +}

index could be uint8_t. Baudrate could be uint16_t. databits could be uint8_t, same for stopbits and parity ?

@svastm
Copy link
Contributor Author

svastm commented Sep 14, 2016

With your suggestion I get this:

[DEBUG] Output:    IAR ELF Linker V7.40.3.8902/W32 for ARM
[DEBUG] Output:    Copyright 2007-2015 IAR Systems AB.
[DEBUG] Output:
[DEBUG] Output:   35 734 bytes of readonly  code memory
[DEBUG] Output:    1 108 bytes of readonly  data memory
[DEBUG] Output:   16 250 bytes of readwrite data memory

So we save 24 bytes. We could look for more static RAM optimizations but I think we will stay close to the limit. Maybe we should reduce heap and stack size.

For now, heap take 1/4 of RAM and stack 1/8.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 14, 2016

Maybe we should reduce heap and stack size.

How much are those 2 now for this target?

Can you please resolve conflicts?

@sg- sg- removed the needs: CI label Sep 16, 2016
@svastm
Copy link
Contributor Author

svastm commented Sep 20, 2016

Rebased.
With the #2745 which come just at the right time. The size of the c_strings test decrease to

36 174 bytes of readonly  code memory
   1 331 bytes of readonly  data memory
  15 824 bytes of readwrite data memory

So there is 368 bytes left for an other feature upgrade. Should I still reduce heap and stack for IAR ?

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 20, 2016

Should I still reduce heap and stack for IAR ?

We could answer if you share how much is currently allocated for this target.

@svastm
Copy link
Contributor Author

svastm commented Sep 20, 2016

The reserved size is

heap:  0x1000 -> 4096 bytes
stack: 0x0800 -> 2048 bytes

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 22, 2016

368 bytes is not much, shall we reduce at least heap?

@svastm
Copy link
Contributor Author

svastm commented Sep 22, 2016

I'm a bit confuse. I may have test on the wrong branch. I did another test with the PR merged and

mbed test -m NUCLEO_F070RB -t IAR -n mbed-os-tests-mbed_drivers-c_strings -v
...
[DEBUG] Output:    IAR ELF Linker V7.60.1.11101/W32 for ARM
[DEBUG] Output:    Copyright 2007-2016 IAR Systems AB.
[DEBUG] Output:
[DEBUG] Output:   35 922 bytes of readonly  code memory
[DEBUG] Output:    1 254 bytes of readonly  data memory
[DEBUG] Output:   13 772 bytes of readwrite data memory
[DEBUG] Output:

2420 bytes free 😂

@sg- sg- added needs: CI and removed needs: work labels Sep 22, 2016
@sg-
Copy link
Contributor

sg- commented Sep 22, 2016

@mbed-bot: TEST

HOST_OSES=ALL
BUILD_TOOLCHAINS=ALL
TARGETS=ALL

@sg-
Copy link
Contributor

sg- commented Sep 22, 2016

/morph test

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 927

All builds and test passed!

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

Code LGTM

@mbed-bot
Copy link

[Build 971]
SUCCESS: Building succeeded and tests were run! Be sure to check the test results

@sg- sg- merged commit 297597c into ARMmbed:master Sep 24, 2016
aisair pushed a commit to aisair/mbed that referenced this pull request Apr 30, 2024
Ports for Upcoming Targets

2669: Added u-blox C029 target ARMmbed/mbed-os#2669
2707: [EFM32] Add IAR support for remaining Silicon Labs targets ARMmbed/mbed-os#2707
2819: MultiTech xDot platform support - 09.26.2016 ARMmbed/mbed-os#2819
2827: include MultiTech xDot in mbed 5 releases ARMmbed/mbed-os#2827

Fixes and Changes

2522: Add CThunk for CM7 ARMmbed/mbed-os#2522
2518: Enable uvisor on Beetle ARMmbed/mbed-os#2518
2571: STM32F7 - Add asynchronous serial ARMmbed/mbed-os#2571
2616: STM32F3xx - Add Serial Flow Control pins + enable it ARMmbed/mbed-os#2616
2619: NUCLEO_L152RE - Add Serial Flow Control ARMmbed/mbed-os#2619
2620: NUCLEO_F429ZI - Add SERIAL_FC macro ARMmbed/mbed-os#2620
2666: [EFM32] Microsecond ticker optimization ARMmbed/mbed-os#2666
2681: STM32F0xx - Add support of ADC internal channels ARMmbed/mbed-os#2681
2687: [NRF5] Add fs_data symbol in data secton for gcc ARMmbed/mbed-os#2687
2696: Add device_has to all nrf51 devices ARMmbed/mbed-os#2696
2703: TARGET_NRF5: Changed 'serial_baud' implementation to support special baud rates. ARMmbed/mbed-os#2703
2704: DISCO_L476VG: add SPI nicknames ARMmbed/mbed-os#2704
2723: KSDK serial_api.c: Fix assertion error for ParityEven ARMmbed/mbed-os#2723
2463: [STM32L0] Add asynchronous serial ARMmbed/mbed-os#2463
2572: Fix STM32F407VG target name and LPC11U6X linker errors ARMmbed/mbed-os#2572
2698: DELTA_DFBM_NQ620 target ARMmbed/mbed-os#2698
2542: Dev spi asynch stm32f4 ARMmbed/mbed-os#2542
2650: STM32F3 - Add low power timer ARMmbed/mbed-os#2650
2415: [STM32F0] Add asynchronous serial ARMmbed/mbed-os#2415
2585: Added support for ADC only pins in LPC43xx ARMmbed/mbed-os#2585
2622: [STM32F4] Add asynchronous I2C ARMmbed/mbed-os#2622
2719: Updated ARM linker scripts for Kinetis platforms that use SDK 2.0 ARMmbed/mbed-os#2719
2728: Added ethernet and enabled IPV4 feature for the EVK-ODIN-W2/C029 target ARMmbed/mbed-os#2728
2747: [LPC11U68] Fix pin interrupt select offset ARMmbed/mbed-os#2747
2751: STM32L0xx - Add Serial Flow Control ARMmbed/mbed-os#2751
2753: [NUCLEO_F767ZI] Add CAN capability ARMmbed/mbed-os#2753
2759: STM32F0 - Add low power timer ARMmbed/mbed-os#2759
2763: STM32L1 - Add low power timer ARMmbed/mbed-os#2763
2764: STM32L4 - Add low power timer ARMmbed/mbed-os#2764
2771: STM32L4 - Update deepsleep implementation ARMmbed/mbed-os#2771
2775: Update KSDK SDHC driver for K64F & K66F ARMmbed/mbed-os#2775
2792: [NUCLEO_F303ZE] MBED-OS5 capability ARMmbed/mbed-os#2792
2762: STM32L0 - Add low power timer ARMmbed/mbed-os#2762
2761: STM32F7 - Add low power timer ARMmbed/mbed-os#2761
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.

5 participants