2.9 issue#3859#3975
Conversation
Modifies hm2_test to load a mesa variable dump, so modbus can get spoofed. test_pattern15.h will be removed when I finish shared memory initialization via _usr component.
…om test_pattern15.h dumped from my 7i96. This is enough fool hm2_modbus into initializing it's parameters for testing. When user level component is working the test_pattern memory will be shared and the _usr component will load file (for any mesa fpga).
…ng the modbus driver for testing.
| const uint32_t config_memory_dump[] = { | ||
| 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF, |
There was a problem hiding this comment.
Headers should not be used to embed data. Use a separate C-file you link in to define the data.
Secondly, can this data not be derived from the original bit-file(s) to program the card?
| # | ||
| # Convert each mbcc source file to binary. | ||
| # | ||
| for MBCCS in $(ls *.mbccs) |
| # | ||
| for MBCCS in $(ls *.mbccs) | ||
| do | ||
| MBCCB=$(echo "$MBCCS" | sed 's/mbccs$/mbccb/') |
There was a problem hiding this comment.
This is usually done with basename (and dirname if necessary) constructs.
| # Run HAL with each test .mbccb | ||
| # | ||
| TEST_PATTERN=15 | ||
| for MBCCB in $(ls *.mbccb) |
| arr=($(grep "hm2_modbus.0.baudrate" halrun-stdout)) | ||
| baudrate=$(echo "${arr[3]}" | sed 's/0x0\+/0/') | ||
| baudrate=$((16#$baudrate)) | ||
| echo " baudrate = $baudrate" |
There was a problem hiding this comment.
Wouldn't this be easier done using awk? Then you can do all in a simple script.
| configs/**/halshow.preferences | ||
| /tests/hm2-modbus/modbus-Params/*.mbccb | ||
| /tests/hm2-modbus/modbus-Params/halrun-stderr | ||
| /tests/hm2-modbus/modbus-Params/halrun-stdout |
There was a problem hiding this comment.
These do not belong in the top-level .gitignore file. These need to go into a local file at tests/hm2-modus/.gitignore Also, they are absolute paths that should be relative.
| @@ -0,0 +1,131 @@ | |||
| #!/bin/bash | |||
|
|
|||
There was a problem hiding this comment.
Why are all these files located in a subdirectory modbus-Params? There is only one test and those are generally not put into subdirectories. Are you planning on adding more? which?
(and directory/file names should generally be lower case).
| # This script will dump the current configuration memory to the command line. | ||
| # Use ./dump_config.sh >> test_pattern15.h to capture your configuration to a file. Replace 7i96 with your firmware name. | ||
|
|
||
| # Want to use --rpo from 0x0000 - 0x6100. |
There was a problem hiding this comment.
This and the other dump script will only work if you have the specific card and it is on the network.
The more versatile way is to create the config from the bit-file and make that loadable by the hm2_test component. Then you don't have any static config in the test component either.
This PR extends the hm2_test component and provides unit tests for the BUG2 portion of #3859. To open a modbus component for simulation the hm2_test component emulates enough of a 7i96 with pktuart to load the modbus component.
A more general solution would be to implement a user component that could load an arbitrary fpga dump into the test pattern memory. But this is enough to test the modbus delays for various bauds and parity conditions.
Further development will be required before hw2_test can be used to test the BUG1 portion of $3859.