[PATCH v1] bsps/aarch64: explicit cast uint64_t to ISR_Level
From: Chengxiang Li avoid pclint err --- cpukit/score/cpu/aarch64/include/rtems/score/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h b/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h index aa4f90f1a8..569b6bcee2 100644 --- a/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h +++ b/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h @@ -251,7 +251,7 @@ static inline void AArch64_interrupt_flash( uint64_t isr_cookie ) #define _CPU_ISR_Disable( _isr_cookie ) \ do { \ -_isr_cookie = AArch64_interrupt_disable(); \ +_isr_cookie = (ISR_Level)AArch64_interrupt_disable(); \ } while (0) #define _CPU_ISR_Enable( _isr_cookie ) \ -- 2.34.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH] build: Fix script action
We have to use a custom dictorary to be able to set the "value" argument in the exec() context. --- wscript | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wscript b/wscript index a71e0d3f10..6c81083b2c 100755 --- a/wscript +++ b/wscript @@ -1026,8 +1026,14 @@ class OptionItem(Item): return value def _script(self, conf, cic, value, arg): -exec(arg) -return value +local_variables = { +"self": self, +"conf": conf, +"cic": cic, +"value": value +} +exec(arg, None, local_variables) +return local_variables["value"] def _test_state_benchmark(self, conf, name): self._do_append_test_cppflags(conf, name, "-DTEST_STATE_BENCHMARK=1") -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: Convert test executables to bootloader images?
Hello, attached is a proof of concept. Using a ./waf bootimages command didn't work since you don't have a build context in this case. I added a new option: # If this option is enabled, then boot images for the test programs # are built. BUILD_BOOT_IMAGES = False If this option is enabled, then a BSP-specific method is used to build a boot image. This method is optional. BSPs can provide it through a new build item with type "mkimage", see the powerpc/qoriq example of the attached patches. -- embedded brains GmbH & Co. KG Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.hu...@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht München Registernummer: HRB 157899 Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler Unsere Datenschutzerklärung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/From 74303e5fefc1104415ba7c86f5738855dd27610e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 17 Jan 2024 12:30:37 +0100 Subject: [PATCH 1/2] build: Add support to make bootloader images --- spec/build/cpukit/cpuopts.yml| 4 spec/build/cpukit/optbootimageext.yml| 17 ++ spec/build/cpukit/optbuildbootimages.yml | 16 + wscript | 30 4 files changed, 67 insertions(+) create mode 100644 spec/build/cpukit/optbootimageext.yml create mode 100644 spec/build/cpukit/optbuildbootimages.yml diff --git a/spec/build/cpukit/cpuopts.yml b/spec/build/cpukit/cpuopts.yml index 1d28ace552..bdf8fc2f66 100644 --- a/spec/build/cpukit/cpuopts.yml +++ b/spec/build/cpukit/cpuopts.yml @@ -75,6 +75,10 @@ links: uid: optcoverageldflags - role: build-dependency uid: optnocoverageldflags +- role: build-dependency + uid: optbootimageext +- role: build-dependency + uid: optbuildbootimages - role: build-dependency uid: optversion target: cpukit/include/rtems/score/cpuopts.h diff --git a/spec/build/cpukit/optbootimageext.yml b/spec/build/cpukit/optbootimageext.yml new file mode 100644 index 00..c9347ffba8 --- /dev/null +++ b/spec/build/cpukit/optbootimageext.yml @@ -0,0 +1,17 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-string: null +- env-assign: null +build-type: option +copyrights: +- Copyright (C) 2024 embedded brains GmbH & Co. KG +default: +- enabled-by: true + value: .img +description: | + Defines the file extension of boot images. +enabled-by: true +format: '{}' +links: [] +name: BOOT_IMAGE_EXTENSION +type: build diff --git a/spec/build/cpukit/optbuildbootimages.yml b/spec/build/cpukit/optbuildbootimages.yml new file mode 100644 index 00..12328b006d --- /dev/null +++ b/spec/build/cpukit/optbuildbootimages.yml @@ -0,0 +1,16 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-boolean: null +- env-enable: null +build-type: option +copyrights: +- Copyright (C) 2024 embedded brains GmbH & Co. KG +default: +- enabled-by: true + value: false +description: | + If this option is enabled, then boot images for the test programs are built. +enabled-by: true +links: [] +name: BUILD_BOOT_IMAGES +type: build diff --git a/wscript b/wscript index 6c81083b2c..34a9789bed 100755 --- a/wscript +++ b/wscript @@ -590,6 +590,29 @@ class ConfigFileItem(Item): self.install_target(bld) +class MakeImageItem(Item): + +def __init__(self, uid, data): +super(MakeImageItem, self).__init__(uid, data) + +def do_configure(self, conf, cic): +content = self.substitute(conf, self.data["content"]) +f = conf.bldnode.make_node(conf.env.VARIANT + "/bin/mkimage.py") +f.parent.mkdir() +f.write(content) +# 493 == 0755 +f.chmod(493) +file_path = f.abspath() +conf.env.BUILD_TOOL_MKIMAGE = file_path +conf.env.append_value("cfg_files", file_path) + +def do_build(self, bld, bic): +bld.install_as("${PREFIX}/bin/rtems-mkimage-" + bld.env.ARCH + "-" + + bld.env.BSP_NAME + ".py", + "bin/mkimage.py", + chmod=493) + + class ConfigHeaderItem(Item): def __init__(self, uid, data): @@ -760,6 +783,12 @@ class TestProgramItem(Item): use=bic.objects + bic.use, ) +if bld.env.BUILD_TOOL_MKIMAGE: +bld(rule="${BUILD_TOOL_MKIMAGE} ${SRC} ${TGT}", +source=target, +target=os.path.splitext(target)[0] + +bld.env.BOOT_IMAGE_EXTENSION) + class AdaTestProgramItem(TestProgramItem): @@ -1272,6 +1301,7 @@ def load_items(ctx, specs): "test-program": TestProgramItem, "group": GroupItem, "library": LibraryItem, +"mkimage": MakeImageItem, "objects": ObjectsItem, "option": OptionItem, "script": ScriptItem, -- 2.35.3 From ae532b560719566f15718a86abdcb657c4a3d4
Re: [PATCH] cpukit/score: Avoid overflow in multiplication
Fair enough. I'll update the patch. Thanks! On Wed, Jan 17, 2024 at 12:45 AM Sebastian Huber < sebastian.hu...@embedded-brains.de> wrote: > On 16.01.24 21:02, Kinsey Moore wrote: > > The two operands are 16 bit and the result is being saved into a > > larger type. Reduce the possibility of an overflow during multiplication > > by using the larger type as an operand. > > --- > > cpukit/score/src/objectextendinformation.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/cpukit/score/src/objectextendinformation.c > b/cpukit/score/src/objectextendinformation.c > > index 414766f219..f9c51c3bec 100644 > > --- a/cpukit/score/src/objectextendinformation.c > > +++ b/cpukit/score/src/objectextendinformation.c > > @@ -115,7 +115,8 @@ Objects_Maximum _Objects_Extend_information( > > * Allocate the name table, and the objects and if it fails either > return or > > * generate a fatal error depending on auto-extending being active. > > */ > > - object_block_size = extend_count * information->object_size; > > + object_block_size = extend_count; > > + object_block_size *= information->object_size; > > new_object_block = _Workspace_Allocate( object_block_size ); > > if ( new_object_block == NULL ) { > > return 0; > > I am not sure if a reviewer understands that this two line approach is > there to avoid integer overflows. I would simply keep the expression as > is and change extend_count to: > > uint32_t extend_count; > > -- > embedded brains GmbH & Co. KG > Herr Sebastian HUBER > Dornierstr. 4 > 82178 Puchheim > Germany > email: sebastian.hu...@embedded-brains.de > phone: +49-89-18 94 741 - 16 > fax: +49-89-18 94 741 - 08 > > Registergericht: Amtsgericht München > Registernummer: HRB 157899 > Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler > Unsere Datenschutzerklärung finden Sie hier: > https://embedded-brains.de/datenschutzerklaerung/ > ___ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v2] cpukit/score: Avoid overflow in multiplication
Change extend_count to uint32_t from uint16_t to avoid a possible premature integer overflow when it is later used for multiplication. --- cpukit/score/src/objectextendinformation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpukit/score/src/objectextendinformation.c b/cpukit/score/src/objectextendinformation.c index 414766f219..9a627b1a7c 100644 --- a/cpukit/score/src/objectextendinformation.c +++ b/cpukit/score/src/objectextendinformation.c @@ -59,7 +59,7 @@ Objects_Maximum _Objects_Extend_information( uint32_t index_base; uint32_t index_end; uint32_t index; - Objects_Maximum extend_count; + uint32_t extend_count; Objects_Maximum old_maximum; uint32_t new_maximum; size_tobject_block_size; -- 2.39.2 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH v2] cpukit/score: Avoid overflow in multiplication
On 17.01.24 15:31, Kinsey Moore wrote: Change extend_count to uint32_t from uint16_t to avoid a possible premature integer overflow when it is later used for multiplication. Thanks, looks good. -- embedded brains GmbH & Co. KG Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.hu...@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht München Registernummer: HRB 157899 Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler Unsere Datenschutzerklärung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/ ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel