Skip to content

Commit

Permalink
Merge branch 'bugfix/patch_cannot_apply_on_windows' into 'master'
Browse files Browse the repository at this point in the history
fix: Fixed the issue where patches could not be applied on windows

See merge request application/esp-at!1597
  • Loading branch information
xcguang committed Aug 9, 2024
2 parents 5d1f30a + 71d9071 commit 368f620
Show file tree
Hide file tree
Showing 30 changed files with 167 additions and 211 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ repos:
.*_pb2.py|
.*.pb-c.h|
.*.pb-c.c|
.*.patch|
.*.yuv
)$
- id: end-of-file-fixer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ index d0969ba408..89a0f02cbd 100644
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}"
- ABSOLUTE BASE_DIR "${project_dir}")
+ ABSOLUTE BASE_DIR "${CONFIG_PARTITION_TABLE_BASE_DIR}")

if(NOT EXISTS "${PARTITION_CSV_PATH}")
message(WARNING "Partition table CSV file ${PARTITION_CSV_PATH} not found. "
24 changes: 12 additions & 12 deletions module_config/module_esp32-d2wd/patch/fatfs_generation.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ index e7d2e25a7f..ddc68c9225 100644
+from typing import List
+from typing import Optional
+from typing import Tuple

-from construct import BitsInteger, BitStruct, Int16ul
+from construct import BitsInteger
+from construct import BitStruct
+from construct import Int16ul

FAT12_MAX_CLUSTERS: int = 4085
FAT16_MAX_CLUSTERS: int = 65525
@@ -200,6 +203,11 @@ def get_args_for_partition_generator(desc: str) -> argparse.Namespace:
Expand All @@ -32,7 +32,7 @@ index e7d2e25a7f..ddc68c9225 100644
+ type=str,
+ choices=['safe', 'perf'],
+ help='Wear levelling mode to use. Safe or performance. Only for sector size of 512')

args = parser.parse_args()
if args.fat_type == 0:
@@ -207,6 +215,9 @@ def get_args_for_partition_generator(desc: str) -> argparse.Namespace:
Expand All @@ -43,8 +43,8 @@ index e7d2e25a7f..ddc68c9225 100644
+ if args.sector_size != 512:
+ raise ValueError('Wear levelling mode can be set only for sector size 512')
return args


diff --git a/components/fatfs/wl_fatfsgen.py b/components/fatfs/wl_fatfsgen.py
index b6c5dd4fe7..8881938f03 100755
--- a/components/fatfs/wl_fatfsgen.py
Expand All @@ -56,7 +56,7 @@ index b6c5dd4fe7..8881938f03 100755
# SPDX-License-Identifier: Apache-2.0
+from typing import List
+from typing import Optional

-from typing import List, Optional
-
-from construct import Const, Int32ul, Struct
Expand All @@ -73,14 +73,14 @@ index b6c5dd4fe7..8881938f03 100755
+from fatfs_utils.utils import get_args_for_partition_generator
+from fatfs_utils.utils import UINT32_MAX
from fatfsgen import FATFS


@@ -55,6 +61,7 @@ class WLFATFS:
WL_STATE_HEADER_SIZE = 64
WL_STATE_COPY_COUNT = 2 # always 2 copies for power failure safety
WL_SECTOR_SIZE = 0x1000
+ WL_SAFE_MODE_DUMP_SECTORS = 2

WL_STATE_T_DATA = Struct(
'pos' / Int32ul,
@@ -99,7 +106,8 @@ class WLFATFS:
Expand All @@ -98,11 +98,11 @@ index b6c5dd4fe7..8881938f03 100755
self.total_sectors = self.partition_size // FATDefaults.WL_SECTOR_SIZE
self.wl_state_size = WLFATFS.WL_STATE_HEADER_SIZE + WLFATFS.WL_STATE_RECORD_SIZE * self.total_sectors
+ self.wl_mode = wl_mode

# determine the number of required sectors (roundup to sector size)
self.wl_state_sectors = (self.wl_state_size + FATDefaults.WL_SECTOR_SIZE - 1) // FATDefaults.WL_SECTOR_SIZE
@@ -116,6 +125,9 @@ class WLFATFS:

wl_sectors = (WLFATFS.WL_DUMMY_SECTORS_COUNT + WLFATFS.WL_CFG_SECTORS_COUNT +
self.wl_state_sectors * WLFATFS.WL_STATE_COPY_COUNT)
+ if self.wl_mode is not None and self.wl_mode == 'safe':
Expand All @@ -118,6 +118,6 @@ index b6c5dd4fe7..8881938f03 100755
- use_default_datetime=args.use_default_datetime)
+ use_default_datetime=args.use_default_datetime,
+ wl_mode=args.wl_mode)

wl_fatfs.wl_generate(args.input_directory)
wl_fatfs.init_wl()
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
From 7485572ef7e5b076d90d29f9335dcb726ef3714f Mon Sep 17 00:00:00 2001
From: xiewenxiang <[email protected]>
Date: Fri, 29 Mar 2024 10:41:25 +0800
Subject: [PATCH] modify bluedroid conn timeout

---
components/bt/host/bluedroid/stack/l2cap/l2c_ble.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c b/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c
index 4e6c8534ec..fa7a877491 100644
--- a/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c
Expand All @@ -27,13 +18,11 @@ index 4e6c8534ec..fa7a877491 100644
uint32_t current_time = (esp_system_get_time()/1000);
- link_timeout = (L2CAP_BLE_LINK_CONNECT_TOUT*1000 - (current_time - p_lcb->start_time_s))/1000;
+ link_timeout = (bluedroid_conn_wait_time*1000 - (current_time - p_lcb->start_time_s))/1000;

- if(link_timeout == 0 || link_timeout > L2CAP_BLE_LINK_CONNECT_TOUT) {
- link_timeout = L2CAP_BLE_LINK_CONNECT_TOUT;
+ if(link_timeout == 0 || link_timeout > bluedroid_conn_wait_time) {
+ link_timeout = bluedroid_conn_wait_time;
}
}

--
2.25.1

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ index d0969ba408..89a0f02cbd 100644
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}"
- ABSOLUTE BASE_DIR "${project_dir}")
+ ABSOLUTE BASE_DIR "${CONFIG_PARTITION_TABLE_BASE_DIR}")

if(NOT EXISTS "${PARTITION_CSV_PATH}")
message(WARNING "Partition table CSV file ${PARTITION_CSV_PATH} not found. "
24 changes: 12 additions & 12 deletions module_config/module_esp32-sdio/patch/fatfs_generation.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ index e7d2e25a7f..ddc68c9225 100644
+from typing import List
+from typing import Optional
+from typing import Tuple

-from construct import BitsInteger, BitStruct, Int16ul
+from construct import BitsInteger
+from construct import BitStruct
+from construct import Int16ul

FAT12_MAX_CLUSTERS: int = 4085
FAT16_MAX_CLUSTERS: int = 65525
@@ -200,6 +203,11 @@ def get_args_for_partition_generator(desc: str) -> argparse.Namespace:
Expand All @@ -32,7 +32,7 @@ index e7d2e25a7f..ddc68c9225 100644
+ type=str,
+ choices=['safe', 'perf'],
+ help='Wear levelling mode to use. Safe or performance. Only for sector size of 512')

args = parser.parse_args()
if args.fat_type == 0:
@@ -207,6 +215,9 @@ def get_args_for_partition_generator(desc: str) -> argparse.Namespace:
Expand All @@ -43,8 +43,8 @@ index e7d2e25a7f..ddc68c9225 100644
+ if args.sector_size != 512:
+ raise ValueError('Wear levelling mode can be set only for sector size 512')
return args


diff --git a/components/fatfs/wl_fatfsgen.py b/components/fatfs/wl_fatfsgen.py
index b6c5dd4fe7..8881938f03 100755
--- a/components/fatfs/wl_fatfsgen.py
Expand All @@ -56,7 +56,7 @@ index b6c5dd4fe7..8881938f03 100755
# SPDX-License-Identifier: Apache-2.0
+from typing import List
+from typing import Optional

-from typing import List, Optional
-
-from construct import Const, Int32ul, Struct
Expand All @@ -73,14 +73,14 @@ index b6c5dd4fe7..8881938f03 100755
+from fatfs_utils.utils import get_args_for_partition_generator
+from fatfs_utils.utils import UINT32_MAX
from fatfsgen import FATFS


@@ -55,6 +61,7 @@ class WLFATFS:
WL_STATE_HEADER_SIZE = 64
WL_STATE_COPY_COUNT = 2 # always 2 copies for power failure safety
WL_SECTOR_SIZE = 0x1000
+ WL_SAFE_MODE_DUMP_SECTORS = 2

WL_STATE_T_DATA = Struct(
'pos' / Int32ul,
@@ -99,7 +106,8 @@ class WLFATFS:
Expand All @@ -98,11 +98,11 @@ index b6c5dd4fe7..8881938f03 100755
self.total_sectors = self.partition_size // FATDefaults.WL_SECTOR_SIZE
self.wl_state_size = WLFATFS.WL_STATE_HEADER_SIZE + WLFATFS.WL_STATE_RECORD_SIZE * self.total_sectors
+ self.wl_mode = wl_mode

# determine the number of required sectors (roundup to sector size)
self.wl_state_sectors = (self.wl_state_size + FATDefaults.WL_SECTOR_SIZE - 1) // FATDefaults.WL_SECTOR_SIZE
@@ -116,6 +125,9 @@ class WLFATFS:

wl_sectors = (WLFATFS.WL_DUMMY_SECTORS_COUNT + WLFATFS.WL_CFG_SECTORS_COUNT +
self.wl_state_sectors * WLFATFS.WL_STATE_COPY_COUNT)
+ if self.wl_mode is not None and self.wl_mode == 'safe':
Expand All @@ -118,6 +118,6 @@ index b6c5dd4fe7..8881938f03 100755
- use_default_datetime=args.use_default_datetime)
+ use_default_datetime=args.use_default_datetime,
+ wl_mode=args.wl_mode)

wl_fatfs.wl_generate(args.input_directory)
wl_fatfs.init_wl()
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
From 7485572ef7e5b076d90d29f9335dcb726ef3714f Mon Sep 17 00:00:00 2001
From: xiewenxiang <[email protected]>
Date: Fri, 29 Mar 2024 10:41:25 +0800
Subject: [PATCH] modify bluedroid conn timeout

---
components/bt/host/bluedroid/stack/l2cap/l2c_ble.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c b/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c
index 4e6c8534ec..fa7a877491 100644
--- a/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c
Expand All @@ -27,13 +18,11 @@ index 4e6c8534ec..fa7a877491 100644
uint32_t current_time = (esp_system_get_time()/1000);
- link_timeout = (L2CAP_BLE_LINK_CONNECT_TOUT*1000 - (current_time - p_lcb->start_time_s))/1000;
+ link_timeout = (bluedroid_conn_wait_time*1000 - (current_time - p_lcb->start_time_s))/1000;

- if(link_timeout == 0 || link_timeout > L2CAP_BLE_LINK_CONNECT_TOUT) {
- link_timeout = L2CAP_BLE_LINK_CONNECT_TOUT;
+ if(link_timeout == 0 || link_timeout > bluedroid_conn_wait_time) {
+ link_timeout = bluedroid_conn_wait_time;
}
}

--
2.25.1

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ index d0969ba408..89a0f02cbd 100644
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}"
- ABSOLUTE BASE_DIR "${project_dir}")
+ ABSOLUTE BASE_DIR "${CONFIG_PARTITION_TABLE_BASE_DIR}")

if(NOT EXISTS "${PARTITION_CSV_PATH}")
message(WARNING "Partition table CSV file ${PARTITION_CSV_PATH} not found. "
24 changes: 12 additions & 12 deletions module_config/module_esp32_default/patch/fatfs_generation.patch
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ index e7d2e25a7f..ddc68c9225 100644
+from typing import List
+from typing import Optional
+from typing import Tuple

-from construct import BitsInteger, BitStruct, Int16ul
+from construct import BitsInteger
+from construct import BitStruct
+from construct import Int16ul

FAT12_MAX_CLUSTERS: int = 4085
FAT16_MAX_CLUSTERS: int = 65525
@@ -200,6 +203,11 @@ def get_args_for_partition_generator(desc: str) -> argparse.Namespace:
Expand All @@ -32,7 +32,7 @@ index e7d2e25a7f..ddc68c9225 100644
+ type=str,
+ choices=['safe', 'perf'],
+ help='Wear levelling mode to use. Safe or performance. Only for sector size of 512')

args = parser.parse_args()
if args.fat_type == 0:
@@ -207,6 +215,9 @@ def get_args_for_partition_generator(desc: str) -> argparse.Namespace:
Expand All @@ -43,8 +43,8 @@ index e7d2e25a7f..ddc68c9225 100644
+ if args.sector_size != 512:
+ raise ValueError('Wear levelling mode can be set only for sector size 512')
return args


diff --git a/components/fatfs/wl_fatfsgen.py b/components/fatfs/wl_fatfsgen.py
index b6c5dd4fe7..8881938f03 100755
--- a/components/fatfs/wl_fatfsgen.py
Expand All @@ -56,7 +56,7 @@ index b6c5dd4fe7..8881938f03 100755
# SPDX-License-Identifier: Apache-2.0
+from typing import List
+from typing import Optional

-from typing import List, Optional
-
-from construct import Const, Int32ul, Struct
Expand All @@ -73,14 +73,14 @@ index b6c5dd4fe7..8881938f03 100755
+from fatfs_utils.utils import get_args_for_partition_generator
+from fatfs_utils.utils import UINT32_MAX
from fatfsgen import FATFS


@@ -55,6 +61,7 @@ class WLFATFS:
WL_STATE_HEADER_SIZE = 64
WL_STATE_COPY_COUNT = 2 # always 2 copies for power failure safety
WL_SECTOR_SIZE = 0x1000
+ WL_SAFE_MODE_DUMP_SECTORS = 2

WL_STATE_T_DATA = Struct(
'pos' / Int32ul,
@@ -99,7 +106,8 @@ class WLFATFS:
Expand All @@ -98,11 +98,11 @@ index b6c5dd4fe7..8881938f03 100755
self.total_sectors = self.partition_size // FATDefaults.WL_SECTOR_SIZE
self.wl_state_size = WLFATFS.WL_STATE_HEADER_SIZE + WLFATFS.WL_STATE_RECORD_SIZE * self.total_sectors
+ self.wl_mode = wl_mode

# determine the number of required sectors (roundup to sector size)
self.wl_state_sectors = (self.wl_state_size + FATDefaults.WL_SECTOR_SIZE - 1) // FATDefaults.WL_SECTOR_SIZE
@@ -116,6 +125,9 @@ class WLFATFS:

wl_sectors = (WLFATFS.WL_DUMMY_SECTORS_COUNT + WLFATFS.WL_CFG_SECTORS_COUNT +
self.wl_state_sectors * WLFATFS.WL_STATE_COPY_COUNT)
+ if self.wl_mode is not None and self.wl_mode == 'safe':
Expand All @@ -118,6 +118,6 @@ index b6c5dd4fe7..8881938f03 100755
- use_default_datetime=args.use_default_datetime)
+ use_default_datetime=args.use_default_datetime,
+ wl_mode=args.wl_mode)

wl_fatfs.wl_generate(args.input_directory)
wl_fatfs.init_wl()
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
From 7485572ef7e5b076d90d29f9335dcb726ef3714f Mon Sep 17 00:00:00 2001
From: xiewenxiang <[email protected]>
Date: Fri, 29 Mar 2024 10:41:25 +0800
Subject: [PATCH] modify bluedroid conn timeout

---
components/bt/host/bluedroid/stack/l2cap/l2c_ble.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c b/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c
index 4e6c8534ec..fa7a877491 100644
--- a/components/bt/host/bluedroid/stack/l2cap/l2c_ble.c
Expand All @@ -27,13 +18,11 @@ index 4e6c8534ec..fa7a877491 100644
uint32_t current_time = (esp_system_get_time()/1000);
- link_timeout = (L2CAP_BLE_LINK_CONNECT_TOUT*1000 - (current_time - p_lcb->start_time_s))/1000;
+ link_timeout = (bluedroid_conn_wait_time*1000 - (current_time - p_lcb->start_time_s))/1000;

- if(link_timeout == 0 || link_timeout > L2CAP_BLE_LINK_CONNECT_TOUT) {
- link_timeout = L2CAP_BLE_LINK_CONNECT_TOUT;
+ if(link_timeout == 0 || link_timeout > bluedroid_conn_wait_time) {
+ link_timeout = bluedroid_conn_wait_time;
}
}

--
2.25.1

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ index d0969ba408..89a0f02cbd 100644
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}"
- ABSOLUTE BASE_DIR "${project_dir}")
+ ABSOLUTE BASE_DIR "${CONFIG_PARTITION_TABLE_BASE_DIR}")

if(NOT EXISTS "${PARTITION_CSV_PATH}")
message(WARNING "Partition table CSV file ${PARTITION_CSV_PATH} not found. "
Loading

0 comments on commit 368f620

Please sign in to comment.