Skip to content
  1. Sep 25, 2024
  2. Sep 20, 2024
  3. Sep 19, 2024
  4. Sep 15, 2024
    • Reuben Cartwright's avatar
      tools: Fix script overwrite credentials behaviour · 177caff3
      Reuben Cartwright authored
      
      
      This commit makes the script correctly ask before overwriting
      credentials.
      Previously, the script checked for 'dummy_thingname' and the default
      endpoint in 'aws_clientcredential.h' and only asked if these defaults
      were not present.
      These strings occur in more than one place in the header file so so
      this check is not sufficient to say the credentials #define'd have not
      been modified by the user.
      This commit makes the script check the entirety of the #define line.
      
      Signed-off-by: default avatarReuben Cartwright <Reuben.Cartwright@arm.com>
      177caff3
    • Reuben Cartwright's avatar
      tools: Combine createIoTThings.py commands · eab88f16
      Reuben Cartwright authored
      
      
      Introduces a new command to `tools/scripts/createIoTThings.py` that
      1. Creates a Thing and Policy.
      2. Re-builds the target application (if required).
      3. Creates a Bucket, Role, and Update.
      This command is documented in `aws_tool.md`.
      
      During application building, the script prints '.' on the same line and
      flushes.
      
      The command only takes 2 command line arguments, with the rest
      specified in a .json file, an example of which is also included in This
      commit as well as the `aws_tool.md` documentation.
      Only 3 fields in `aws_tool.md` need to be filled in.
      
      The command also re-uses AWS entities where possible. E.g. if
      the Role specified already exists, it checks it can access the Bucket
      name provided before re-using the role.
      Using Roles not created by your current account is not supported,
      as the script may be unable to assume them to check access to the
      Bucket.
      
      The motivation for this commit is to make creating OTA updates
      easier.
      
      This commit also introduces a new command for cleaning up all
      AWS entities specified by the .json config file.
      This command is called `cleanup-simplified`.
      It will force-delete everything (including bucket contents). This
      is not configurable.
      
      Signed-off-by: default avatarReuben Cartwright <Reuben.Cartwright@arm.com>
      eab88f16
  5. Sep 10, 2024
    • Reuben Cartwright's avatar
      fix-protypes: Fix `mqtt_agent_task.h` prototypes · 4d6635f8
      Reuben Cartwright authored and Devaraj Ranganna's avatar Devaraj Ranganna committed
      
      
      The only public function declared in `mqtt_agent_task.c` is
      `vStartMqttAgentTask` as other functions were extracted to separate
      files in previous work.
      The prototypes for these other functions were left behind in
      `mqtt_agent_task.h`. This commit removes them.
      
      Also change `ota_agent_task.c` to include `events.h`, which is where
      these function prototypes were placed in previous work.
      
      Signed-off-by: default avatarReuben Cartwright <Reuben.Cartwright@arm.com>
      4d6635f8
    • Reuben Cartwright's avatar
      docs: Update unit testing documentation · 3fb3ab2d
      Reuben Cartwright authored and Devaraj Ranganna's avatar Devaraj Ranganna committed
      
      
      Provides additional details on how the directory structure is laid out
      for unit testing. Namely, the three types of `mocks` subdirectories
      and what each contains.
      Also fixes broken links due to mock subdirectory renaming.
      
      Signed-off-by: default avatarReuben Cartwright <Reuben.Cartwright@arm.com>
      3fb3ab2d
    • Reuben Cartwright's avatar
      mqtt-agent-task: Fix bugs in mqtt_agent_task · 3dab4b6c
      Reuben Cartwright authored and Devaraj Ranganna's avatar Devaraj Ranganna committed
      
      
      fix: prvGetRandomNumber does not use tick count if library function
      succeeds.
      fix: prvSocketDisconnect checks return value of Transport_Disconnect.
      fix: prvSocketDisconnect only sets mqtt as closed in system flags if
      closed successfully.
      fix: prvDisconnectFromMqttBroker errors on failure to disconnect socket.
      fix: when printing warning in prvIncomingPublishCallback, use buffer
      instead of writing to potentially read-only string.
      fix: transport_interface_api.h is only included in mqtt_agent_task.h if
      unit testing. The file is not findable from mqtt_agent_task.h
      outside of unit testing mode, but is needed to declare some of the
      functions tested.
      fix-style: include ordering in mqtt_agent_task.h.
      
      Signed-off-by: default avatarReuben Cartwright <Reuben.Cartwright@arm.com>
      3dab4b6c
    • Reuben Cartwright's avatar
      coremqtt-agent: Add MQTT Agent Task unit test · de09acd4
      Reuben Cartwright authored and Devaraj Ranganna's avatar Devaraj Ranganna committed
      
      
      Adds 44 unit tests.
      
      The CMakeLists.txt includes the mocks of header files of files
      belonging to this component so they can be mocked.
      This needs to be done before including ../inc.
      
      Signed-off-by: default avatarReuben Cartwright <Reuben.Cartwright@arm.com>
      de09acd4
    • Reuben Cartwright's avatar
      coremqtt-agent: Expose mqtt_agent_task.c statics · 2a3ca2cf
      Reuben Cartwright authored and Devaraj Ranganna's avatar Devaraj Ranganna committed
      
      
      This commit makes the static functions in mqtt_agent_task.c visible
      if the UNIT_TESTING macro is defined.
      This is done by:
      1.  Define the `STATIC` macro in the header.
      ```
      \#ifdef UNIT_TESTING
          #define STATIC /* as nothing */
      \#else
          #define STATIC static
      \#endif /* UNIT_TESTING */
      ```
      2. Add prototypes to the header.
      ```
      STATIC int foo(void);
      ```
      3. Remove all other function prototypes in the .c file.
      
      This is justified because:
      - These functions need to be tested.
      - Functions other than `vStartMqttAgentTask` cannot be refactored to be
      non-static, as only `vStartMqttAgentTask` should be called in another
      file.
      
      Signed-off-by: default avatarReuben Cartwright <Reuben.Cartwright@arm.com>
      2a3ca2cf
    • Reuben Cartwright's avatar
      coremqtt-mock: Add subset of functionalities · 4a4f28f2
      Reuben Cartwright authored and Devaraj Ranganna's avatar Devaraj Ranganna committed
      
      
      This commit expands mock coverage across the repo in order to test
      core_mqtt_agent.c and freertos-command-pool.c.
      Mock support is in the form of modifying CMakeLists.txt in
      connectivity, aws_iot, and security components.
      All .h and .c files needed by core-mqtt are also added.
      
      This commit renames the mock directories.
      Now mocks for libraries are contained in `library_mocks`
      subdirectories, and mocks for integration code in `integration_mocks`
      subdirectories.
      Only these folder names have changed, they are still in the same parent
      directories.
      This decision was made to improve clarity of what each folder contains.
      
      This commit also fixes missing `BUILD_TESTING` usages in
      `CMakeLists.txt`.
      
      This commit moves mocks for `applications/helpers` from the test
      subdirectories into `applications/helpers//mocks`.
      
      Updates mocks: freertos_kernel.
      
      Adds (from scratch) mock support for:
      security/mbedtls,
      security/trusted_firmware-m,
      connectivity/iot_vsocket,
      connectivity/freertos_plus_tcp,
      connectivity/backoff_algorithms,
      coremqtt_agent aws_iot module.
      
      Additionally, mocks application-specific config files for testing
      core_mqtt_agent.
      Store application-specific config files in `tests/mocks` directory to
      avoid cluttering the `tests/` directory with non-test files.
      Also adds a CMakeLists.txt file for this directory.
      
      Also adds build_unit_test directory to .gitignore.
      
      Signed-off-by: default avatarReuben Cartwright <Reuben.Cartwright@arm.com>
      4a4f28f2
    • Reuben Cartwright's avatar
      coremqtt-agent: Make #include explicit · a2dad9d6
      Reuben Cartwright authored and Devaraj Ranganna's avatar Devaraj Ranganna committed
      
      
      Some files were used in mqtt_agent_task.c but were not directly
      included.
      Additionally makes includes explicit in freertos_command_pool.c and
      freertos_agent_message.c.
      
      Signed-off-by: default avatarReuben Cartwright <Reuben.Cartwright@arm.com>
      a2dad9d6
  6. Sep 09, 2024
  7. Aug 27, 2024
    • Chuyue Luo's avatar
      build: Change default build toolchain to GNU (#83) · 60d21a49
      Chuyue Luo authored
      
      
      Currently, the default build toolchain is ARMClang. However, with VS
      Code devcontainers, only Arm GNU Toolchain is provided. Therefore, the
      default toolchain is changed to GNU. The associated documentation is
      also updated. In order to use the Arm Compiler for Embedded (ArmClang),
      the toolchain needs to be installed in the devcontainer and an
      additional argument `-TARMCLANG` must be passed while building the
      example.
      
      Signed-off-by: default avatarChuyue Luo <Chuyue.Luo@arm.com>
      60d21a49
  8. Aug 22, 2024
    • Reuben Cartwright's avatar
      tools: Port, debug, and document createIoTThings.py · d20b8f48
      Reuben Cartwright authored and Devaraj Ranganna's avatar Devaraj Ranganna committed
      
      
      The script contains tools used to create, destroy, and manage AWS IoT
      Things, Policies, Buckets, Roles, and Jobs. It is intended to
      automate the process of creating an OTA update.
      The script was previously in a deprecated project.
      
      Documentation for the script was also ported to
      `/docs/components/aws_iot/aws_tool.md``.
      Modified the aws_tool.md file with the following:
      1. Fix paths from total-solutions.
      2. Remove deprecated references (e.g. ats.sh)
      3. Clarifications added (e.g. where to get AWS API keys).
      4. Remove duplicate sections that have been ported already.
      
      This commit links to this documentation in the top-level `README.md`,
      under a section called 'Tools'.
      
      Modified createIoTThings.py with the following:
      1. comment all functions with Python Docstrings.
      2. debug and refactor createIoTThings.py as detailed below.
      3. Fix filenames and directories from deprecated total-solutions.
      
      Total-solutions saved all credentials to the same .h file, but build.sh
      in this project takes credentials from separate files.
      This commit stores generated credentials for new objects in
      the `credentials` directory by default, with unique file names per
      Thing.
      The user can optionally specify the credentials directory.
      
      This commit makes it possible to do any operation except for an OTA
      image update if update-signature.txt is not in the correct directory.
      A warning is generated if update-signature.txt is not present.
      
      This commit improves --help messages for the script.
      
      This commit places additional user input checks e.g.
      permissions_boundary must be of a certain format. Previous error
      messages were confusing.
      
      fix: does not forget to pass role name during role creation.
      fix: _does_role_exist handles None and "" cases.
      fix: cleanup after command failure. Do not delete a role if it already
      existed before the script ran.
      fix: create-update-only now gets role ARNs correctly.
      fix: create-policy-only now passes thing name and policy name correctly.
      fix: create-policy-only does not allow empty policy name or thing name.
      fix: correct help messages e.g. for create-update-only.
      Some other minor fixes also exist.
      
      This script updates
      `/applications/<target_application>/configs/aws_config/
      aws_clientcredentials.h` once a Thing is created, where
      `<target_application>` is specified on the CLI. If the file has been
      previously modified, the script asks before overwriting.
      This saves the user modifying the file.
      
      Signed-off-by: default avatarReuben Cartwright <Reuben.Cartwright@arm.com>
      d20b8f48
  9. Aug 09, 2024
Loading