Skip to content

Commit e40b1f5

Browse files
authored
Merge pull request #10145 from eightycc/issue-9686
Use MICROPY_HW_MCU_NAME for sysname and nodename for all ports.
2 parents 8ef2168 + 214c2f6 commit e40b1f5

File tree

16 files changed

+24
-348
lines changed

16 files changed

+24
-348
lines changed

ports/analog/common-hal/os/__init__.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,6 @@
1515

1616
// #include "peripherals/periph.h"
1717

18-
static const qstr os_uname_info_fields[] = {
19-
MP_QSTR_sysname, MP_QSTR_nodename,
20-
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
21-
};
22-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "max32");
23-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "max32");
24-
25-
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
26-
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
27-
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
28-
29-
static MP_DEFINE_ATTRTUPLE(
30-
os_uname_info_obj,
31-
os_uname_info_fields,
32-
5,
33-
(mp_obj_t)&os_uname_info_sysname_obj,
34-
(mp_obj_t)&os_uname_info_nodename_obj,
35-
(mp_obj_t)&os_uname_info_release_obj,
36-
(mp_obj_t)&os_uname_info_version_obj,
37-
(mp_obj_t)&os_uname_info_machine_obj
38-
);
39-
40-
mp_obj_t common_hal_os_uname(void) {
41-
return (mp_obj_t)&os_uname_info_obj;
42-
}
43-
4418
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
4519
#if (HAS_TRNG)
4620
// todo (low prior): implement

ports/atmel-samd/common-hal/os/__init__.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,6 @@
1616
#include "hal/include/hal_rand_sync.h"
1717
#endif
1818

19-
static const qstr os_uname_info_fields[] = {
20-
MP_QSTR_sysname, MP_QSTR_nodename,
21-
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
22-
};
23-
#ifdef SAMD21
24-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "samd21");
25-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "samd21");
26-
#endif
27-
#ifdef SAM_D5X_E5X
28-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "samd51");
29-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "samd51");
30-
#endif
31-
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
32-
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
33-
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
34-
35-
36-
static MP_DEFINE_ATTRTUPLE(
37-
os_uname_info_obj,
38-
os_uname_info_fields,
39-
5,
40-
(mp_obj_t)&os_uname_info_sysname_obj,
41-
(mp_obj_t)&os_uname_info_nodename_obj,
42-
(mp_obj_t)&os_uname_info_release_obj,
43-
(mp_obj_t)&os_uname_info_version_obj,
44-
(mp_obj_t)&os_uname_info_machine_obj
45-
);
46-
47-
mp_obj_t common_hal_os_uname(void) {
48-
return (mp_obj_t)&os_uname_info_obj;
49-
}
50-
5119
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
5220
#ifdef SAM_D5X_E5X
5321
hri_mclk_set_APBCMASK_TRNG_bit(MCLK);

ports/broadcom/common-hal/os/__init__.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,6 @@
1010
#include "py/objtuple.h"
1111
#include "py/qstr.h"
1212

13-
static const qstr os_uname_info_fields[] = {
14-
MP_QSTR_sysname, MP_QSTR_nodename,
15-
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
16-
};
17-
18-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
19-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
20-
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
21-
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
22-
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
23-
24-
25-
static MP_DEFINE_ATTRTUPLE(
26-
os_uname_info_obj,
27-
os_uname_info_fields,
28-
5,
29-
(mp_obj_t)&os_uname_info_sysname_obj,
30-
(mp_obj_t)&os_uname_info_nodename_obj,
31-
(mp_obj_t)&os_uname_info_release_obj,
32-
(mp_obj_t)&os_uname_info_version_obj,
33-
(mp_obj_t)&os_uname_info_machine_obj
34-
);
35-
36-
mp_obj_t common_hal_os_uname(void) {
37-
return (mp_obj_t)&os_uname_info_obj;
38-
}
39-
4013
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
4114
return false;
4215
}

ports/cxd56/common-hal/os/__init__.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,6 @@
1010
#include "py/objstr.h"
1111
#include "py/objtuple.h"
1212

13-
static const qstr os_uname_info_fields[] = {
14-
MP_QSTR_sysname, MP_QSTR_nodename,
15-
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
16-
};
17-
18-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "spresense");
19-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "spresense");
20-
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
21-
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
22-
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
23-
24-
static MP_DEFINE_ATTRTUPLE(
25-
os_uname_info_obj,
26-
os_uname_info_fields,
27-
5,
28-
(mp_obj_t)&os_uname_info_sysname_obj,
29-
(mp_obj_t)&os_uname_info_nodename_obj,
30-
(mp_obj_t)&os_uname_info_release_obj,
31-
(mp_obj_t)&os_uname_info_version_obj,
32-
(mp_obj_t)&os_uname_info_machine_obj
33-
);
34-
35-
mp_obj_t common_hal_os_uname(void) {
36-
return (mp_obj_t)&os_uname_info_obj;
37-
}
38-
3913
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
4014
uint32_t i = 0;
4115

ports/espressif/common-hal/os/__init__.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,6 @@
1515
#include "esp_system.h"
1616
#include "esp_random.h"
1717

18-
static const qstr os_uname_info_fields[] = {
19-
MP_QSTR_sysname, MP_QSTR_nodename,
20-
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
21-
};
22-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
23-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
24-
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
25-
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
26-
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
27-
28-
29-
static MP_DEFINE_ATTRTUPLE(
30-
os_uname_info_obj,
31-
os_uname_info_fields,
32-
5,
33-
(mp_obj_t)&os_uname_info_sysname_obj,
34-
(mp_obj_t)&os_uname_info_nodename_obj,
35-
(mp_obj_t)&os_uname_info_release_obj,
36-
(mp_obj_t)&os_uname_info_version_obj,
37-
(mp_obj_t)&os_uname_info_machine_obj
38-
);
39-
40-
mp_obj_t common_hal_os_uname(void) {
41-
return (mp_obj_t)&os_uname_info_obj;
42-
}
43-
4418
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
4519
uint32_t i = 0;
4620
while (i < length) {

ports/litex/common-hal/os/__init__.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,6 @@
1212

1313
#include "shared-bindings/os/__init__.h"
1414

15-
static const qstr os_uname_info_fields[] = {
16-
MP_QSTR_sysname, MP_QSTR_nodename,
17-
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
18-
};
19-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "litex");
20-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "litex");
21-
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
22-
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
23-
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
24-
25-
26-
static MP_DEFINE_ATTRTUPLE(
27-
os_uname_info_obj,
28-
os_uname_info_fields,
29-
5,
30-
(mp_obj_t)&os_uname_info_sysname_obj,
31-
(mp_obj_t)&os_uname_info_nodename_obj,
32-
(mp_obj_t)&os_uname_info_release_obj,
33-
(mp_obj_t)&os_uname_info_version_obj,
34-
(mp_obj_t)&os_uname_info_machine_obj
35-
);
36-
37-
mp_obj_t common_hal_os_uname(void) {
38-
return (mp_obj_t)&os_uname_info_obj;
39-
}
40-
4115
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
4216
return false;
4317
}

ports/mimxrt10xx/common-hal/os/__init__.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,6 @@
1717
#include "sdk/drivers/trng/fsl_trng.h"
1818
#endif
1919

20-
static const qstr os_uname_info_fields[] = {
21-
MP_QSTR_sysname, MP_QSTR_nodename,
22-
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
23-
};
24-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "mimxrt10xx");
25-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "mimxrt10xx");
26-
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
27-
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
28-
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
29-
30-
static MP_DEFINE_ATTRTUPLE(
31-
os_uname_info_obj,
32-
os_uname_info_fields,
33-
5,
34-
(mp_obj_t)&os_uname_info_sysname_obj,
35-
(mp_obj_t)&os_uname_info_nodename_obj,
36-
(mp_obj_t)&os_uname_info_release_obj,
37-
(mp_obj_t)&os_uname_info_version_obj,
38-
(mp_obj_t)&os_uname_info_machine_obj
39-
);
40-
41-
mp_obj_t common_hal_os_uname(void) {
42-
return (mp_obj_t)&os_uname_info_obj;
43-
}
44-
4520
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
4621
#if CIRCUITPY_RANDOM
4722
trng_config_t trngConfig;

ports/nordic/common-hal/os/__init__.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,6 @@
1717

1818
#include "nrf_rng.h"
1919

20-
static const qstr os_uname_info_fields[] = {
21-
MP_QSTR_sysname, MP_QSTR_nodename,
22-
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
23-
};
24-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "nrf52");
25-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "nrf52");
26-
27-
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
28-
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
29-
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
30-
31-
static MP_DEFINE_ATTRTUPLE(
32-
os_uname_info_obj,
33-
os_uname_info_fields,
34-
5,
35-
(mp_obj_t)&os_uname_info_sysname_obj,
36-
(mp_obj_t)&os_uname_info_nodename_obj,
37-
(mp_obj_t)&os_uname_info_release_obj,
38-
(mp_obj_t)&os_uname_info_version_obj,
39-
(mp_obj_t)&os_uname_info_machine_obj
40-
);
41-
42-
mp_obj_t common_hal_os_uname(void) {
43-
return (mp_obj_t)&os_uname_info_obj;
44-
}
45-
4620
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
4721
#ifdef BLUETOOTH_SD
4822
uint8_t sd_en = 0;

ports/raspberrypi/common-hal/os/__init__.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,6 @@
1818

1919
#include <string.h>
2020

21-
static const qstr os_uname_info_fields[] = {
22-
MP_QSTR_sysname, MP_QSTR_nodename,
23-
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
24-
};
25-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
26-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
27-
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
28-
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
29-
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
30-
31-
32-
static MP_DEFINE_ATTRTUPLE(
33-
os_uname_info_obj,
34-
os_uname_info_fields,
35-
5,
36-
(mp_obj_t)&os_uname_info_sysname_obj,
37-
(mp_obj_t)&os_uname_info_nodename_obj,
38-
(mp_obj_t)&os_uname_info_release_obj,
39-
(mp_obj_t)&os_uname_info_version_obj,
40-
(mp_obj_t)&os_uname_info_machine_obj
41-
);
42-
43-
mp_obj_t common_hal_os_uname(void) {
44-
return (mp_obj_t)&os_uname_info_obj;
45-
}
46-
4721
// NIST Special Publication 800-90B (draft) recommends several extractors,
4822
// including the SHA hash family and states that if the amount of entropy input
4923
// is twice the number of bits output from them, that output can be considered

ports/renode/common-hal/os/__init__.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,6 @@
1212

1313
#include "shared-bindings/os/__init__.h"
1414

15-
static const qstr os_uname_info_fields[] = {
16-
MP_QSTR_sysname, MP_QSTR_nodename,
17-
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
18-
};
19-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "renode");
20-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "renode");
21-
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
22-
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
23-
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
24-
25-
26-
static MP_DEFINE_ATTRTUPLE(
27-
os_uname_info_obj,
28-
os_uname_info_fields,
29-
5,
30-
(mp_obj_t)&os_uname_info_sysname_obj,
31-
(mp_obj_t)&os_uname_info_nodename_obj,
32-
(mp_obj_t)&os_uname_info_release_obj,
33-
(mp_obj_t)&os_uname_info_version_obj,
34-
(mp_obj_t)&os_uname_info_machine_obj
35-
);
36-
37-
mp_obj_t common_hal_os_uname(void) {
38-
return (mp_obj_t)&os_uname_info_obj;
39-
}
40-
4115
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
4216
return false;
4317
}

ports/silabs/common-hal/os/__init__.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,6 @@
3535
#include "peripherals/periph.h"
3636
#define RNG_TIMEOUT 5
3737

38-
static const qstr os_uname_info_fields[] = {
39-
MP_QSTR_sysname, MP_QSTR_nodename,
40-
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
41-
};
42-
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, EFR32_SERIES_LOWER);
43-
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, EFR32_SERIES_LOWER);
44-
45-
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
46-
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
47-
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
48-
49-
static MP_DEFINE_ATTRTUPLE(
50-
os_uname_info_obj,
51-
os_uname_info_fields,
52-
5,
53-
(mp_obj_t)&os_uname_info_sysname_obj,
54-
(mp_obj_t)&os_uname_info_nodename_obj,
55-
(mp_obj_t)&os_uname_info_release_obj,
56-
(mp_obj_t)&os_uname_info_version_obj,
57-
(mp_obj_t)&os_uname_info_machine_obj);
58-
59-
mp_obj_t common_hal_os_uname(void) {
60-
return (mp_obj_t)&os_uname_info_obj;
61-
}
62-
6338
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
6439

6540
return false;

0 commit comments

Comments
 (0)