Index: do_sdk.bat
===================================================================
--- /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/do_sdk.bat	(revision 6206)
+++ /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/do_sdk.bat	(working copy)
@@ -23,7 +23,7 @@
 setlocal enabledelayedexpansion
 copy program\patch_sdk.prog + program\patch.prog  output\bt_program23.meta
 copy format\rom.format + format\labels.format + format\command.format  output\bt_format.meta > nul
-
+
 ::perl util/memalloc.pl output/bt_format.meta
 
 if "%device_option%" equ "hci" (
@@ -73,7 +73,7 @@
 perl ../util/mergepatch.pl mouse_ble_att_list usb_kbdata_vendor_define usb_kbdata usb_msdata usb_devicedata usb_confdata ble_shutter_gatt_list ble_shutter_key_value_list ble_car_att_list sha256 
 perl ../util/romcrc.pl romcode.rom
 perl  ../util/mergepatch.pl otp
-
+perl  ../util/otpcheck.pl
 
 if "%device_option%" equ "keyboard" (
 cd ..\output
Index: output/eeprom.dat
===================================================================
--- /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/output/eeprom.dat	(revision 6242)
+++ /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/output/eeprom.dat	(working copy)
@@ -4064,8 +4064,8 @@
 00
 bf
 4a
-a0
-0f
+20
+03
 aa
 55
 01
@@ -4728,10 +4728,10 @@
 aa
 aa
 55
-c6
+3a
 7a
-c7
-33
+52
+10
 ff
 ff
 ff
Index: output/flash.dat
===================================================================
--- /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/output/flash.dat	(revision 6242)
+++ /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/output/flash.dat	(working copy)
@@ -4064,8 +4064,8 @@
 00
 bf
 4a
-a0
-0f
+20
+03
 aa
 55
 01
@@ -4728,10 +4728,10 @@
 aa
 aa
 55
-c6
+3a
 7a
-c7
-33
+52
+10
 ff
 ff
 ff
Index: output/otp.dat
===================================================================
--- /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/output/otp.dat	(revision 6242)
+++ /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/output/otp.dat	(working copy)
@@ -4073,8 +4073,8 @@
 00
 bf
 4a
-a0
-0f
+20
+03
 aa
 55
 01
@@ -4737,7 +4737,7 @@
 aa
 aa
 55
-c6
+3a
 7a
-c7
-33
+52
+10
Index: output/sched.rom
===================================================================
--- /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/output/sched.rom	(revision 6206)
+++ /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/output/sched.rom	(working copy)
@@ -348,7 +348,7 @@
 mem_eeprom_sda_gpio:16
 mem_eeprom_base:00 1f
 mem_flash_base:00 50 00
-mem_otp_read_retention_max_size:a0 0f  #16 * pair count
+mem_otp_read_retention_max_size:20 03  #16 * pair count
 
 
 mem_keyboard_caps_led_gpio:93
Index: sched/keyboard.dat
===================================================================
--- /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/sched/keyboard.dat	(revision 6206)
+++ /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/sched/keyboard.dat	(working copy)
@@ -281,7 +281,7 @@
 mem_eeprom_sda_gpio:16
 mem_eeprom_base:00 1f
 mem_flash_base:00 50 00
-mem_otp_read_retention_max_size:a0 0f  #16 * pair count
+mem_otp_read_retention_max_size:20 03  #16 * pair count
 
 
 mem_keyboard_caps_led_gpio:93
Index: util/otpcheck.pl
===================================================================
--- /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/util/otpcheck.pl	(nonexistent)
+++ /1121s/1121se/branch/keyboard/internal/keyboard_only_ble_carbon_sdk/util/otpcheck.pl	(working copy)
@@ -0,0 +1,77 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use File::Spec;  
+# 获取当前脚本的目录路径
+my $current_dir = File::Spec->rel2abs('.');
+my $parent_dir = File::Spec->catdir($current_dir, '..');  # 获取上一级目录
+my $BASE = 0x1fc0;
+# 指定要搜索的文件名
+my $filename = File::Spec->catfile($parent_dir, 'output', 'otp.dat');
+# 打开文件进行读取
+open(my $fh, '<',$filename) or die "无法打开文件 '$filename':$!";
+
+# 读取整个文件到数组中
+my @file_content = <$fh>;
+chomp @file_content;  # 移除每行的换行符
+
+# 关闭文件句柄
+close($fh);
+
+# 初始化变量
+my $found = 0;
+my $otp_end_address = 0;
+# 循环遍历文件内容，每次移动一个字节
+for my $start (0 ..$#file_content - 3) {
+    # 提取从当前起始位置开始的四个字节
+    my $chunk = join('', @file_content[$start .. $start + 3]);
+    
+    # 检查这四个字节是否匹配指定的字符串
+    if ($chunk eq '55aaaa55') {
+        $otp_end_address = $start +9;
+        # print "After adding 9 to the start position: $start\n";
+        $found = 1;
+    }
+}
+
+# 如果找到了 "55aaaa55"，则继续处理 sched.rom 文件
+if ($found) {
+    my $sched_filename = File::Spec->catfile($parent_dir, 'output', 'sched.rom');
+    # 打开文件进行读取
+    open(my $sched_fh, '<',$sched_filename) or die "无法打开文件 '$sched_filename'$!";
+    # 读取整个文件到字符串中
+    my $sched_content = do { local$/; <$sched_fh> };
+    chomp $sched_content;  # 移除字符串末尾的换行符
+    # print "sched_content: $sched_content\n";
+    # 关闭文件句柄
+    close($sched_fh);
+    # 在 sched_content 中查找 "mem_shutter_efuse_end_offset:"
+    my $sched_position = index($sched_content, 'mem_otp_read_retention_max_size:');
+    # 如果找到了 "mem_shutter_efuse_end_offset:"
+    if ($sched_position != -1) {
+        # 获取 "mem_shutter_efuse_end_offset:" 后面的两个字节
+        my $five_bytes_with_spaces = substr($sched_content, $sched_position + length("mem_otp_read_retention_max_size:"), 5);
+        $five_bytes_with_spaces =~ s/ //g;  # 移除空格
+        my $five_bytes =$five_bytes_with_spaces;
+        print "Q:  $five_bytes\n";
+        # 字节颠倒
+        my $reversed_bytes = substr($five_bytes, 2, 2) . substr($five_bytes, 0, 2);
+        my $decimal_value = hex($reversed_bytes);
+        my $MAX_SIZE = $BASE - $decimal_value;
+        # 打印找到的字符串位置信息以及后面跟随的两个字节
+        print "===== Keyboard OTP Check =====\n";
+        print "mem_otp_read_retention_max_size: $decimal_value\n";
+        print "MAX OTP SIZE: $BASE - $decimal_value = $MAX_SIZE\n";
+        print "OTP SIZE:  $otp_end_address\n";
+        if($MAX_SIZE >$otp_end_address)
+        {
+            print"otp check done\n";
+        }
+        else
+        {
+            die "otp check failed, please check 'mem_otp_read_retention_max_size'\n";
+        }
+    } else {
+        print "String 'mem_otp_read_retention_max_size:' not found in file '$sched_filename'.\n";
+    }
+}
