Skip to content

Commit

Permalink
[deprecation] PRODUCT_ID macro
Browse files Browse the repository at this point in the history
  • Loading branch information
technobly committed Apr 28, 2022
1 parent 17577a9 commit 200e1c6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 17 deletions.
12 changes: 2 additions & 10 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ to indicate Safe Mode when the application firmware isn't run.

- `v` - verbose - set to 1 to trigger verbose output
- `PLATFORM`/`PLATFORM_ID`: specifies the target platform, either as a name or as an ID.
- `PRODUCT_ID`: specifies the target product ID.
- `PRODUCT_FIRMWARE_VERSION`: specifies the firmware version that is sent to the cloud.
Value from 0 to 65535.
- `GCC_PREFIX`: a prefix added to the ARM toolchain. Allows custom locations to be specified if
Expand Down Expand Up @@ -206,16 +205,9 @@ make
Will build the main firmware, and all the modules the main firmware depends on.


## Product ID
## Product Version

The Product ID and product firmware version
is specified in your application code via the macros:

```
PRODUCT_ID(id);
```

and
The product firmware version is specified in your application code via the macro:

```
PRODUCT_VERSION(version)
Expand Down
3 changes: 1 addition & 2 deletions hal/inc/deviceid_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ extern "C" {
unsigned HAL_device_ID(uint8_t* dest, unsigned destLen);

/**
* Retrievse the platform ID of this device. This allows libraries above HAL
* to not be compile-time dependent on the PRODUCT_ID symbol.
* Retrievse the platform ID of this device.
*/
unsigned HAL_Platform_ID();

Expand Down
2 changes: 1 addition & 1 deletion user/applications/product_id_and_version/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// To verify product creator macros work correctly.
// These values get sent to the cloud on connection and help dashboard.particle.io do the right thing
//
PRODUCT_ID(42);
// PRODUCT_ID(42); // PRODUCT_ID Deprecated in Device OS 4.0
PRODUCT_VERSION(3);

void setup() {
Expand Down
2 changes: 1 addition & 1 deletion user/applications/tinker/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const PinMapping g_pinmap[] = {

const size_t g_pin_count = sizeof(g_pinmap) / sizeof(*g_pinmap);

PRODUCT_ID(PLATFORM_ID);
// PRODUCT_ID(PLATFORM_ID); // PRODUCT_ID Deprecated in Device OS 4.0
PRODUCT_VERSION(3);

/* Function prototypes -------------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion user/tests/app/immediate_updates/immediate_updates.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Particle.h"

#define VERSION 6
PRODUCT_ID(2448);
// PRODUCT_ID(2448); // PRODUCT_ID Deprecated in Device OS 4.0
PRODUCT_VERSION(VERSION);
SYSTEM_MODE(SEMI_AUTOMATIC);

Expand Down
6 changes: 4 additions & 2 deletions wiring/inc/spark_wiring_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ struct __ApplicationProductVersion {
#endif

#if PLATFORM_ID!=3
#define PRODUCT_ID(x) __ApplicationProductID __appProductID(x); __attribute__((externally_visible, section(".modinfo.product_id"))) uint16_t __system_product_id = (x);
#define PRODUCT_VERSION(x) __ApplicationProductVersion __appProductVersion(x); __attribute__((externally_visible, section(".modinfo.product_version"))) uint16_t __system_product_version = (x);
#define PRODUCT_ID(x) _Pragma ("GCC error \"The PRODUCT_ID macro must be removed from your firmware source code.\
The same compiled firmware binary may be used in multiple products that share the same platform and functionality.\"")
// Note: the following must be contained on one line
#define PRODUCT_VERSION(x) __ApplicationProductVersion __appProductVersion(x); __attribute__((externally_visible, section(".modinfo.product_version"))) uint16_t __system_product_version = (x); /* PRODUCT_ID used to do the following with a dynamic ID, but now we hardcode the PLATFORM_ID as the PRODUCT_ID. */ __ApplicationProductID __appProductID(PLATFORM_ID); __attribute__((externally_visible, section(".modinfo.product_id"))) uint16_t __system_product_id = (PLATFORM_ID);
#else
#define PRODUCT_ID(x)
#define PRODUCT_VERSION(x)
Expand Down

0 comments on commit 200e1c6

Please sign in to comment.