From 659fcd951ac18d1ee7737a6ddf6a3ec162c73ca5 Mon Sep 17 00:00:00 2001 From: Kshitij Sisodia Date: Wed, 19 May 2021 10:30:06 +0100 Subject: MLECO-1933, MLECO-1914, MLECO-1885: Update to 21.05-rc2 components Core driver and sofware dependencies updated to latest release candidate revisions. Note: TensorFlow Lite Micro has not been updated. Also, gcc warnings for simple_platform target and ad use case have been fixed. Change-Id: I455b421f34375a719a941e6e220fe292a57613f5 --- dependencies/core-driver | 2 +- dependencies/core-software | 2 +- resources/ad/samples/files.md | 3 +- resources/ad/samples/random_id_00_000000.wav | Bin 0 -> 3044 bytes .../cmake/subsystem-profiles/simple_platform.cmake | 2 +- scripts/py/gen_audio_cpp.py | 17 +-- scripts/py/gen_rgb_cpp.py | 8 +- scripts/py/templates/AudioClips.hpp.template | 1 + source/application/hal/hal.c | 9 +- .../bsp-packs/simple_platform/include/stubs_fvp.h | 116 --------------------- .../include/stubs_simple_platform.h | 116 +++++++++++++++++++++ .../bsp-packs/simple_platform/include/timer_fvp.h | 55 ---------- .../include/timer_simple_platform.h | 55 ++++++++++ .../bsp/bsp-packs/simple_platform/stubs_fvp.c | 111 -------------------- .../simple_platform/stubs_simple_platform.c | 114 ++++++++++++++++++++ .../bsp/bsp-packs/simple_platform/timer_fvp.c | 56 ---------- .../simple_platform/timer_simple_platform.c | 58 +++++++++++ .../bsp/bsp-packs/simple_platform/uart_pl011.c | 9 +- .../hal/platforms/bare-metal/bsp/include/bsp.h | 4 +- .../platforms/bare-metal/timer/baremetal_timer.c | 24 ++--- .../bare-metal/timer/include/baremetal_timer.h | 12 +-- .../hal/platforms/bare-metal/utils/system_init.c | 2 +- 22 files changed, 397 insertions(+), 379 deletions(-) create mode 100644 resources/ad/samples/random_id_00_000000.wav delete mode 100644 source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/stubs_fvp.h create mode 100644 source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/stubs_simple_platform.h delete mode 100644 source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/timer_fvp.h create mode 100644 source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/timer_simple_platform.h delete mode 100644 source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/stubs_fvp.c create mode 100644 source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/stubs_simple_platform.c delete mode 100644 source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/timer_fvp.c create mode 100644 source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/timer_simple_platform.c diff --git a/dependencies/core-driver b/dependencies/core-driver index 8565d75..effc7aa 160000 --- a/dependencies/core-driver +++ b/dependencies/core-driver @@ -1 +1 @@ -Subproject commit 8565d75b96a2f57f559f12dc0c68438bcfd276c8 +Subproject commit effc7aa8b9272fb20cdd1a7d1097818af70acc93 diff --git a/dependencies/core-software b/dependencies/core-software index 3a0d3f2..7f3c1c9 160000 --- a/dependencies/core-software +++ b/dependencies/core-software @@ -1 +1 @@ -Subproject commit 3a0d3f286be62b4933ba404187aff23cae166a5a +Subproject commit 7f3c1c92732b611a53968b14e70a2b116e43b980 diff --git a/resources/ad/samples/files.md b/resources/ad/samples/files.md index 95b1479..e1aed1c 100644 --- a/resources/ad/samples/files.md +++ b/resources/ad/samples/files.md @@ -1,6 +1,7 @@ # Sample wav audio clip -For this use case sample audio clips aren't provided. +For this use case sample audio clips aren't provided. However, the file +`random_id_00_000000.wav` is provided as a dummy placeholder. The data used for this application sample comes from [https://zenodo.org/record/3384388\#.X6GILFNKiqA](https://zenodo.org/record/3384388\#.X6GILFNKiqA) diff --git a/resources/ad/samples/random_id_00_000000.wav b/resources/ad/samples/random_id_00_000000.wav new file mode 100644 index 0000000..529e652 Binary files /dev/null and b/resources/ad/samples/random_id_00_000000.wav differ diff --git a/scripts/cmake/subsystem-profiles/simple_platform.cmake b/scripts/cmake/subsystem-profiles/simple_platform.cmake index c11706d..c5e9d59 100644 --- a/scripts/cmake/subsystem-profiles/simple_platform.cmake +++ b/scripts/cmake/subsystem-profiles/simple_platform.cmake @@ -24,7 +24,7 @@ # Application specific config # ################################################################################################### -# This parameter is based on the linker/scatter script for internal FVP. Do not change this +# This parameter is based on the linker/scatter script for simple platform. Do not change this # parameter in isolation. set(ACTIVATION_BUF_SRAM_SZ "0x00200000" CACHE STRING "Maximum SRAM size for activation buffers") set(DESIGN_NAME "Simple platform" CACHE STRING "Design name") diff --git a/scripts/py/gen_audio_cpp.py b/scripts/py/gen_audio_cpp.py index 54fdb23..e7155c7 100644 --- a/scripts/py/gen_audio_cpp.py +++ b/scripts/py/gen_audio_cpp.py @@ -75,7 +75,7 @@ def write_hpp_file(header_filepath, cc_filepath, header_template_file, num_audio def write_individual_audio_cc_file(clip_dirpath, clip_filename, cc_filename, header_template_file, array_name, - sampling_rate_value, mono_value, offset_value, + sampling_rate_value, mono_value, offset_value, duration_value, res_type_value, min_len): print(f"++ Converting {clip_filename} to {path.basename(cc_filename)}") audio_filepath = path.join(clip_dirpath, clip_filename) @@ -85,8 +85,8 @@ def write_individual_audio_cc_file(clip_dirpath, clip_filename, res_type_value, min_len) # Change from [-1, 1] fp32 range to int16 range. - clip_data = np.clip((clip_data * (1 << 15)), - np.iinfo(np.int16).min, + clip_data = np.clip((clip_data * (1 << 15)), + np.iinfo(np.int16).min, np.iinfo(np.int16).max).flatten().astype(np.int16) header_template = env.get_template(header_template_file) @@ -117,7 +117,7 @@ def main(args): header_filepath = path.join(args.header_folder_path, header_filename) common_cc_filepath = path.join(args.source_folder_path, common_cc_filename) - if os.path.isdir(args.audio_path): + if os.path.isdir(args.audio_path): filepaths = sorted(glob.glob(path.join(args.audio_path, '**/*.wav'), recursive=True)) elif os.path.isfile(args.audio_path): filepaths = [args.audio_path] @@ -125,7 +125,7 @@ def main(args): raise OSError("Directory or file does not exist.") for filepath in filepaths: - filename = path.basename(filepath) + filename = path.basename(filepath) clip_dirpath = path.dirname(filepath) try: audioclip_filenames.append(filename) @@ -145,8 +145,11 @@ def main(args): if args.verbosity: print(f"Failed to open {filename} as an audio.") - write_hpp_file(header_filepath, common_cc_filepath, args.license_template, - audioclip_idx, audioclip_filenames, audioclip_array_names) + if len(audioclip_filenames) > 0: + write_hpp_file(header_filepath, common_cc_filepath, args.license_template, + audioclip_idx, audioclip_filenames, audioclip_array_names) + else: + raise FileNotFoundError("No valid audio clip files found.") if __name__ == '__main__': diff --git a/scripts/py/gen_rgb_cpp.py b/scripts/py/gen_rgb_cpp.py index 1a2e09b..957d2d0 100644 --- a/scripts/py/gen_rgb_cpp.py +++ b/scripts/py/gen_rgb_cpp.py @@ -127,8 +127,12 @@ def main(args): header_filepath = os.path.join(args.header_folder_path, header_filename) common_cc_filename = "InputFiles.cc" common_cc_filepath = os.path.join(args.source_folder_path, common_cc_filename) - write_hpp_file(header_filepath, common_cc_filepath, args.license_template, - image_idx, image_filenames, image_array_names, args.image_size) + + if len(image_filenames) > 0: + write_hpp_file(header_filepath, common_cc_filepath, args.license_template, + image_idx, image_filenames, image_array_names, args.image_size) + else: + raise FileNotFoundError("No valid images found.") if __name__ == '__main__': diff --git a/scripts/py/templates/AudioClips.hpp.template b/scripts/py/templates/AudioClips.hpp.template index eb0beda..2bcf45c 100644 --- a/scripts/py/templates/AudioClips.hpp.template +++ b/scripts/py/templates/AudioClips.hpp.template @@ -23,6 +23,7 @@ #include #define NUMBER_OF_FILES ({{clips_count}}U) + {% for var_name, size in varname_size %} extern const int16_t {{var_name}}[{{size}}]; {% endfor %} diff --git a/source/application/hal/hal.c b/source/application/hal/hal.c index 9c2ce32..2ce2684 100644 --- a/source/application/hal/hal.c +++ b/source/application/hal/hal.c @@ -28,6 +28,8 @@ #include "timing_adapter.h" /* Arm Ethos-U55 timing adapter driver header */ #include "timing_adapter_settings.h" /* Arm Ethos-U55 timing adapter settings */ +extern struct ethosu_driver ethosu_drv; /* Default Ethos-U55 device driver */ + /** * @brief Initialises the Arm Ethos-U55 NPU * @return 0 if successful, error code otherwise @@ -133,7 +135,7 @@ void hal_platform_release(hal_platform *platform) static void arm_npu_irq_handler(void) { /* Call the default interrupt handler from the NPU driver */ - ethosu_irq_handler(); + ethosu_irq_handler(ðosu_drv); } /** @@ -229,7 +231,8 @@ static int arm_npu_init(void) /* Initialise Ethos-U55 device */ const void * ethosu_base_address = (void *)(SEC_ETHOS_U55_BASE); - if (0 != (err = ethosu_init_v3( + if (0 != (err = ethosu_init( + ðosu_drv, /* Ethos-U55 driver device pointer */ ethosu_base_address, /* Ethos-U55's base address. */ NULL, /* Pointer to fast mem area - NULL for U55. */ 0, /* Fast mem region size. */ @@ -243,7 +246,7 @@ static int arm_npu_init(void) /* Get Ethos-U55 version */ struct ethosu_version version; - if (0 != (err = ethosu_get_version(&version))) { + if (0 != (err = ethosu_get_version(ðosu_drv, &version))) { printf_err("failed to fetch Ethos-U55 version info\n"); return err; } diff --git a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/stubs_fvp.h b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/stubs_fvp.h deleted file mode 100644 index aec0be1..0000000 --- a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/stubs_fvp.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2021 Arm Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef BSP_PACK_FASTMODEL_H -#define BSP_PACK_FASTMODEL_H - -#include "cmsis.h" /* device specific header file */ -#include "peripheral_memmap.h" /* peripheral memory map definitions */ - -/****************************************************************************/ -/* Definitions and stub functions for modules currently */ -/* unavailable on the model */ -/****************************************************************************/ -#define GLCD_WIDTH 320 -#define GLCD_HEIGHT 240 -#define Black 0x0000 /* 0, 0, 0 */ -#define White 0xFFFF /* 255, 255, 255 */ - -/*********************** Clock related functions *****************************/ -uint32_t GetCoreClock(void); - -/************************ GLCD related functions ****************************/ -/** - * @brief Initialize the Himax LCD with HX8347-D LCD Controller - */ -void GLCD_Initialize(void); - -/** - * @brief Display graphical bitmap image at position x horizontally and y - * vertically. This function is optimized for 16 bits per pixel - * format, it has to be adapted for any other format. - * @param[in] x horizontal position. - * @param[in] y vertical position. - * @param[in] w width of bitmap. - * @param[in] h height of bitmap. - * @param[in] bitmap address at which the bitmap data resides. - */ -void GLCD_Bitmap(unsigned int x, unsigned int y, - unsigned int w, unsigned int h, - unsigned short *bitmap); - -/** - * @brief Displays an 8 bit image, conversion to the LCD's - * 16 bit codec is done on the fly. - * @param[in] data pointer to the full sized image data. - * @param[in] width image width. - * @param[in] height image height. - * @param[in] channels number of channels in the image. - * @param[in] pos_x start x position for the LCD. - * @param[in] pos_y start y position for the LCD. - * @param[in] downsample_factor factor by which the image - * is downsampled by. - */ -void GLCD_Image(void *data, const uint32_t width, - const uint32_t height, const uint32_t channels, - const uint32_t pos_x, const uint32_t pos_y, - const uint32_t downsample_factor); - -/** - * @brief Clear display - * @param[in] color display clearing color - */ -void GLCD_Clear(unsigned short color); - -/** - * @brief Set foreground color - * @param[in] color foreground color - */ -void GLCD_SetTextColor(unsigned short color); - -/** - * @brief Display character on given line - * @param[in] ln line number - * @param[in] col column number - * @param[in] fi font index (0 = 9x15) - * @param[in] c ASCII character - */ -void GLCD_DisplayChar(unsigned int ln, unsigned int col, - unsigned char fi, unsigned char c); - -/** - * @brief Display string on given line - * @param[in] ln line number - * @param[in] col column number - * @param[in] fi font index (0 = 9x15) - * @param[in] s pointer to string - */ -void GLCD_DisplayString(unsigned int ln, unsigned int col, - unsigned char fi, char *s); - -/** - * @brief Draw box filled with color - * @param[in] x horizontal position - * @param[in] y: vertical position - * @param[in] w: window width in pixels - * @param[in] h: window height in pixels - * @param[in] color box color - */ -void GLCD_Box(unsigned int x, unsigned int y, - unsigned int w, unsigned int h, - unsigned short color); - -#endif /* BSP_PACK_FASTMODEL_H */ diff --git a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/stubs_simple_platform.h b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/stubs_simple_platform.h new file mode 100644 index 0000000..9977cd2 --- /dev/null +++ b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/stubs_simple_platform.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2021 Arm Limited. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef STUBS_SIMPLE_PLATFORM_H +#define STUBS_SIMPLE_PLATFORM_H + +#include "cmsis.h" /* device specific header file */ +#include "peripheral_memmap.h" /* peripheral memory map definitions */ + +/****************************************************************************/ +/* Definitions and stub functions for modules currently */ +/* unavailable on this target platform */ +/****************************************************************************/ +#define GLCD_WIDTH 320 +#define GLCD_HEIGHT 240 +#define Black 0x0000 /* 0, 0, 0 */ +#define White 0xFFFF /* 255, 255, 255 */ + +/*********************** Clock related functions *****************************/ +uint32_t GetCoreClock(void); + +/************************ GLCD related functions ****************************/ +/** + * @brief Initialize the Himax LCD with HX8347-D LCD Controller + */ +void GLCD_Initialize(void); + +/** + * @brief Display graphical bitmap image at position x horizontally and y + * vertically. This function is optimized for 16 bits per pixel + * format, it has to be adapted for any other format. + * @param[in] x horizontal position. + * @param[in] y vertical position. + * @param[in] w width of bitmap. + * @param[in] h height of bitmap. + * @param[in] bitmap address at which the bitmap data resides. + */ +void GLCD_Bitmap(unsigned int x, unsigned int y, + unsigned int w, unsigned int h, + unsigned short *bitmap); + +/** + * @brief Displays an 8 bit image, conversion to the LCD's + * 16 bit codec is done on the fly. + * @param[in] data pointer to the full sized image data. + * @param[in] width image width. + * @param[in] height image height. + * @param[in] channels number of channels in the image. + * @param[in] pos_x start x position for the LCD. + * @param[in] pos_y start y position for the LCD. + * @param[in] downsample_factor factor by which the image + * is downsampled by. + */ +void GLCD_Image(void *data, const uint32_t width, + const uint32_t height, const uint32_t channels, + const uint32_t pos_x, const uint32_t pos_y, + const uint32_t downsample_factor); + +/** + * @brief Clear display + * @param[in] color display clearing color + */ +void GLCD_Clear(unsigned short color); + +/** + * @brief Set foreground color + * @param[in] color foreground color + */ +void GLCD_SetTextColor(unsigned short color); + +/** + * @brief Display character on given line + * @param[in] ln line number + * @param[in] col column number + * @param[in] fi font index (0 = 9x15) + * @param[in] c ASCII character + */ +void GLCD_DisplayChar(unsigned int ln, unsigned int col, + unsigned char fi, unsigned char c); + +/** + * @brief Display string on given line + * @param[in] ln line number + * @param[in] col column number + * @param[in] fi font index (0 = 9x15) + * @param[in] s pointer to string + */ +void GLCD_DisplayString(unsigned int ln, unsigned int col, + unsigned char fi, char *s); + +/** + * @brief Draw box filled with color + * @param[in] x horizontal position + * @param[in] y: vertical position + * @param[in] w: window width in pixels + * @param[in] h: window height in pixels + * @param[in] color box color + */ +void GLCD_Box(unsigned int x, unsigned int y, + unsigned int w, unsigned int h, + unsigned short color); + +#endif /* STUBS_SIMPLE_PLATFORM_H */ diff --git a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/timer_fvp.h b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/timer_fvp.h deleted file mode 100644 index c07a4eb..0000000 --- a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/timer_fvp.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2021 Arm Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef TIMER_FVP_H -#define TIMER_FVP_H - -#include "stubs_fvp.h" - -/* Container for timestamp for fastmodel. */ -typedef struct _fvp_time_counter { - uint64_t counter_systick; -} fvp_time_counter; - -/** - * @brief Resets the counters. - */ -void timer_reset(void); - -/** - * @brief Gets the current counter values. - * @returns counter struct. - **/ -fvp_time_counter get_time_counter(void); - -/** - * @brief Gets the cycle counts elapsed between start and end. - * @return difference in counter values as 32 bit unsigned integer. - */ -uint64_t get_cycle_count_diff(fvp_time_counter *start, fvp_time_counter *end); - -/** - * @brief Enables or triggers cycle counting mechanism, if required - * by the platform. - */ -void start_cycle_counter(void); - -/** - * @brief Stops cycle counting mechanism, if required by the platform. - */ -void stop_cycle_counter(void); - -#endif /* TIMER_FVP_H */ diff --git a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/timer_simple_platform.h b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/timer_simple_platform.h new file mode 100644 index 0000000..320a57a --- /dev/null +++ b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/include/timer_simple_platform.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2021 Arm Limited. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef TIMER_SIMPLE_PLATFORM_H +#define TIMER_SIMPLE_PLATFORM_H + +#include "stubs_simple_platform.h" + +/* Container for timestamp for simple platform. */ +typedef struct _generic_time_counter { + uint64_t counter_systick; +} generic_time_counter; + +/** + * @brief Resets the counters. + */ +void timer_reset(void); + +/** + * @brief Gets the current counter values. + * @returns counter struct. + **/ +generic_time_counter get_time_counter(void); + +/** + * @brief Gets the cycle counts elapsed between start and end. + * @return difference in counter values as 32 bit unsigned integer. + */ +uint64_t get_cycle_count_diff(generic_time_counter *start, generic_time_counter *end); + +/** + * @brief Enables or triggers cycle counting mechanism, if required + * by the platform. + */ +void start_cycle_counter(void); + +/** + * @brief Stops cycle counting mechanism, if required by the platform. + */ +void stop_cycle_counter(void); + +#endif /* TIMER_SIMPLE_PLATFORM_H */ diff --git a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/stubs_fvp.c b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/stubs_fvp.c deleted file mode 100644 index e5b2969..0000000 --- a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/stubs_fvp.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2021 Arm Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "stubs_fvp.h" - -#include "bsp_core_log.h" - -uint32_t GetCoreClock(void) -{ - return 1; -} - -void GLCD_Initialize(void) {} - -void GLCD_Bitmap(unsigned int x, unsigned int y, - unsigned int w, unsigned int h, unsigned short *bitmap) -{ - UNUSED(x); - UNUSED(y); - UNUSED(w); - UNUSED(h); - UNUSED(bitmap); -} - -void GLCD_Image(void *data, const uint32_t width, const uint32_t height, - const uint32_t channels, const uint32_t pos_x, - const uint32_t pos_y, const uint32_t downsample_factor) -{ - UNUSED(data); - UNUSED(pos_x); - UNUSED(pos_y); - UNUSED(width); - UNUSED(height); - UNUSED(channels); - UNUSED(downsample_factor); - debug("image display: (x, y, w, h) = (%u, %u, %u, %u)\n", - pos_x, pos_y, width, height); - debug("image display: channels = %u, downsample factor = %u\n", - channels, downsample_factor); -} - -void GLCD_Clear(unsigned short color) -{ - UNUSED(color); -} - -void GLCD_SetTextColor(unsigned short color) -{ - UNUSED(color); -} - -void GLCD_DisplayChar (unsigned int ln, unsigned int col, unsigned char fi, - unsigned char c) -{ - UNUSED(ln); - UNUSED(col); - UNUSED(fi); - UNUSED(c); -} - -void GLCD_DisplayString(unsigned int ln, unsigned int col, unsigned char fi, - char *s) -{ - UNUSED(ln); - UNUSED(col); - UNUSED(fi); - UNUSED(s); - debug("text display: %s\n", s); -} - -void GLCD_Box(unsigned int x, unsigned int y, unsigned int w, unsigned int h, - unsigned short color) -{ - UNUSED(x); - UNUSED(y); - UNUSED(w); - UNUSED(h); - UNUSED(color); -} - -void LED_Initialize(uint32_t port) -{ - UNUSED(port); -} - -void LED_On(uint32_t num, uint32_t port) -{ - UNUSED(num); - UNUSED(port); - debug("LED %u ON\n", num); -} - -void LED_Off(uint32_t num, uint32_t port) -{ - UNUSED(num); - UNUSED(port); - debug("LED %u OFF\n", num); -} diff --git a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/stubs_simple_platform.c b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/stubs_simple_platform.c new file mode 100644 index 0000000..df11adb --- /dev/null +++ b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/stubs_simple_platform.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2021 Arm Limited. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "stubs_simple_platform.h" + +#include "bsp_core_log.h" + +#include + +uint32_t GetCoreClock(void) +{ + return 1; +} + +void GLCD_Initialize(void) {} + +void GLCD_Bitmap(unsigned int x, unsigned int y, + unsigned int w, unsigned int h, unsigned short *bitmap) +{ + UNUSED(x); + UNUSED(y); + UNUSED(w); + UNUSED(h); + UNUSED(bitmap); +} + +void GLCD_Image(void *data, const uint32_t width, const uint32_t height, + const uint32_t channels, const uint32_t pos_x, + const uint32_t pos_y, const uint32_t downsample_factor) +{ + UNUSED(data); + UNUSED(pos_x); + UNUSED(pos_y); + UNUSED(width); + UNUSED(height); + UNUSED(channels); + UNUSED(downsample_factor); + debug("image display: (x, y, w, h) = " + "(%" PRIu32 ", %" PRIu32 ", %" PRIu32 ", %" PRIu32 ")\n", + pos_x, pos_y, width, height); + debug("image display: channels = %" PRIu32 ", downsample factor = %" PRIu32 "\n", + channels, downsample_factor); +} + +void GLCD_Clear(unsigned short color) +{ + UNUSED(color); +} + +void GLCD_SetTextColor(unsigned short color) +{ + UNUSED(color); +} + +void GLCD_DisplayChar (unsigned int ln, unsigned int col, unsigned char fi, + unsigned char c) +{ + UNUSED(ln); + UNUSED(col); + UNUSED(fi); + UNUSED(c); +} + +void GLCD_DisplayString(unsigned int ln, unsigned int col, unsigned char fi, + char *s) +{ + UNUSED(ln); + UNUSED(col); + UNUSED(fi); + UNUSED(s); + debug("text display: %s\n", s); +} + +void GLCD_Box(unsigned int x, unsigned int y, unsigned int w, unsigned int h, + unsigned short color) +{ + UNUSED(x); + UNUSED(y); + UNUSED(w); + UNUSED(h); + UNUSED(color); +} + +void LED_Initialize(uint32_t port) +{ + UNUSED(port); +} + +void LED_On(uint32_t num, uint32_t port) +{ + UNUSED(num); + UNUSED(port); + debug("LED %" PRIu32 " ON\n", num); +} + +void LED_Off(uint32_t num, uint32_t port) +{ + UNUSED(num); + UNUSED(port); + debug("LED %" PRIu32 " OFF\n", num); +} diff --git a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/timer_fvp.c b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/timer_fvp.c deleted file mode 100644 index b7a7232..0000000 --- a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/timer_fvp.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2021 Arm Limited. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "timer_fvp.h" - -#include "irqs.h" -#include "bsp_core_log.h" - -fvp_time_counter get_time_counter(void) -{ - fvp_time_counter t = { - .counter_systick = Get_SysTick_Cycle_Count() - }; - debug("counter_systick: %llu\n", t.counter_systick); - return t; -} - -void timer_reset(void) -{ - if (0 != Init_SysTick()) { - printf_err("Failed to initialise system tick config\n"); - } - debug("system tick config ready\n"); -} - -uint64_t get_cycle_count_diff(fvp_time_counter *start, - fvp_time_counter *end) -{ - if (start->counter_systick > end->counter_systick) { - warn("start > end; counter might have overflown\n"); - } - return end->counter_systick - start->counter_systick; -} - -void start_cycle_counter(void) -{ - /* Add any custom requirement for this platform here */ -} - -void stop_cycle_counter(void) -{ - /* Add any custom requirement for this platform here */ -} diff --git a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/timer_simple_platform.c b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/timer_simple_platform.c new file mode 100644 index 0000000..6914209 --- /dev/null +++ b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/timer_simple_platform.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 Arm Limited. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "timer_simple_platform.h" + +#include "irqs.h" +#include "bsp_core_log.h" + +#include + +generic_time_counter get_time_counter(void) +{ + generic_time_counter t = { + .counter_systick = Get_SysTick_Cycle_Count() + }; + debug("counter_systick: %" PRIu64 "\n", t.counter_systick); + return t; +} + +void timer_reset(void) +{ + if (0 != Init_SysTick()) { + printf_err("Failed to initialise system tick config\n"); + } + debug("system tick config ready\n"); +} + +uint64_t get_cycle_count_diff(generic_time_counter *start, + generic_time_counter *end) +{ + if (start->counter_systick > end->counter_systick) { + warn("start > end; counter might have overflown\n"); + } + return end->counter_systick - start->counter_systick; +} + +void start_cycle_counter(void) +{ + /* Add any custom requirement for this platform here */ +} + +void stop_cycle_counter(void) +{ + /* Add any custom requirement for this platform here */ +} diff --git a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/uart_pl011.c b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/uart_pl011.c index 5c1ee06..b2dee14 100644 --- a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/uart_pl011.c +++ b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/simple_platform/uart_pl011.c @@ -199,11 +199,12 @@ bool GetLine (char *lp, unsigned int len) case 0: *lp = 0; /* ESC - stop editing line. */ return false; - case CR: /* CR - done, stop editing line. */ - *lp = c; - lp++; /* increment line pointer. */ - cnt++; /* and count. */ + case CR: /* CR - done, stop editing line. */ + UartPutc (*lp = c); /* Echo and store character. */ + lp++; /* Increment line pointer */ + cnt++; /* and count. */ c = LF; + break; default: UartPutc (*lp = c); /* echo and store character. */ fflush (stdout); diff --git a/source/application/hal/platforms/bare-metal/bsp/include/bsp.h b/source/application/hal/platforms/bare-metal/bsp/include/bsp.h index fbe1ff6..20052ef 100644 --- a/source/application/hal/platforms/bare-metal/bsp/include/bsp.h +++ b/source/application/hal/platforms/bare-metal/bsp/include/bsp.h @@ -30,8 +30,8 @@ #else /* MPS3_PLATFORM */ -#include "stubs_fvp.h" /* Stubs for FVP. */ -#include "timer_fvp.h" /* Timer API for FVP. */ +#include "stubs_simple_platform.h" /* Stubs for simple_platform. */ +#include "timer_simple_platform.h" /* Timer API for simple_platform. */ #endif /* MPS3_PLATFORM */ diff --git a/source/application/hal/platforms/bare-metal/timer/baremetal_timer.c b/source/application/hal/platforms/bare-metal/timer/baremetal_timer.c index cd17a60..00028bd 100644 --- a/source/application/hal/platforms/bare-metal/timer/baremetal_timer.c +++ b/source/application/hal/platforms/bare-metal/timer/baremetal_timer.c @@ -260,7 +260,7 @@ static uint64_t bm_get_npu_axi0_read_cycle_diff(time_counter *st, time_counter * printf_err("EthosU PMU axi0 read counter overflow.\n"); return 0; } - return (uint64_t)(end->npu_axi0_read_ccnt - st->npu_axi0_read_ccnt); + return (uint64_t)(end->npu_axi0_read_beats - st->npu_axi0_read_beats); } static uint64_t bm_get_npu_axi0_write_cycle_diff(time_counter *st, time_counter *end) @@ -269,7 +269,7 @@ static uint64_t bm_get_npu_axi0_write_cycle_diff(time_counter *st, time_counter printf_err("EthosU PMU axi0 write counter overflow.\n"); return 0; } - return (uint64_t)(end->npu_axi0_write_ccnt - st->npu_axi0_write_ccnt); + return (uint64_t)(end->npu_axi0_write_beats - st->npu_axi0_write_beats); } static uint64_t bm_get_npu_axi1_read_cycle_diff(time_counter *st, time_counter *end) @@ -278,7 +278,7 @@ static uint64_t bm_get_npu_axi1_read_cycle_diff(time_counter *st, time_counter * printf_err("EthosU PMU axi1 read counter overflow.\n"); return 0; } - return (uint64_t)(end->npu_axi1_read_ccnt - st->npu_axi1_read_ccnt); + return (uint64_t)(end->npu_axi1_read_beats - st->npu_axi1_read_beats); } #endif /* defined (ARM_NPU) */ @@ -300,9 +300,9 @@ static time_counter bm_get_time_counter(void) #if defined (ARM_NPU) .npu_total_ccnt = ETHOSU_PMU_Get_CCNTR(), .npu_idle_ccnt = ETHOSU_PMU_Get_EVCNTR(0), - .npu_axi0_read_ccnt = ETHOSU_PMU_Get_EVCNTR(1), - .npu_axi0_write_ccnt = ETHOSU_PMU_Get_EVCNTR(2), - .npu_axi1_read_ccnt = ETHOSU_PMU_Get_EVCNTR(3) + .npu_axi0_read_beats = ETHOSU_PMU_Get_EVCNTR(1), + .npu_axi0_write_beats = ETHOSU_PMU_Get_EVCNTR(2), + .npu_axi1_read_beats = ETHOSU_PMU_Get_EVCNTR(3) #endif /* defined (ARM_NPU) */ }; @@ -310,14 +310,14 @@ static time_counter bm_get_time_counter(void) #if defined (ARM_NPU) debug("NPU total cc: %" PRIu64 "; NPU idle cc: %" PRIu32 - "; NPU axi0 read cc: %" PRIu32 - "; NPU axi0 write cc: %" PRIu32 - "; NPU axi1 read cc: %" PRIu32 "\n", + "; NPU axi0 read beats: %" PRIu32 + "; NPU axi0 write beats: %" PRIu32 + "; NPU axi1 read beats: %" PRIu32 "\n", t.npu_total_ccnt, t.npu_idle_ccnt, - t.npu_axi0_read_ccnt, - t.npu_axi0_write_ccnt, - t.npu_axi1_read_ccnt); + t.npu_axi0_read_beats, + t.npu_axi0_write_beats, + t.npu_axi1_read_beats); #endif /* defined (ARM_NPU) */ return t; diff --git a/source/application/hal/platforms/bare-metal/timer/include/baremetal_timer.h b/source/application/hal/platforms/bare-metal/timer/include/baremetal_timer.h index 3020dac..0d23a05 100644 --- a/source/application/hal/platforms/bare-metal/timer/include/baremetal_timer.h +++ b/source/application/hal/platforms/bare-metal/timer/include/baremetal_timer.h @@ -22,10 +22,10 @@ #if defined (MPS3_PLATFORM) #include "timer_mps3.h" - typedef mps3_time_counter base_time_counter; + typedef mps3_time_counter base_time_counter; #else /* defined (MPS3_PLATFORM) */ - #include "timer_fvp.h" - typedef fvp_time_counter base_time_counter; + #include "timer_simple_platform.h" + typedef generic_time_counter base_time_counter; #endif /* defined (MPS3_PLATFORM) */ typedef struct bm_time_counter { @@ -34,9 +34,9 @@ typedef struct bm_time_counter { #if defined (ARM_NPU) uint64_t npu_total_ccnt; uint32_t npu_idle_ccnt; - uint32_t npu_axi0_read_ccnt; - uint32_t npu_axi0_write_ccnt; - uint32_t npu_axi1_read_ccnt; + uint32_t npu_axi0_read_beats; + uint32_t npu_axi0_write_beats; + uint32_t npu_axi1_read_beats; #endif /* ARM_NPU */ } time_counter; diff --git a/source/application/hal/platforms/bare-metal/utils/system_init.c b/source/application/hal/platforms/bare-metal/utils/system_init.c index f95f214..376f08b 100644 --- a/source/application/hal/platforms/bare-metal/utils/system_init.c +++ b/source/application/hal/platforms/bare-metal/utils/system_init.c @@ -96,7 +96,7 @@ int system_init(void) } #else /* MPS3_PLATFORM */ - info("ARM model environment ready..\n"); + info("%s: complete\n", __FUNCTION__); return 0; #endif /* MPS3_PLATFORM */ -- cgit v1.2.1