Skip to content

Commit 2621c7f

Browse files
committed
Add comments to the top of but files generated by script.
1 parent 888e465 commit 2621c7f

10 files changed

Lines changed: 110 additions & 5 deletions

src/sdk/mocksdkwrapper.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* This file is intended to be read from the sdkwrapper.hpp.
3+
* The user program must not include this file.
4+
*/
5+
16
#if __has_include(<gmock/gmock.h>)
27

38
class MockSdkWrapper : public SdkWrapper {

src/sdk/pico_api_alternate_defs.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* This file is not to be included from the user program.
3+
*
4+
* Some of the rpp_driver code include this file. The contents
5+
* of this file is alternate type definition for Pico SDK.
6+
* These types are declared inside pico SDK. So, x86 build cannot use.
7+
*/
8+
19
#ifndef PICO_API_ALTERNATE_DEFS_HPP__
210
#define PICO_API_ALTERNATE_DEFS_HPP__
311

src/sdk/pico_sdk_apistub.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/*
2+
* Definition of the Pico SDK API Stub.
3+
*
4+
* Stubs in this file is weakly bounded. So, if the hardware_xxx or
5+
* the pico_xxx library is not linked in the application, the stub
6+
* function in this file will be linked.
7+
*
8+
* There are two purposes.
9+
*
10+
* The first one to allow programmer not to link the unused library.
11+
* For example, assume a program which doesn't use hardware_i2c lib.
12+
* While program doesn't use the API inside this library, the
13+
* rpp_driver::SdkWrapper class needs the API. On the other hand,
14+
* linking all library of Pico SDK just suppress the error message is
15+
* nonsense. So, linking stub is the solution for this problem.
16+
*
17+
* The second purpose is warning for the unlinked API. Assume a
18+
* program which doesn't link the hardware_i2c while it is used.
19+
* In this case, there is no link error because the weakly bounded
20+
* stub API function is linked. To let the programmer know, the
21+
* stub function output the error message to the serial port.
22+
*/
123
#include <stdint.h>
224
#include <stdlib.h>
325

src/sdk/pico_sdk_headers.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
1+
/*
2+
* Pico SDK has separated directory and files for the prototype definition.
3+
* To include all, we gather the include files in this one file.
4+
*
5+
* This file is dedicated to be read from the sdkwrapper.hpp.
6+
*
7+
* Not intended to be read from the application program.
8+
*/
9+
#include <../../hardware_clocks/include/hardware/clocks.h>
10+
#include <../../hardware_gpio/include/hardware/gpio.h>
211
#include <../../hardware_i2c/include/hardware/i2c.h>
312
#include <../../hardware_pio/include/hardware/pio.h>
4-
#include <../../hardware_gpio/include/hardware/gpio.h>
5-
#include <../../hardware_clocks/include/hardware/clocks.h>
6-
#include <../../pico_time/include/pico/time.h>
713
#include <../../pico_stdio/include/pico/stdio.h>
14+
#include <../../pico_time/include/pico/time.h>

src/sdk/scripts/blocks/mocksdkwrapper_preumble.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* This file is intended to be read from the sdkwrapper.hpp.
3+
* The user program must not include this file.
4+
*/
5+
16
#if __has_include(<gmock/gmock.h>)
27

38
class MockSdkWrapper : public SdkWrapper {

src/sdk/scripts/blocks/pico_api_alternate_defs.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*
2+
* This file is not to be included from the user program.
3+
*
4+
* Some of the rpp_driver code include this file. The contents
5+
* of this file is alternate type definition for Pico SDK.
6+
* These types are declared inside pico SDK. So, x86 build cannot use.
7+
*/
8+
19
#ifndef PICO_API_ALTERNATE_DEFS_HPP__
210
#define PICO_API_ALTERNATE_DEFS_HPP__
311

src/sdk/scripts/blocks/pico_sdk_apistub_preumble.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/*
2+
* Definition of the Pico SDK API Stub.
3+
*
4+
* Stubs in this file is weakly bounded. So, if the hardware_xxx or
5+
* the pico_xxx library is not linked in the application, the stub
6+
* function in this file will be linked.
7+
*
8+
* There are two purposes.
9+
*
10+
* The first one to allow programmer not to link the unused library.
11+
* For example, assume a program which doesn't use hardware_i2c lib.
12+
* While program doesn't use the API inside this library, the
13+
* rpp_driver::SdkWrapper class needs the API. On the other hand,
14+
* linking all library of Pico SDK just suppress the error message is
15+
* nonsense. So, linking stub is the solution for this problem.
16+
*
17+
* The second purpose is warning for the unlinked API. Assume a
18+
* program which doesn't link the hardware_i2c while it is used.
19+
* In this case, there is no link error because the weakly bounded
20+
* stub API function is linked. To let the programmer know, the
21+
* stub function output the error message to the serial port.
22+
*/
123
#include <stdint.h>
224
#include <stdlib.h>
325

src/sdk/scripts/blocks/sdkwrapper_preumble.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/**
2+
* @file sdkwrapper.hpp
3+
* @brief Wrapper for RasPi Pico SDK API.
4+
* @copyright COPYRIGHT 2024 Seiichi Horie
5+
* @details
6+
* This file is generated by the scripts in the
7+
* src/sdk/scripts.
8+
* To re-generate, run :
9+
* @code
10+
* export PICO_SDK_PATH=/your/path/to/sdk
11+
* generate_wrapper.sh
12+
* @endcode
13+
*/
14+
115
#ifndef PICO_DRIVER_SRC_SDK_SDKWRAPPER_HPP_
216
#define PICO_DRIVER_SRC_SDK_SDKWRAPPER_HPP_
317

src/sdk/scripts/generate_wrapper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cp blocks/mocksdkwrapper_preumble.hpp output/mocksdkwrapper.hpp
1616
cp blocks/pico_sdk_apistub_preumble.cpp output/pico_sdk_apistub.cpp
1717
cp blocks/pico_api_alternate_defs.hpp output/pico_api_alternate_defs.hpp
1818
# echo "" > output/fffsdkwrapper.hpp
19-
echo "" > output/pico_sdk_headers.h
19+
cp blocks/pico_sdk_headers_preumble.hpp output/pico_sdk_headers.h
2020
echo "" > debug.hpp
2121

2222
# read FILE

src/sdk/sdkwrapper.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/**
2+
* @file sdkwrapper.hpp
3+
* @brief Wrapper for RasPi Pico SDK API.
4+
* @copyright COPYRIGHT 2024 Seiichi Horie
5+
* @details
6+
* This file is generated by the scripts in the
7+
* src/sdk/scripts.
8+
* To re-generate, run :
9+
* @code
10+
* export PICO_SDK_PATH=/your/path/to/sdk
11+
* generate_wrapper.sh
12+
* @endcode
13+
*/
14+
115
#ifndef PICO_DRIVER_SRC_SDK_SDKWRAPPER_HPP_
216
#define PICO_DRIVER_SRC_SDK_SDKWRAPPER_HPP_
317

0 commit comments

Comments
 (0)