Git Product home page Git Product logo

stm32f303-ccmram-test's Introduction

STM32F303 CCMRAM test

dimtass

Note: This code is from this blog post here.

This project is a template project for evaluating and testing the Core-Coupled Memory (CCM) of the STM32F303CC. This memory is 8KB in size and it's the fastest memory in the chip (faster than SRAM). You can map the functions you need in that area by using a compiler attribute like this.

__attribute__((section(".ccmram"))) void function();

Note: I've used this application note for enabling the CCM RAM feature.

In this project I'm using the LZ4 which is a fast compression library. The code for the lib is located in source/libs/lz4/. I've mapped the LZ4_compress_generic() function in the CCMRAM which is located in source/libs/lz4/src/lz4.c.

Furthermore, in order to support the CCM RAM a modification is needed in the default startup source/libs/cmsis/device/startup_stm32f30x.s file and the linker script source/config/LinkerScripts/STM32F303xC/STM32F303VC_FLASH.ld. In this project the modifications are already done, therefore you can use those files to other projects in order to enable the CCM RAM.

Finally, you also need to provide the path of the toolchain to use in the CMAKE_TOOLCHAIN if it's different from the default one. By default is pointing to /opt/toolchains/gcc-arm-none-eabi-9-2019-q4-major.

Cloning the code

Because this repo has dependencies on other submodules, in order to fetch the repo use the following command:

git clone --recursive -j8 https://[email protected]/dimtass/stm32f103-cmake-template.git

Build the firmware

There are many flags that you can use for building the firmware. This is the format of the buld command:

USE_OVERCLOCKING=<ON/OFF> USE_BLOCK_SIZE=<N> USE_BLOCK_COUNT=<N> USE_CCM=<ON/OFF> USE_SRAM=<ON/OFF> USE_FLASH=<ON/OFF> ./build.sh
  • USE_OVERCLOCKING, ON: enable overclocking at 128MHz, OFF: 72MHz
  • USE_BLOCK_SIZE, number of bytes used as the block size. Default: 8, which means 8K
  • USE_BLOCK_COUNT, number of blocks used for the compression. Default: 512.
  • USE_CCM, ON: move compression function to CCMRAM
  • USE_SRAM, ON: move compression function to SRAM
  • USE_FLASH, ON: move compression function to FLASH

Notes:

  • Only one of the USE_CCM, USE_SRAM, USE_FLASH can be ON.
  • The processed size will be USE_BLOCK_SIZE*USE_BLOCK_COUNT
  • The default processed size is 4MB
  • The USE_BLOCK_SIZE can not be larger than 20KB

These are some examples:

USE_OVERCLOCKING=OFF USE_BLOCK_SIZE=8 USE_BLOCK_COUNT=512 \
USE_CCM=OFF USE_SRAM=OFF USE_FLASH=ON ./build.sh

USE_OVERCLOCKING=OFF USE_BLOCK_SIZE=16 USE_BLOCK_COUNT=512 \
USE_CCM=OFF USE_SRAM=OFF USE_FLASH=ON ./build.sh

USE_OVERCLOCKING=ON USE_BLOCK_SIZE=8 USE_BLOCK_COUNT=512 \
USE_CCM=OFF USE_SRAM=OFF USE_FLASH=ON ./build.sh

USE_OVERCLOCKING=ON USE_BLOCK_SIZE=16 USE_BLOCK_COUNT=512 \
USE_CCM=OFF USE_SRAM=OFF USE_FLASH=ON ./build.sh

USE_OVERCLOCKING=OFF USE_BLOCK_SIZE=8 USE_BLOCK_COUNT=512 \
USE_CCM=OFF USE_SRAM=ON USE_FLASH=OFF ./build.sh

USE_OVERCLOCKING=OFF USE_BLOCK_SIZE=16 USE_BLOCK_COUNT=512 \
USE_CCM=OFF USE_SRAM=ON USE_FLASH=OFF ./build.sh

USE_OVERCLOCKING=ON USE_BLOCK_SIZE=8 USE_BLOCK_COUNT=512 \
USE_CCM=OFF USE_SRAM=ON USE_FLASH=OFF ./build.sh

USE_OVERCLOCKING=ON USE_BLOCK_SIZE=16 USE_BLOCK_COUNT=512 \
USE_CCM=OFF USE_SRAM=ON USE_FLASH=OFF ./build.sh

USE_OVERCLOCKING=OFF USE_BLOCK_SIZE=8 USE_BLOCK_COUNT=512 \
USE_CCM=ON USE_SRAM=OFF USE_FLASH=OFF ./build.sh

USE_OVERCLOCKING=OFF USE_BLOCK_SIZE=16 USE_BLOCK_COUNT=512 \
USE_CCM=ON USE_SRAM=OFF USE_FLASH=OFF ./build.sh

USE_OVERCLOCKING=ON USE_BLOCK_SIZE=8 USE_BLOCK_COUNT=512 \
USE_CCM=ON USE_SRAM=OFF USE_FLASH=OFF ./build.sh

USE_OVERCLOCKING=ON USE_BLOCK_SIZE=16 USE_BLOCK_COUNT=512 \
USE_CCM=ON USE_SRAM=OFF USE_FLASH=OFF

To build the firmware without using CCM then:

CLEANBUILD=true USE_CCM=OFF ./build.sh

To build the firmware using CCM then:

CLEANBUILD=true USE_CCM=ON ./build.sh

Flashing the firmware

To flash the firmware in Linux you need the texane/stlink tool. Then you can use the flash script like this:

./flash.sh

Otherwise you can build the firmware and then use any programmer you like. The elf, hex and bin firmwares are located in the build folder

./build-stm32/src/stm32f303xc-ccm-test.bin
./build-stm32/src/stm32f303xc-ccm-test.hex
./build-stm32/src/stm32f303xc-ccm-test.elf

FW details

  • CMSIS version: 4.2.0
  • StdPeriph Library version: 1.2.3

stm32f303-ccmram-test's People

Contributors

dimtass avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.