Skip to content

Commit d460a30

Browse files
author
Daniel Campora
committed
cc3200: Add specific version file for the CC3200 port.
Current version has been numbered as 0.9.0 since Timers/PWM support is still missing.
1 parent 3f42f32 commit d460a30

7 files changed

Lines changed: 62 additions & 6 deletions

File tree

cc3200/boards/LAUNCHXL/mpconfigboard.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
* THE SOFTWARE.
2626
*/
2727

28+
#include "version.h"
29+
2830
#define LAUNCHXL
2931

30-
#define MICROPY_HW_BOARD_NAME "LaunchPad"
32+
#define BOARD_NAME "LaunchPad "
33+
#define MICROPY_HW_BOARD_NAME VERSION_E(BOARD_NAME, VERSION_NUMBER)
3134
#define MICROPY_HW_MCU_NAME "CC3200"
3235

3336
#define MICROPY_HW_HAS_SDCARD (0)

cc3200/boards/WIPY-SD/mpconfigboard.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
* THE SOFTWARE.
2626
*/
2727

28-
#define LAUNCHXL
28+
#include "version.h"
2929

30-
#define MICROPY_HW_BOARD_NAME "WiPy-SD"
30+
#define WIPY-SD
31+
32+
#define BOARD_NAME "WiPy-SD "
33+
#define MICROPY_HW_BOARD_NAME VERSION_E(BOARD_NAME, VERSION_NUMBER)
3134
#define MICROPY_HW_MCU_NAME "CC3200"
3235

3336
#define MICROPY_HW_HAS_SDCARD (1)

cc3200/boards/WIPY/mpconfigboard.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
* THE SOFTWARE.
2626
*/
2727

28-
#define LAUNCHXL
28+
#include "version.h"
2929

30-
#define MICROPY_HW_BOARD_NAME "WiPy"
30+
#define WIPY
31+
32+
#define BOARD_NAME "WiPy "
33+
#define MICROPY_HW_BOARD_NAME VERSION_E(BOARD_NAME, VERSION_NUMBER)
3134
#define MICROPY_HW_MCU_NAME "CC3200"
3235

3336
#define MICROPY_HW_HAS_SDCARD (0)

cc3200/mods/modpyb.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
#include "utils.h"
6767
#include "gccollect.h"
6868
#include "mperror.h"
69+
#include "genhdr/py-version.h"
6970

7071

7172
#ifdef DEBUG
@@ -233,6 +234,15 @@ STATIC mp_obj_t pyb_repl_uart(uint n_args, const mp_obj_t *args) {
233234
}
234235
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_repl_uart_obj, 0, 1, pyb_repl_uart);
235236

237+
/// \function version()
238+
/// Prints the software version (MicroPython + Port)
239+
STATIC mp_obj_t pyb_version(void) {
240+
char version[128];
241+
snprintf(version, sizeof(version), "Micro Python " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; " MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
242+
return mp_obj_new_str(version, strlen(version), false);
243+
}
244+
STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_version_obj, pyb_version);
245+
236246
MP_DECLARE_CONST_FUN_OBJ(pyb_main_obj); // defined in main.c
237247

238248
STATIC const mp_map_elem_t pyb_module_globals_table[] = {
@@ -257,6 +267,7 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
257267
{ MP_OBJ_NEW_QSTR(MP_QSTR_elapsed_micros), (mp_obj_t)&pyb_elapsed_micros_obj },
258268
{ MP_OBJ_NEW_QSTR(MP_QSTR_delay), (mp_obj_t)&pyb_delay_obj },
259269
{ MP_OBJ_NEW_QSTR(MP_QSTR_udelay), (mp_obj_t)&pyb_udelay_obj },
270+
{ MP_OBJ_NEW_QSTR(MP_QSTR_version), (mp_obj_t)&pyb_version_obj },
260271

261272
#if MICROPY_HW_ENABLE_RNG
262273
{ MP_OBJ_NEW_QSTR(MP_QSTR_rng), (mp_obj_t)&pyb_rng_get_obj },

cc3200/mptask.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void TASK_Micropython (void *pvParameters) {
241241
// soft reset
242242
pybsleep_signal_soft_reset();
243243

244-
printf("WiPy: soft reset\n");
244+
printf("PYB: soft reboot\n");
245245

246246
sflash_disk_flush();
247247

cc3200/qstrdefsport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Q(micros)
2929
Q(elapsed_millis)
3030
Q(elapsed_micros)
3131
Q(udelay)
32+
Q(version)
3233
Q(flush)
3334
Q(FileIO)
3435
Q(mkdisk)

cc3200/version.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* This file is part of the Micro Python project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2015 Daniel Campora
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#ifndef VERSION_H_
28+
#define VERSION_H_
29+
30+
#define VERSION_NUMBER v0.9.0
31+
32+
#define VERSION_PASTE(name, number) name # number
33+
#define VERSION_E(name, number) VERSION_PASTE(name, number)
34+
35+
#endif /* VERSION_H_ */

0 commit comments

Comments
 (0)