Skip to content
Browse files

temporary hack to force a write of the secondary MAC address

This hack allows you to call the program with the --read-mac-address command line argument and it will also write out the secondary MAC address using the primary one. So you can do:

    cc-tool --write hex.out; cc-tool --read-mac-address

Signed-off-by: Scott Gustafson <scott@garlicsoftware.com>
  • Loading branch information...
1 parent 46054dd commit f33dfca410e53b6c4ea24c038577e64245c912af @scott-42 committed
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/programmer/cc_253x_2540.cpp
View
11 src/programmer/cc_253x_2540.cpp
@@ -145,6 +145,8 @@ void CC_253x_2540::mac_address_read(size_t index, ByteVector &mac_address)
read_xdata_memory(0x780E, 8, mac_address);
else
read_xdata_memory(0x780E, 6, mac_address);
+
+ mac_address_write(mac_address);
}
if (index == 1)
{
@@ -159,7 +161,14 @@ void CC_253x_2540::mac_address_read(size_t index, ByteVector &mac_address)
//==============================================================================
void CC_253x_2540::mac_address_write(ByteVector &mac_address)
-{ }
+{
+ size_t size = unit_info_.ID == 0x2540 ? 6 : 8;
+ size_t offset = unit_info_.flash_size * 1024 - LOCK_DATA_SIZE - size;
+ DataSection section(offset, mac_address);
+ DataSectionStore store;
+ store.add_section(section, true);
+ write_flash_slow(store);
+}
//==============================================================================
bool CC_253x_2540::erase_check_comleted()

0 comments on commit f33dfca

Please sign in to comment.
Something went wrong with that request. Please try again.