diff --git a/.arcconfig b/.arcconfig deleted file mode 100644 index 5c2bb3b..0000000 --- a/.arcconfig +++ /dev/null @@ -1,4 +0,0 @@ -{ - "project.name" : "lib_sdram", - "phabricator.uri" : "http://phabricator.xmos.local:9000/" -} diff --git a/.github/ISSUE_TEMPLATE/application-note-not-compliant.md b/.github/ISSUE_TEMPLATE/application-note-not-compliant.md deleted file mode 100644 index 90723cb..0000000 --- a/.github/ISSUE_TEMPLATE/application-note-not-compliant.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: Application Note Issue -about: Template for an Application note issue report -title: examples/ANXXXXX Application Note not compliant -labels: documentation -assignees: '' - ---- - - - - -**Issues:** - - - xdoc-custom RST directives used in the Application Note README - - application note code not compiling for xcore-ai - - application note code not running successfully on xcore-ai diff --git a/.github/ISSUE_TEMPLATE/example-not-compliant.md b/.github/ISSUE_TEMPLATE/example-not-compliant.md deleted file mode 100644 index 5e68cdb..0000000 --- a/.github/ISSUE_TEMPLATE/example-not-compliant.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Example Issue -about: Template for an example issue report -title: examples/xxx Example not compliant -labels: documentation -assignees: '' - ---- - - - - -**Issues:** - - - convert example to Application Note - - xdoc-custom RST directives used in the README - - example code not compiling for xcore-ai - - example code not running successfully on xcore-ai diff --git a/.github/ISSUE_TEMPLATE/missing-application-note.md b/.github/ISSUE_TEMPLATE/missing-application-note.md deleted file mode 100644 index 9404dde..0000000 --- a/.github/ISSUE_TEMPLATE/missing-application-note.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Missing Application Note -about: Template for a Missing Application Note issue report -title: Missing Application Note -labels: documentation -assignees: '' - ---- - - diff --git a/.github/ISSUE_TEMPLATE/missing-c-api.md b/.github/ISSUE_TEMPLATE/missing-c-api.md deleted file mode 100644 index 6230ef7..0000000 --- a/.github/ISSUE_TEMPLATE/missing-c-api.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Missing C API Issue -about: Template for a Missing C API issue report -title: Missing C API -labels: enhancement -assignees: '' - ---- - - diff --git a/.github/ISSUE_TEMPLATE/missing-xcore-test.md b/.github/ISSUE_TEMPLATE/missing-xcore-test.md deleted file mode 100644 index 866e97c..0000000 --- a/.github/ISSUE_TEMPLATE/missing-xcore-test.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Missing xCore Test Issue -about: Template for a Missing xCore test issue report -title: Missing xCore test -labels: testing -assignees: '' - ---- - - diff --git a/.github/ISSUE_TEMPLATE/test-not-compliant.md b/.github/ISSUE_TEMPLATE/test-not-compliant.md deleted file mode 100644 index cce3e91..0000000 --- a/.github/ISSUE_TEMPLATE/test-not-compliant.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Test Issue -about: Template for a Test issue report -title: tests/XXX does not build or fails -labels: testing -assignees: '' - ---- - - - - -**Issues:** - - - Test not compiling for xcore-ai - - Test not running successfully on xcore-ai diff --git a/.github/ISSUE_TEMPLATE/top-level-readme-not-compliant.md b/.github/ISSUE_TEMPLATE/top-level-readme-not-compliant.md deleted file mode 100644 index 931414c..0000000 --- a/.github/ISSUE_TEMPLATE/top-level-readme-not-compliant.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: Top-level README Issue -about: Template for the top-level README issue report -title: Top-level README not compliant -labels: documentation -assignees: '' - ---- - - -**Issues:** - - - xdoc-custom RST directives used in the README diff --git a/.gitignore b/.gitignore index 5bf0d73..5a611c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,46 @@ -**.build*/* -**/bin/* -*.o -*.xe +# Tmp files & logs +*.settings +*.bin +*.zip +*.log *.vcd -*.s +*.swp +*.*~ +*.xmt +*.swo +*.swn +*~ +*.DS_Store + +# Python +*.pyc +**/*.egg-info/ +**/.venv*/ +*.python-version + +# XMOS temp files +**/*build*/* +**/bin/* +**/flash_bin_node* +**/fw-* +**/s2l-* +**/spanning-xn-* +**/target-xn* *.xi +*.o *.i *.a -**/_build/* -lib_lcd/doc/rst/_build/* -**/run_*.log -**/pdf/* -**/html/* -Installs/* -.settings* -examples/lcd_demo/.build*/* -*.swp -examples/sdram_demo/.build* +*.d +*.decouple +*.pca.xml +**/CMakeFiles/* + +# XMOS binaries +*.xe + +# Built documentation +doc/_build/pdf/*.pdf +**/doc/pdf/*.pdf + +# Editor +*.vscode diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 15b69a7..56973b5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,10 @@ -SDRAM library change log -======================== +lib_sdram change log +==================== + +3.4.0 +----- + + * Update to xcommon_cmake and purge old build system files 3.3.0 ----- diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..01b1718 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,123 @@ +// This file relates to internal XMOS infrastructure and should be ignored by external users + +@Library('xmos_jenkins_shared_library@v0.43.3') _ + +getApproval() +pipeline { + + agent none + + parameters { + string( + name: 'TOOLS_VERSION', + defaultValue: '15.3.1', + description: 'XTC tools version' + ) + string( + name: 'XMOSDOC_VERSION', + defaultValue: 'v8.0.0', + description: 'xmosdoc version' + ) + string( + name: 'INFR_APPS_VERSION', + defaultValue: 'v3.1.1', + description: 'The infr_apps version' + ) + choice( + name: 'TEST_LEVEL', choices: ['smoke', 'default', 'extended'], + description: 'The level of test coverage to run' + ) + } + + options { + skipDefaultCheckout() + timestamps() + buildDiscarder(xmosDiscardBuildSettings(onlyArtifacts = false)) + } + + stages { + stage('🏗️ Build and test') { + agent { + label 'x86_64 && linux && documentation' + } + + stages { + stage('Checkout') { + steps { + + println "Stage running on ${env.NODE_NAME}" + + script { + def (server, user, repo) = extractFromScmUrl() + env.REPO_NAME = repo + } + + dir(REPO_NAME){ + checkoutScmShallow() + } + } + } + + stage('Examples build') { + steps { + dir("${REPO_NAME}/examples") { + xcoreBuild() + } + } + } + + stage('Repo checks') { + steps { + warnError("Repo checks failed") + { + runRepoChecks("${WORKSPACE}/${REPO_NAME}") + } + } + } + + stage('Doc build') { + steps { + dir(REPO_NAME) { + buildDocs() + } + } + } + + stage('Tests') { + steps { + dir("${REPO_NAME}/tests") { + withTools(params.TOOLS_VERSION) { + createVenv(reqFile: "requirements.txt") + withVenv { + xcoreBuild(archiveBins: false) + // Use the TEST_LEVEL parameter to control the test coverage + runPytest("--level=${params.TEST_LEVEL}") + } + } + } + } + } + + stage("Archive sandbox") { + steps { + archiveSandbox(REPO_NAME) + } + } + } // stages + post { + cleanup { + xcoreCleanSandbox() + } + } + } // stage 'Build and test' + + stage('🚀 Release') { + when { + expression { triggerRelease.isReleasable() } + } + steps { + triggerRelease() + } + } + } // stages +} // pipeline diff --git a/README.rst b/README.rst index 7fafb73..36d9adf 100644 --- a/README.rst +++ b/README.rst @@ -1,54 +1,81 @@ -SDRAM Library -============= +:orphan: -SDRAM Libary ------------- +############################## +lib_sdram: SDRAM library +############################## + +:vendor: XMOS +:version: 3.4.0 +:scope: General Use +:description: SDRAM server and Memory address allocator components +:category: General Purpose +:keywords: Memory,SDRAM +:devices: xcore-200 + +******* +Summary +******* The XMOS SDRAM library is designed for read and write access of arbitrary length 32b long word buffers at up to 62.5MHz clock rates. It uses an optimized pinout with address and data lines overlaid along with other pinout optimizations to implement 16 bit read/writes to Single Data Rate (SDR) SDRAM devices of size up to 256Mb, while consuming a total of just 20 xCORE I/O pins. +******** Features -........ +******** -The SDRAM component has the following features: +* Configurability of: + * SDRAM capacity + * clock rate (62.5 to 25MHz steps are provided) + * refresh properties +* Supports: + * read of 32b long words + * write of 32b long words + * one or more clients + * asynchronous command decoupling with a command queue of length 8 for each client + * refresh handled by the SDRAM component itself +* Requires a single core for the server +* Requires 500MHz core clock operation - * Configurability of: +************ +Known issues +************ - - SDRAM capacity - - clock rate (62.5 to 25MHz steps are provided) - - refresh properties - * Supports: +* XS1 devices can support a maximum of 64 Mb SDRAM (8 MBytes) using a 8b column address. This is a technical limitation due to addressing modes in the XS1 device and cannot be worked around using the current library architecture. +* XS2 (xCORE-200) devices can support a maximum of 256 Mb SDRAM (32 MBytes) using a 9b column address. 512 Mb devices are supportable with some modifications. Please see the following github issue https://github.com/xmos/lib_sdram/issues/20 for details. +* No Application note is provided currently. Please see https://github.com/xmos/lib_sdram/examples for a simple usage example +* The IP assumes a 500MHz core clock. It may be possible to support other core clock frequencies. However, the I/O timing must be re-calculated to populate the read delay constants for the apprioriate clock divider. These may be found in ``server.xc``. - - read of 32b long words - - write of 32b long words - - one or more clients - - asynchronous command decoupling with a command queue of length 8 for each client - - refresh handled by the SDRAM component itself - * Requires a single core for the server - * Requires 500MHz core clock operation +**************** +Development repo +**************** -Components -........... +* `lib_sdram `_ (https://www.github.com/xmos/lib_sdram) - * SDRAM server - * Memory address allocator +************** +Required tools +************** -Software version and dependencies -................................. +* XMOS XTC Tools: 15.3.1 -The CHANGELOG contains information about the current and previous versions. -For a list of direct dependencies, look for DEPENDENT_MODULES in lib_sdram/module_build_info. +********************************* +Required libraries (dependencies) +********************************* +* None +************************* Related application notes -......................... +************************* -- I/O Timings for xCORE200 [#]_. +* I/O Timings for xCORE200 [#]_. .. [#] https://www.xmos.com/download/private/I-O-timings-for-xCORE200%281.0%29.pdf +******* +Support +******* - - +This package is supported by XMOS Ltd. Issues can be raised against the software at +`www.xmos.com/support `_ or using GitHub `issues `_. \ No newline at end of file diff --git a/doc/Doxyfile.inc b/doc/Doxyfile.inc new file mode 100644 index 0000000..d2100e5 --- /dev/null +++ b/doc/Doxyfile.inc @@ -0,0 +1,8 @@ +# This file provides overrides to the Doxyfile configuration + +PROJECT_NAME = lib_sdram +PROJECT_BRIEF = "SDRAM library" + +INPUT = ../lib_sdram/api + +PREDEFINED = C_API= EXTERN_C= slave= __DOXYGEN__=1 \ No newline at end of file diff --git a/doc/exclude_patterns.inc b/doc/exclude_patterns.inc new file mode 100644 index 0000000..ac8d3fb --- /dev/null +++ b/doc/exclude_patterns.inc @@ -0,0 +1,10 @@ +# The following patterns are to be excluded from the documentation build + +**CHANGELOG* +**LICENSE* +**.pytest_cache/* +#TODO remove these +**index* +**resource_usage_summary* +**app_sdram_demo* +**sdram_benchmark* \ No newline at end of file diff --git a/lib_sdram/doc/rst/images/sdram_hookup.pdf b/doc/rst/images/sdram_hookup.pdf similarity index 100% rename from lib_sdram/doc/rst/images/sdram_hookup.pdf rename to doc/rst/images/sdram_hookup.pdf diff --git a/lib_sdram/doc/rst/sdram.rst b/doc/rst/lib_sdram.rst similarity index 67% rename from lib_sdram/doc/rst/sdram.rst rename to doc/rst/lib_sdram.rst index f6b03d8..eae2d67 100644 --- a/lib_sdram/doc/rst/sdram.rst +++ b/doc/rst/lib_sdram.rst @@ -1,85 +1,42 @@ -.. include:: ../../../README.rst +############################## +lib_sdram: SDRAM library +############################## -Hardware characteristics ------------------------- - -The signals from the xCORE required to drive an SDRAM are: +************ +Introduction +************ -.. _sdram_wire_table: - -.. list-table:: SDRAM data and signal wires - :class: vertical-borders horizontal-borders +The XMOS SDRAM library is designed for read and write access to SDRAM device of arbitrary length 32b long word buffers at up to 62.5MHz clock rates. +It uses an optimized pinout with address and data lines overlaid along with other pinout +optimizations to implement 16 bit read/writes to Single Data Rate (SDR) SDRAM devices of size up to 256Mb, +while consuming a total of just 20 xCORE I/O pins. - * - *Clock* - - Clock line, the master clock the SDRAM uses for - sampling all the other signals. - * - *DQ_AH* - - The 16-bit data bus and address bus multiplexed, - see below. - * - *WE* - - Write enable(Inverted). - * - *RAS* - - The row address strobe(Inverted). - * - *CAS* - - The coloumn address strobe(Inverted). +***** +Usage +***** -Because of the multiplexing attention must paid to the -physical wiring of the SDRAM to the xCORE. +``lib_sdram`` is intended to be used with the `XCommon CMake `_ +, the `XMOS` application build and dependency management system. -A typical 256Mb SDRAM requires the following signals: +To use this library in an application include ``lib_sdram`` in the application's ``APP_DEPENDENT_MODULES`` list in +`CMakeLists.txt`, for example: -* CLK - Clock -* CKE - Clock Enable -* CS - Chip Select -* RAS - Row Address Strobe -* CAS - Col Address Strobe -* WE - Write Enable -* DQ[15:0] - Data -* DQM - Data Input/Output Mask -* A[12:0] - Address -* BA[1:0] - Bank Address - -.. figure:: images/sdram_hookup.pdf - :width: 80% - - Example connection between xCORE to 256Mb SDRAM - - -The exact count of Address lines and Bank Address line may vary. The examples in this document assume a 256Mb SDRAM device. -This library is designed to work with a fixed 16 bit SDRAM data bus, although the API provides data in long words (32 bit). - -The dq_ah bus is made up of 16 lines. The DQ bus is mapped directly to -dq_ah. The address bus is mapped in order to the lower bits of dq_ah. Finally, -the bank address bus is mapped to the higher bits of dq_ah. - -Where the Address bus is 13 bits wide and the bank address is 2 bits wide -the following setup is in place:: +.. code-block:: cmake - dq_ah[15:0] = DQ[15:0] - dq_ah[12:0] = A[12:0] - dq_ah[14:13] = BA[1:0] + set(APP_DEPENDENT_MODULES "lib_sdram") -The number of address bits plus the number of bank address bits must not exceed 16. +.. note:: Dependent modules should be pinned to release versions where possible, otherwise the + latest commit on the `develop` branch will be used. For further details on managing modules, + pinning to a release version and other options, please see the page `xcommon-cmake Dependency Management `_. -The DQM signal(s) is connected to the NOR of WE and CAS. An example of a suitable -part is the TI SN74LVC1G02. In the case that the DQM is separated into high -and low components then the output from the NOR is connected to both high and low DQM. +All ``lib_sdram`` functions can be accessed via the ``sdram.h`` header file, for example: -This library assumes that CS is pulled low, i.e. the SDRAM is always selected. If -control of the CS is needed then it must be done from the client application -level. This means that for the duration of the use of the SDRAM, CS must -be asserted and when ``sdram_server`` is shutdown the CS can be deasserted. +.. code-block:: C + #include "sdram.h" SDRAM API ---------- - -All SDRAM functions can be accessed via the ``sdram.h`` header:: - - #include - -You also have to add ``lib_sdram`` to the -``USED_MODULES`` field of your application Makefile. +========= SDRAM server and client are instantiated as concurrent tasks that run in a ``par`` statement. The client (your application) connects to the SDRAM server via @@ -121,7 +78,9 @@ delays are set to maximize the read window. See the code in ``server.xc`` for fu For example, the following code instantiates an SDRAM server running at 62.5MHz -and connects an application to it:: +and connects an application to it: + +.. code-block:: C out buffered port:32 sdram_dq_ah = XS1_PORT_16A; out buffered port:32 sdram_cas = XS1_PORT_1B; @@ -155,8 +114,8 @@ and connects an application to it:: return 0; } -**Note**: The client and SDRAM server must be on the same tile as the -line buffers are transferred by moving pointers from one task to another. +.. note:: The client and SDRAM server must be on the same tile as the + line buffers are transferred by moving pointers from one task to another. The SDRAM library uses movable pointers to pass buffers between the client and the server. This means that if the client passes a buffer in on-chip RAM to the @@ -167,13 +126,15 @@ a movable pointer as an argument. To return the pointer to the client the client must call ``sdram_complete`` which will take back ownership of the pointer when the SDRAM server has finished processing the command. -``sdram_complete`` can be selected to allow the client to event on data +``sdram_complete`` can be selected to allow the client to event on data becoming ready or completing a write. Client/Server model -................... +=================== + +The SDRAM server must be instantiated at the same level as its clients. For example -The SDRAM server must be instantiated at the same level as its clients. For example:: +.. code-block:: C streaming chan c_sdram[1]; par { @@ -182,7 +143,9 @@ The SDRAM server must be instantiated at the same level as its clients. For exam } would be the minimum required to correctly setup the SDRAM server and connect it to a -client. An example of a multi-client system would be:: +client. An example of a multi-client system would be + +.. code-block:: C streaming chan c_sdram[4]; par { @@ -194,7 +157,7 @@ client. An example of a multi-client system would be:: } Command buffering -................. +================= The SDRAM server implements an 8 slot command buffer per client. This means that the client can queue up to 8 commands to the SDRAM server through calls to ``sdram_read`` @@ -206,12 +169,14 @@ Commands are processed as in a first in first out ordering. Initialization -.............. +============== Each client of the SDRAM server must declare the structure ``s_sdram_state`` only once and call ``sdram_init_state``. This does all the required setup for the command buffering. From here on the client can call ``sdram_read`` and ``sdram_write`` to access the physical memory. -For example:: +For example + +.. code-block:: C s_sdram_state sdram_state; sdram_init_state(c_server, sdram_state); @@ -220,12 +185,14 @@ where ``c_server`` is the streaming channel to the ``sdram_server``. Safety through the use of movable pointers -.......................................... +------------------------------------------ The API makes use of movable pointers to aid correct multi-threaded memory handling. ``sdram_read`` and ``sdram_write`` pass ownership of the memory from the client to the server. The client is no longer able to access the memory. The memory ownership -is returned to the client on a call return from ``sdram_complete``. For example:: +is returned to the client on a call return from ``sdram_complete``. For example + +.. code-block:: C unsigned buffer[N]; unsigned * movable buffer_pointer = buffer; @@ -249,7 +216,9 @@ is returned to the client on a call return from ``sdram_complete``. For example: During the scope of the movable pointer variable the pointer can point at any memory location, however, at the end of the scope the pointer must point at its original instantiation. -For example the following is acceptable:: +For example the following is acceptable + +.. code-block:: C { unsigned buffer_0[N]; @@ -267,7 +236,9 @@ For example the following is acceptable:: } but the following is not as the movable pointers are no longer -point at the same memory when leaving scope as they were when they were instantiated:: +point at the same memory when leaving scope as they were when they were instantiated + +.. code-block:: C { unsigned buffer_0[N]; @@ -286,43 +257,188 @@ point at the same memory when leaving scope as they were when they were instanti Shutdown -........ +-------- The ``sdram_server`` may be shutdown, i.e. the thread and all its resources may be freed, with a call to ``sdram_shutdown``. Memory allocator API --------------------- +==================== The purpose of this library is to allow multiple tasks to share a common memory address space. All of the clients may request a number of bytes from the memory space and will either be allocated a base address to use the requested amount of memory from or will receive an error. All clients of the memory address allocator must be on the same tile. -API ---- +|newpage| -.. doxygenfunction:: sdram_server -.. doxygenfunction:: sdram_init_state -.. doxygenfunction:: sdram_complete -.. doxygenfunction:: sdram_write -.. doxygenfunction:: sdram_read -.. doxygenfunction:: sdram_shutdown +************************ +Hardware characteristics +************************ -.. doxygeninterface:: memory_address_allocator_i -.. doxygenfunction:: memory_address_allocator +The signals from the xCORE required to drive an SDRAM are: + +.. _sdram_wire_table: + +.. list-table:: SDRAM data and signal wires + :class: vertical-borders horizontal-borders + + * - *Clock* + - Clock line, the master clock the SDRAM uses for + sampling all the other signals. + * - *DQ_AH* + - The 16-bit data bus and address bus multiplexed, + see below. + * - *WE* + - Write enable(Inverted). + * - *RAS* + - The row address strobe(Inverted). + * - *CAS* + - The coloumn address strobe(Inverted). + +Because of the multiplexing attention must paid to the +physical wiring of the SDRAM to the xCORE. + +A typical 256Mb SDRAM requires the following signals: + +* CLK - Clock +* CKE - Clock Enable +* CS - Chip Select +* RAS - Row Address Strobe +* CAS - Col Address Strobe +* WE - Write Enable +* DQ[15:0] - Data +* DQM - Data Input/Output Mask +* A[12:0] - Address +* BA[1:0] - Bank Address + +.. figure:: images/sdram_hookup.pdf + :width: 80% + + Example connection between xCORE to 256Mb SDRAM + + +The exact count of Address lines and Bank Address line may vary. The examples in this document assume a 256Mb SDRAM device. +This library is designed to work with a fixed 16 bit SDRAM data bus, although the API provides data in long words (32 bit). + +The dq_ah bus is made up of 16 lines. The DQ bus is mapped directly to +dq_ah. The address bus is mapped in order to the lower bits of dq_ah. Finally, +the bank address bus is mapped to the higher bits of dq_ah. + +Where the Address bus is 13 bits wide and the bank address is 2 bits wide +the following setup is in place:: + + dq_ah[15:0] = DQ[15:0] + dq_ah[12:0] = A[12:0] + dq_ah[14:13] = BA[1:0] + +The number of address bits plus the number of bank address bits must not exceed 16. + +The DQM signal(s) is connected to the NOR of WE and CAS. An example of a suitable +part is the TI SN74LVC1G02. In the case that the DQM is separated into high +and low components then the output from the NOR is connected to both high and low DQM. + +This library assumes that CS is pulled low, i.e. the SDRAM is always selected. If +control of the CS is needed then it must be done from the client application +level. This means that for the duration of the use of the SDRAM, CS must +be asserted and when ``sdram_server`` is shutdown the CS can be deasserted. + +|newpage| + +******************* +Example application +******************* + +Overview +======== +The example uses the XMOS SDRAM library to accesses memory on the SDRAM. The purpose of this application +is to show how data is written to and read from the SDRAM in a safe manner. + +The example is running on the SLICEKIT-XC200-X1 with XA-SK-SDRAM + +Building the example +==================== + +This section assumes that the `XMOS XTC Tools `_ have been +downloaded and installed. The required version is specified in the accompanying ``README``. + +Installation instructions can be found `here `_. + +Special attention should be paid to the section on +`Installation of Required Third-Party Tools `_. + +The application is built using the `xcommon-cmake `_ +build system, which is provided with the XTC tools and is based on `CMake `_. + +The ``lib_sdram`` software ZIP package should be downloaded and extracted to a chosen working +directory. + +To configure the build, the following commands should be run from an XTC command prompt: + +.. code-block:: bash + + cd lib_sdram/examples/app_sdram_demo + cmake -G "Unix Makefiles" -B build + +If any dependencies are missing they will be retrieved automatically during this step. + +The application binaries should then be built using ``xmake``: + +.. code-block:: bash + + xmake -j -C build + +Binary artifacts (.xe files) will be generated under the appropriate subdirectories of the +``app_sdram/bin`` directory — one for each supported build configuration. + +For subsequent builds, the ``cmake`` step may be omitted. +If ``CMakeLists.txt`` or other build files are modified, ``cmake`` will be re-run automatically +by ``xmake`` as needed. + +Running the example +=================== + +From an XTC command prompt, the following command should be run from the ``examples/app_sdram_demo`` +directory: + +.. code-block:: bash + + xrun ./bin/app_sdram_demo.xe + +Alternatively, the application can be programmed into flash memory for standalone execution: + +.. code-block:: bash + + xflash ./bin/app_sdram_demo.xe |newpage| -|appendix| +************* +API Reference +************* + +All ``lib_sdram`` functions can be accessed via the ``sdram.h`` header file: + +.. code-block:: C + + #include "sdram.h" + +You will also have to add ``lib_sdram`` to the application's APP_DEPENDENT_MODULES list in CMakeLists.txt, for example: + +.. code-block:: cmake + + set(APP_DEPENDENT_MODULES "lib_sdram") -Known Issues ------------- - - - XS1 devices can support a maximum of 64 Mb SDRAM (8 MBytes) using a 8b column address. This is a technical limitation due to addressing modes in the XS1 device and cannot be worked around using the current library architecture. - - XS2 (xCORE-200) devices can support a maximum of 256 Mb SDRAM (32 MBytes) using a 9b column address. 512 Mb devices are supportable with some modifications. Please see the following github issue https://github.com/xmos/lib_sdram/issues/20 for details. - - No Application note is provided currently. Please see https://github.com/xmos/lib_sdram/examples for a simple usage example - - The IP assumes a 500MHz core clock. It may be possible to support other core clock frequencies. However, the I/O timing must be re-calculated to populate the read delay constants for the apprioriate clock divider. These may be found in ``server.xc``. -.. include:: ../../../CHANGELOG.rst +.. doxygenfunction:: sdram_server + +.. doxygenfunction:: sdram_init_state + +.. doxygenfunction:: sdram_complete + +.. doxygenfunction:: sdram_write + +.. doxygenfunction:: sdram_read + +.. doxygenfunction:: sdram_shutdown diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..a1891d1 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(lib_sdram_examples) +add_subdirectory(app_sdram_demo) \ No newline at end of file diff --git a/examples/app_sdram_demo/CMakeLists.txt b/examples/app_sdram_demo/CMakeLists.txt new file mode 100644 index 0000000..87b044e --- /dev/null +++ b/examples/app_sdram_demo/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(sdram_demo) + +set(APP_HW_TARGET SLICEKIT-XC200-X1.xn) + +set(APP_DEPENDENT_MODULES "lib_sdram") +set(APP_COMPILER_FLAGS -g -O2) + +set(APP_PCA_ENABLE ON) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +XMOS_REGISTER_APP() \ No newline at end of file diff --git a/examples/sdram_demo/README.rst b/examples/app_sdram_demo/README.rst similarity index 90% rename from examples/sdram_demo/README.rst rename to examples/app_sdram_demo/README.rst index c8ac14e..54ec233 100644 --- a/examples/sdram_demo/README.rst +++ b/examples/app_sdram_demo/README.rst @@ -7,4 +7,4 @@ Slicekit SDRAM Simple Demo :boards: XA-SK-SDRAM The purpose of this application is to show how data is written to and read from -the SDRAM in a safe manner. +the SDRAM in a safe manner. \ No newline at end of file diff --git a/examples/sdram_demo/SLICEKIT-XC200-X1.xn b/examples/app_sdram_demo/SLICEKIT-XC200-X1.xn similarity index 100% rename from examples/sdram_demo/SLICEKIT-XC200-X1.xn rename to examples/app_sdram_demo/SLICEKIT-XC200-X1.xn diff --git a/examples/sdram_demo/config.xscope b/examples/app_sdram_demo/config.xscope similarity index 100% rename from examples/sdram_demo/config.xscope rename to examples/app_sdram_demo/config.xscope diff --git a/examples/sdram_demo/src/sdram_demo.xc b/examples/app_sdram_demo/src/sdram_demo.xc similarity index 99% rename from examples/sdram_demo/src/sdram_demo.xc rename to examples/app_sdram_demo/src/sdram_demo.xc index 0f0b5ef..5cefa59 100644 --- a/examples/sdram_demo/src/sdram_demo.xc +++ b/examples/app_sdram_demo/src/sdram_demo.xc @@ -1,4 +1,4 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/sdram_demo/.cproject b/examples/sdram_demo/.cproject deleted file mode 100644 index 0cfdae0..0000000 --- a/examples/sdram_demo/.cproject +++ /dev/null @@ -1,980 +0,0 @@ - - - - - - - - - - - - - - - - - xmake - - all - true - true - true - - - xmake - - clean - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/sdram_demo/.project b/examples/sdram_demo/.project deleted file mode 100644 index 9dd4c80..0000000 --- a/examples/sdram_demo/.project +++ /dev/null @@ -1,90 +0,0 @@ - - - app_sdram_demo - - - - - - com.xmos.cdt.core.LegacyProjectCheckerBuilder - - - - - com.xmos.cdt.core.ModulePathBuilder - - - - - com.xmos.cdt.core.ProjectInfoSyncBuilder - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?children? - ?name?=outputEntries\|?children?=?name?=entry\\\\|\\|\|| - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.buildArguments - CONFIG=Debug - - - org.eclipse.cdt.make.core.buildCommand - xmake - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - false - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - com.xmos.cdt.core.XdeProjectNature - - diff --git a/examples/sdram_demo/.xproject b/examples/sdram_demo/.xproject deleted file mode 100644 index f0ad1ef..0000000 --- a/examples/sdram_demo/.xproject +++ /dev/null @@ -1,3 +0,0 @@ - -examples - \ No newline at end of file diff --git a/examples/sdram_demo/LICENSE.rst b/examples/sdram_demo/LICENSE.rst deleted file mode 100644 index ca48f20..0000000 --- a/examples/sdram_demo/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** 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 XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/sdram_demo/Makefile b/examples/sdram_demo/Makefile deleted file mode 100644 index 0f74d3b..0000000 --- a/examples/sdram_demo/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling -ifeq ($(CONFIG), xs2) - TARGET = SLICEKIT-XC200-X1 -endif -ifeq ($(CONFIG), xs1) - TARGET = SLICEKIT-A16 -endif - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = sdram_demo - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_sdram - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -BUILD_FLAGS = -g -O2 - -#xCORE200 slicekit -XCC_FLAGS_xs2 = $(BUILD_FLAGS) -INCLUDE_ONLY_IN_xs2 = -#XS1-A slicekit -XCC_FLAGS_xs1 = $(BUILD_FLAGS) -INCLUDE_ONLY_IN_xs1 = - -# The VERBOSE variable, if set to 1, enables verbose output from the make system. -VERBOSE = 0 - -sim_xs2: bin/xs2/sdram_demo_xs2.xe - xsim bin/xs2/sdram_demo_xs2.xe --max-cycles 1000000 \ - --trace-plugin VcdPlugin.dll '-tile tile[0] -o trace.vcd -xe bin/xs2/sdram_demo_xs2.xe -ports-detailed -clock-blocks' \ - #--xscope "-offline trace.xmt" \ - #--trace-to trace.txt - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/lib_sdram/.cproject b/lib_sdram/.cproject deleted file mode 100644 index 3f6efce..0000000 --- a/lib_sdram/.cproject +++ /dev/null @@ -1,969 +0,0 @@ - - - - - - - - - - - - - - - - - xmake - -f .makefile - all - true - true - true - - - xmake - -f .makefile - clean - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib_sdram/.makefile b/lib_sdram/.makefile deleted file mode 100644 index 87b347b..0000000 --- a/lib_sdram/.makefile +++ /dev/null @@ -1,8 +0,0 @@ -all: - @echo "** Module only - only builds as part of application **" - - -clean: - @echo "** Module only - only builds as part of application **" - - diff --git a/lib_sdram/.project b/lib_sdram/.project deleted file mode 100644 index 58b3c5a..0000000 --- a/lib_sdram/.project +++ /dev/null @@ -1,100 +0,0 @@ - - - lib_sdram - - - - - - com.xmos.cdt.core.LegacyProjectCheckerBuilder - - - - - com.xmos.cdt.core.ProjectCheckerBuilder - - - - - com.xmos.cdt.core.BuildMarkersBuilder - - - - - com.xmos.cdt.core.ModulePathBuilder - - - - - com.xmos.cdt.core.ProjectInfoSyncBuilder - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?children? - ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\|| - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.buildArguments - -f .makefile - - - org.eclipse.cdt.make.core.buildCommand - xmake - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - false - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - com.xmos.cdt.core.XdeProjectNature - - diff --git a/lib_sdram/.xproject b/lib_sdram/.xproject deleted file mode 100644 index 7dd03a6..0000000 --- a/lib_sdram/.xproject +++ /dev/null @@ -1,4 +0,0 @@ - -lib_sdram -3.0.0dd63c031d27 - \ No newline at end of file diff --git a/lib_sdram/api/memory_address_allocator.h b/lib_sdram/api/memory_address_allocator.h index 0789b9d..3b9c2a1 100644 --- a/lib_sdram/api/memory_address_allocator.h +++ b/lib_sdram/api/memory_address_allocator.h @@ -1,4 +1,4 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef MEMORY_ALLOCATOR_H_ #define MEMORY_ALLOCATOR_H_ diff --git a/lib_sdram/api/sdram.h b/lib_sdram/api/sdram.h index 04f2bec..4b17e54 100644 --- a/lib_sdram/api/sdram.h +++ b/lib_sdram/api/sdram.h @@ -1,10 +1,19 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef SDRAM_H_ #define SDRAM_H_ #include +#include #include "structs_and_enums.h" +// These are needed for DOXYGEN to render properly +#ifndef __DOXYGEN__ +#define const_static_unsigned_t const static unsigned +#define out_port_t out port +#define MOVABLE_REFERENCE_PARAM(type, name) type * movable &name +#define MOVABLE_PARAM(type, name) type * movable name +#endif + /** * The actual SDRAM server providing a software interface plus services to access the SDRAM. * This provides the software interface to the physical SDRAM. It provides services including: @@ -33,23 +42,24 @@ * \param refresh_cycles The count of refresh instructions per full refresh cycle. * \param clock_divider The divider of the system clock to the SDRAM clock. **/ -void sdram_server(streaming chanend c_client[client_count], - const static unsigned client_count, - out buffered port:32 dq_ah, - out buffered port:32 cas, - out buffered port:32 ras, - out buffered port:8 we, - out port clk, +void sdram_server( + ARRAY_OF_SIZE(streaming_chanend_t, c_client, client_count), + const_static_unsigned_t client_count, + out_buffered_port_32_t dq_ah, + out_buffered_port_32_t cas, + out_buffered_port_32_t ras, + out_buffered_port_8_t we, + out_port_t clk, clock cb, - const static unsigned cas_latency, - const static unsigned row_words, - const static unsigned col_bits, - const static unsigned col_address_bits, - const static unsigned row_address_bits, - const static unsigned bank_address_bits, - const static unsigned refresh_ms, - const static unsigned refresh_cycles, - const static unsigned clock_divider); + const_static_unsigned_t cas_latency, + const_static_unsigned_t row_words, + const_static_unsigned_t col_bits, + const_static_unsigned_t col_address_bits, + const_static_unsigned_t row_address_bits, + const_static_unsigned_t bank_address_bits, + const_static_unsigned_t refresh_ms, + const_static_unsigned_t refresh_cycles, + const_static_unsigned_t clock_divider); /** * This is used to initialise the sdram_state that follows the channel to the SDRAM server. It must only be called @@ -61,7 +71,7 @@ void sdram_server(streaming chanend c_client[client_count], * * \return None. **/ -void sdram_init_state(streaming chanend c_sdram_server, s_sdram_state &sdram_state); +void sdram_init_state(streaming_chanend_t c_sdram_server, REFERENCE_PARAM(s_sdram_state, sdram_state)); /** * This is a blocking call that may be used as a select handler. It returns an array @@ -69,7 +79,10 @@ void sdram_init_state(streaming chanend c_sdram_server, s_sdram_state &sdram_sta * server. **/ #pragma select handler -void sdram_complete(streaming chanend c_sdram_server, s_sdram_state &state, unsigned * movable & buffer); +void sdram_complete( + streaming_chanend_t c_sdram_server, + REFERENCE_PARAM(s_sdram_state, state), + MOVABLE_REFERENCE_PARAM(unsigned, buffer)); /** * Request the SDRAM server to perform a write operation of a number of long (32b) words. @@ -84,8 +97,12 @@ void sdram_complete(streaming chanend c_sdram_server, s_sdram_state &state, unsi * \return 0 for write command has successfully be added to SDRAM command queue. * \return 1 for SDRAM command queue is full, write command has not been added. **/ -int sdram_write (streaming chanend c_sdram_server, s_sdram_state &state, unsigned address, unsigned word_count, - unsigned * movable buffer); +int sdram_write( + streaming_chanend_t c_sdram_server, + REFERENCE_PARAM(s_sdram_state, state), + unsigned address, + unsigned word_count, + MOVABLE_PARAM(unsigned, buffer)); /** * Request the SDRAM server to perform a read operation of a number of long (32b) words. @@ -101,8 +118,12 @@ int sdram_write (streaming chanend c_sdram_server, s_sdram_state &state, unsig * \return 1 for SDRAM command queue is full, read command has not been added. * **/ -int sdram_read (streaming chanend c_sdram_server, s_sdram_state &state, unsigned address, unsigned word_count, - unsigned * movable buffer); +int sdram_read( + streaming_chanend_t c_sdram_server, + REFERENCE_PARAM(s_sdram_state, state), + unsigned address, + unsigned word_count, + MOVABLE_PARAM(unsigned, buffer)); /** * Terminates the SDRAM server. @@ -111,6 +132,6 @@ int sdram_read (streaming chanend c_sdram_server, s_sdram_state &state, unsig * * \return None. **/ -void sdram_shutdown(streaming chanend c_sdram_server); +void sdram_shutdown(streaming_chanend_t c_sdram_server); #endif /* SDRAM_H_ */ diff --git a/lib_sdram/doc/rst/xdoc.conf b/lib_sdram/doc/rst/xdoc.conf deleted file mode 100644 index d747ef4..0000000 --- a/lib_sdram/doc/rst/xdoc.conf +++ /dev/null @@ -1,4 +0,0 @@ -XMOSNEWSTYLE=1 -DOXYGEN_DIRS=../../api - - diff --git a/lib_sdram/lib_build_info.cmake b/lib_sdram/lib_build_info.cmake new file mode 100644 index 0000000..bb95b93 --- /dev/null +++ b/lib_sdram/lib_build_info.cmake @@ -0,0 +1,13 @@ +set(LIB_NAME lib_sdram) +set(LIB_VERSION 3.4.0) +set(LIB_INCLUDES api src) + +set(LIB_DEPENDENT_MODULES "") + +set(LIB_COMPILER_FLAGS -O3 + -Wno-unusual-code + -fasm-linenum + -fcomment-asm + -g) + +XMOS_REGISTER_MODULE() \ No newline at end of file diff --git a/lib_sdram/module_build_info b/lib_sdram/module_build_info deleted file mode 100644 index e07b9dd..0000000 --- a/lib_sdram/module_build_info +++ /dev/null @@ -1,15 +0,0 @@ -# You can set flags specifically for your module by using the MODULE_XCC_FLAGS -# variable. So the following -# -# MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3 -# -# specifies that everything in the modules should have the application -# build flags with -O3 appended (so the files will build at -# optimization level -O3). -# -# You can also set MODULE_XCC_C_FLAGS, MODULE_XCC_XC_FLAGS etc.. - -MODULE_XCC_XC_FLAGS = $(XCC_XC_FLAGS) - - -VERSION = 3.3.0 diff --git a/lib_sdram/module_description b/lib_sdram/module_description deleted file mode 100644 index 00a6de4..0000000 --- a/lib_sdram/module_description +++ /dev/null @@ -1 +0,0 @@ -One line module description. diff --git a/lib_sdram/src/client.xc b/lib_sdram/src/client.xc index bc1e9ab..980b8ca 100644 --- a/lib_sdram/src/client.xc +++ b/lib_sdram/src/client.xc @@ -1,4 +1,4 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include //#include diff --git a/lib_sdram/src/control.h b/lib_sdram/src/control.h index ca1cfd0..9dde81a 100644 --- a/lib_sdram/src/control.h +++ b/lib_sdram/src/control.h @@ -1,4 +1,4 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef SDRAM_CONTROL_H_ #define SDRAM_CONTROL_H_ diff --git a/lib_sdram/src/io.S b/lib_sdram/src/io.S index 770a1ac..dc0a4d0 100644 --- a/lib_sdram/src/io.S +++ b/lib_sdram/src/io.S @@ -1,4 +1,4 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. .text #ifdef __XS2A__ diff --git a/lib_sdram/src/memory_address_allocator.xc b/lib_sdram/src/memory_address_allocator.xc index c45bdd2..da34ae4 100644 --- a/lib_sdram/src/memory_address_allocator.xc +++ b/lib_sdram/src/memory_address_allocator.xc @@ -1,4 +1,4 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include //#include diff --git a/lib_sdram/src/server.xc b/lib_sdram/src/server.xc index 0fc5b22..d8a7879 100644 --- a/lib_sdram/src/server.xc +++ b/lib_sdram/src/server.xc @@ -1,4 +1,4 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/lib_sdram/src/structs_and_enums.h b/lib_sdram/src/structs_and_enums.h index 88cb43b..0b7caa4 100644 --- a/lib_sdram/src/structs_and_enums.h +++ b/lib_sdram/src/structs_and_enums.h @@ -1,4 +1,4 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef STRUCTS_AND_ENUMS_H_ #define STRUCTS_AND_ENUMS_H_ diff --git a/settings.yml b/settings.yml new file mode 100644 index 0000000..209236a --- /dev/null +++ b/settings.yml @@ -0,0 +1,27 @@ +# This file relates to internal XMOS infrastructure and should be ignored by external users +--- +lib_name: lib_sdram +project: '{{lib_name}}' +title: '{{lib_name}}: SDRAM library' +version: 3.4.0 + +documentation: + exclude_patterns_path: doc/exclude_patterns.inc + root_doc: doc/rst/lib_sdram.rst + linkcheck_ignore_regex: [''] + latex_toc_depth: 3 + latex_secnum_depth: 3 + cognidox_part_number: XM-006978-UG + doxygen_projects: + lib_sdram: + doxyfile_path: doc/Doxyfile.inc + pdfs: + doc/rst/lib_sdram.rst: + pdf_title: '{{title}}' + pdf_filename: '{{lib_name}}_v{{version}}' + README.rst: + pdf_title: '{{title}} (README)' + pdf_filename: '{{lib_name}}_v{{version}}_readme' + pdf_short: yes +software: + cognidox_part_number: XM-006978-SM \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..262080f --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(lib_sdram_tests) + +add_subdirectory(sdram_benchmark) +add_subdirectory(sdram_multi_client_test) +add_subdirectory(sdram_testbench) \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..a42e246 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,17 @@ +# Copyright 2025 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. +import pytest + +@pytest.fixture +def level(request): + return request.config.getoption("--level") + +def pytest_addoption(parser): + + parser.addoption( + "--level", + action="store", + default="smoke", + choices=["smoke", "default", "extended"], + help="Test coverage level", + ) \ No newline at end of file diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 0000000..79cc0a2 --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,35 @@ +# python_version 3.12.1 +# pip_version 24.* +# +# The parse_versions_from_versions_file() function in the createVenv.groovy +# file of the Jenkins Shared Library uses the python_version comment to set +# the version of python used. + +# Distributed (released) dependencies +# +# The python modules listed below specify a known working combination required +# by the python code in this repository. The procedure used to set up a +# suitable python environment for it installs the version of each module in +# the list. Using a specific version ensures a controlled infrastructure for +# development, testing and release of this repository. +# +# Another repository might depend on python code defined in this one. The +# procedure to set up a suitable python environment for that repository may +# pip-install this one as editable using this repository's pyproject.toml file. +# The same modules should appear in the pyproject.toml list as given below. +pytest==8.3.3 +pytest-xdist==3.6.1 + +# Development dependencies +# +# Each link listed below specifies the path to a pyproject.toml file which are +# installed in editable mode with '-e $PATH' (without the quotes). +# +# If python code in this repository depends on python code under development +# in another repository, then an entry for that other respository should +# appear in this list instead of the released dependencies list. +# +# If this repository uses the setup functionality (e.g., script entry points) +# of its own pyproject.toml file, then this list must include an entry for that +# pyproject.toml file, e.g., '-e .' or '-e ./python' (without the quotes). +-e git+ssh://git@github.com/xmos/test_support.git@961532d89a98b9df9ccbce5abd0d07d176ceda40#egg=test_support \ No newline at end of file diff --git a/tests/sdram_benchmark/.cproject b/tests/sdram_benchmark/.cproject deleted file mode 100644 index b2f585b..0000000 --- a/tests/sdram_benchmark/.cproject +++ /dev/null @@ -1,982 +0,0 @@ - - - - - - - - - - - - - - - - - - - xmake - - all - true - true - true - - - xmake - - clean - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/sdram_benchmark/.project b/tests/sdram_benchmark/.project deleted file mode 100644 index d02b7bb..0000000 --- a/tests/sdram_benchmark/.project +++ /dev/null @@ -1,90 +0,0 @@ - - - sdram_benchmark - - - - - - com.xmos.cdt.core.ProjectInfoSyncBuilder - - - - - com.xmos.cdt.core.LegacyProjectCheckerBuilder - - - - - com.xmos.cdt.core.ModulePathBuilder - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?children? - ?name?=outputEntries\|?children?=?name?=entry\\\\|\\|\|| - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.buildArguments - CONFIG=Debug - - - org.eclipse.cdt.make.core.buildCommand - xmake - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - false - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - com.xmos.cdt.core.XdeProjectNature - - diff --git a/tests/sdram_benchmark/.xproject b/tests/sdram_benchmark/.xproject deleted file mode 100644 index 90538ad..0000000 --- a/tests/sdram_benchmark/.xproject +++ /dev/null @@ -1,3 +0,0 @@ - -tests - \ No newline at end of file diff --git a/tests/sdram_benchmark/CMakeLists.txt b/tests/sdram_benchmark/CMakeLists.txt new file mode 100644 index 0000000..7968d21 --- /dev/null +++ b/tests/sdram_benchmark/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(sdram_benchmark) + +set(APP_HW_TARGET SLICEKIT-XC200-X1.xn) + +set(APP_DEPENDENT_MODULES "lib_sdram") +set(APP_INCLUDES src) +set(APP_COMPILER_FLAGS -g -O2) + +set(APP_PCA_ENABLE ON) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +XMOS_REGISTER_APP() \ No newline at end of file diff --git a/tests/sdram_benchmark/Makefile b/tests/sdram_benchmark/Makefile deleted file mode 100644 index 270cc93..0000000 --- a/tests/sdram_benchmark/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling -TARGET = SLICEKIT-XC200-X1 - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = sdram_benchmark - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_sdram - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS = -g -O2 - -# The VERBOSE variable, if set to 1, enables verbose output from the make system. -VERBOSE = 0 - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/tests/sdram_benchmark/src/sdram_bench.xc b/tests/sdram_benchmark/src/sdram_bench.xc index c081301..1ca4170 100644 --- a/tests/sdram_benchmark/src/sdram_bench.xc +++ b/tests/sdram_benchmark/src/sdram_bench.xc @@ -1,4 +1,4 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/tests/sdram_multi_client_test/.cproject b/tests/sdram_multi_client_test/.cproject deleted file mode 100644 index dc4acbc..0000000 --- a/tests/sdram_multi_client_test/.cproject +++ /dev/null @@ -1,982 +0,0 @@ - - - - - - - - - - - - - - - - - - - xmake - - all - true - true - true - - - xmake - - clean - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/sdram_multi_client_test/.project b/tests/sdram_multi_client_test/.project deleted file mode 100644 index 693a5e7..0000000 --- a/tests/sdram_multi_client_test/.project +++ /dev/null @@ -1,90 +0,0 @@ - - - sdram_multi_client_test - - - - - - com.xmos.cdt.core.ProjectInfoSyncBuilder - - - - - com.xmos.cdt.core.LegacyProjectCheckerBuilder - - - - - com.xmos.cdt.core.ModulePathBuilder - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?children? - ?name?=outputEntries\|?children?=?name?=entry\\\\|\\|\|| - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.buildArguments - CONFIG=Debug - - - org.eclipse.cdt.make.core.buildCommand - xmake - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - false - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - com.xmos.cdt.core.XdeProjectNature - - diff --git a/tests/sdram_multi_client_test/CMakeLists.txt b/tests/sdram_multi_client_test/CMakeLists.txt new file mode 100644 index 0000000..b78805c --- /dev/null +++ b/tests/sdram_multi_client_test/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(sdram_multi_client_test) + +set(APP_HW_TARGET SLICEKIT-XC200-X1.xn) + +set(APP_DEPENDENT_MODULES "lib_sdram") +set(APP_INCLUDES src) +set(APP_COMPILER_FLAGS -g -O2) + +set(APP_PCA_ENABLE ON) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +XMOS_REGISTER_APP() \ No newline at end of file diff --git a/tests/sdram_multi_client_test/Makefile b/tests/sdram_multi_client_test/Makefile deleted file mode 100644 index c131fdc..0000000 --- a/tests/sdram_multi_client_test/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling -TARGET = SLICEKIT-XC200-X1 - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = sdram_multi_client_test - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_sdram - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS = -O2 -g - -# The XCORE_ARM_PROJECT variable, if set to 1, configures this -# project to create both xCORE and ARM binaries. -XCORE_ARM_PROJECT = 0 - -# The VERBOSE variable, if set to 1, enables verbose output from the make system. -VERBOSE = 0 - -XMOS_MAKE_PATH ?= ../.. --include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/tests/sdram_multi_client_test/src/sdram_multi_client_test.xc b/tests/sdram_multi_client_test/src/sdram_multi_client_test.xc index 37e0ede..c8fd824 100644 --- a/tests/sdram_multi_client_test/src/sdram_multi_client_test.xc +++ b/tests/sdram_multi_client_test/src/sdram_multi_client_test.xc @@ -1,4 +1,4 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/tests/sdram_testbench/.cproject b/tests/sdram_testbench/.cproject deleted file mode 100644 index eb80a3e..0000000 --- a/tests/sdram_testbench/.cproject +++ /dev/null @@ -1,982 +0,0 @@ - - - - - - - - - - - - - - - - - - - xmake - - all - true - true - true - - - xmake - - clean - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/sdram_testbench/.project b/tests/sdram_testbench/.project deleted file mode 100644 index 5a0aab5..0000000 --- a/tests/sdram_testbench/.project +++ /dev/null @@ -1,90 +0,0 @@ - - - sdram_testbench - - - - - - com.xmos.cdt.core.ProjectInfoSyncBuilder - - - - - com.xmos.cdt.core.LegacyProjectCheckerBuilder - - - - - com.xmos.cdt.core.ModulePathBuilder - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?children? - ?name?=outputEntries\|?children?=?name?=entry\\\\|\\|\|| - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.buildArguments - CONFIG=Debug - - - org.eclipse.cdt.make.core.buildCommand - xmake - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - false - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - com.xmos.cdt.core.XdeProjectNature - - diff --git a/tests/sdram_testbench/CMakeLists.txt b/tests/sdram_testbench/CMakeLists.txt new file mode 100644 index 0000000..66e8a48 --- /dev/null +++ b/tests/sdram_testbench/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.21) +include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake) +project(sdram_testbench) + +set(APP_HW_TARGET SLICEKIT-XC200-X1.xn) + +set(APP_DEPENDENT_MODULES "lib_sdram") +set(APP_INCLUDES src) +set(APP_COMPILER_FLAGS -g -O2) + +set(APP_PCA_ENABLE ON) + +set(XMOS_SANDBOX_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..) + +XMOS_REGISTER_APP() \ No newline at end of file diff --git a/tests/sdram_testbench/Makefile b/tests/sdram_testbench/Makefile deleted file mode 100644 index 5716035..0000000 --- a/tests/sdram_testbench/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling -TARGET = SLICEKIT-XC200-X1 - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = sdram_testbench - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_sdram - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS = -g -O2 - -# The VERBOSE variable, if set to 1, enables verbose output from the make system. -VERBOSE = 0 - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/tests/sdram_testbench/src/sdram_testbench.xc b/tests/sdram_testbench/src/sdram_testbench.xc index 01842b2..9b829f6 100644 --- a/tests/sdram_testbench/src/sdram_testbench.xc +++ b/tests/sdram_testbench/src/sdram_testbench.xc @@ -1,4 +1,4 @@ -// Copyright 2014-2021 XMOS LIMITED. +// Copyright 2014-2025 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/tests/test_sdram_benchmark.py b/tests/test_sdram_benchmark.py new file mode 100644 index 0000000..b65abc7 --- /dev/null +++ b/tests/test_sdram_benchmark.py @@ -0,0 +1,31 @@ +# Copyright 2025 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. + +import pytest +import Pyxsim +from Pyxsim import testers +from pathlib import Path + +def test_sdram_benchmark(level, capfd): + + if level == 'smoke': + pytest.skip("level == 'smoke'") + + binary = Path(__file__).parent / "sdram_benchmark" / "bin" / "sdram_benchmark.xe" + + tester = None + + max_cycles = 15000 + + simargs = [ + "--max-cycles", + str(max_cycles), + ] + + result = Pyxsim.run_on_simulator( + binary, + cmake=True, + simargs=simargs, + tester=tester, + capfd=capfd, + clean_before_build=False) \ No newline at end of file diff --git a/tests/test_sdram_multi_client_test.py b/tests/test_sdram_multi_client_test.py new file mode 100644 index 0000000..7ebb0cc --- /dev/null +++ b/tests/test_sdram_multi_client_test.py @@ -0,0 +1,31 @@ +# Copyright 2025 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. + +import pytest +import Pyxsim +from Pyxsim import testers +from pathlib import Path + +def test_sdram_multi_client_test(level, capfd): + + if level == 'smoke': + pytest.skip("level == 'smoke'") + + binary = Path(__file__).parent / "sdram_multi_client_test" / "bin" / "sdram_multi_client_test.xe" + + tester = None + + max_cycles = 15000 + + simargs = [ + "--max-cycles", + str(max_cycles), + ] + + result = Pyxsim.run_on_simulator( + binary, + cmake=True, + simargs=simargs, + tester=tester, + capfd=capfd, + clean_before_build=False) \ No newline at end of file diff --git a/tests/test_sdram_testbench.py b/tests/test_sdram_testbench.py new file mode 100644 index 0000000..58e27b6 --- /dev/null +++ b/tests/test_sdram_testbench.py @@ -0,0 +1,31 @@ +# Copyright 2025 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. + +import pytest +import Pyxsim +from Pyxsim import testers +from pathlib import Path + +def test_sdram_testbench(level, capfd): + + if level == 'smoke': + pytest.skip("level == 'smoke'") + + binary = Path(__file__).parent / "sdram_testbench" / "bin" / "sdram_testbench.xe" + + tester = None + + max_cycles = 15000 + + simargs = [ + "--max-cycles", + str(max_cycles), + ] + + result = Pyxsim.run_on_simulator( + binary, + cmake=True, + simargs=simargs, + tester=tester, + capfd=capfd, + clean_before_build=False) \ No newline at end of file