I need to use the macro PCD_GET_EP_TX_ADDRESS from stm32f3xx_hal_pcd.h.
It is defined with:
#define PCD_GET_EP_TX_ADDRESS(USBx, bEpNum) ((uint16_t)*PCD_EP_TX_ADDRESS((USBx), (bEpNum)))
but using it causes a compilation error as PCD_EP_TX_ADDRESS is not defined.
I have grepped the whole project and the string PCD_EP_TX_ADDRESS with the results:
fadedbee#host:~/cubeide/f3-hid$ grep -R "PCD_EP_TX_ADDRESS" *
Binary file Debug/Middlewares/ST/STM32_USB_Device_Library/Class/HID/Src/usbd_hid.o matches
Binary file Debug/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.o matches
Binary file Debug/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.o matches
Binary file Debug/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.o matches
Binary file Debug/USB_DEVICE/App/usb_device.o matches
Binary file Debug/USB_DEVICE/App/usbd_desc.o matches
Binary file Debug/USB_DEVICE/Target/usbd_conf.o matches
Binary file Debug/Core/Src/stm32f3xx_it.o matches
Binary file Debug/Core/Src/system_stm32f3xx.o matches
Binary file Debug/Core/Src/main.o matches
Binary file Debug/Core/Src/stm32f3xx_hal_msp.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_spi_ex.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd_ex.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_spi.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart_ex.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd.o matches
Binary file Debug/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_exti.o matches
Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pcd.h:#define PCD_GET_EP_TX_ADDRESS(USBx, bEpNum) ((uint16_t)*PCD_EP_TX_ADDRESS((USBx), (bEpNum)))
The presence of the string in many object files, suggests that it is defined in some location.
Where is PCD_EP_TX_ADDRESS defined?
It seems to be declared inside of stm32f3xx_hal_pcd_ex.h.
#define PCD_EP_TX_ADDRESS(USBx, bEpNum) ((uint16_t *)((uint32_t)((((USBx)->BTABLE+(bEpNum)*8)*2+ ((uint32_t)(USBx) + 0x400U)))))
It probably wasn't included by CubeMX because CubeMX is crap sometimes. There are options in the export though to allow you to include more parts of the library be exported than the ones used by cubemx.
please don't forget to set the right HAL include defines inside of stm32<xx>xx_hal_conf.h
Related
Lets Consider a lst file "txt_filelist.lst" which has different text files mentioned with different path's, Now After reading the "txt_filelist.lst" file how to identify a specific text file along with its path in CMAKE?
txt_filelist.lst File:
`variants\EXX\application\a2l\srcxx_xx_xx\xx_xx_xx.txt`
`variants\EXX\application\a2l\srcxx_xx_xx\xx_xx_xx.txt`
`variants\EXX\application\a2l\srcxx_xx_xx\xx_xx_xx.txt`
`variants\EXX\application\a2l\srcxx_xx_xx\xx_xx_xx.txt`
After reading the lst file txt_filelist.lst How can I first identify the srcxx_xx_xx.txt in the lst and then secondly How can I fetch its entire path as variants\EXX\application\a2l\srcxx_xx_xx\xx_xx_xx.txt in CMAKE?
Thanks in Advance..!!!
You can use file(STRINGS) to read the lines of the file to a list variable. get_filename_component can be used to separate file names according to your needs. Using file(TO_NATIVE_PATH) may be necessary, if you use get_filename_component in a way that yields a path containing separators, but most tools should be able to work with forward slashes, even on Windows:
file(STRINGS txt_filelist.lst FILE_LINES LENGTH_MINIMUM 1)
message("=========================")
foreach(LINE IN LISTS FILE_LINES)
get_filename_component(FILE_NAME "${LINE}" NAME)
get_filename_component(FILE_DIR "${LINE}" DIRECTORY)
file(TO_NATIVE_PATH "${LINE}" FILE_PATH_NATIVE)
message(
"------------------------
LINE = '${LINE}'
FILE_NAME = '${FILE_NAME}'
FILE_DIR = '${FILE_DIR}'
FILE_PATH_NATIVE = '${FILE_PATH_NATIVE}'
"
)
endforeach()
message("=========================")
Note: The LENGTH_MINIMUM 1 option is there to ignore empty lines. This may not be necessary depending on the input you get.
I have a separate folder Input for the text files. i'm trying to read the lines in a certain file 'train.txt'. So how do i do it using this code?
for line in io.lines '???' do
end
io.lines takes an optional argument to represent which file it iterates. Since this file is in a different folder, use an absolute path, or a proper relative path. For instance, in Unix-like system, you can use "/some/path/Input/train.txt".
for line in io.lines("/some/path/Input/train.txt") do
--print(line)
end
I have a folder of files with scrambled file names. The file extensions are scrambled too. The folder contains a variety of different file formats. The files are not encrypted.
example: original file name = abcde.pdf
scrambled file name = !##FDZ13
Is there a way to recover the original file names? If not, is there a way to differentiate the file formats (.pdf, .png, ...)? Ultimately, I wish to access and use these files again.
I am working with windows.
Wei, in principle, the case is quite easy.
I assume you know the set of file types that can possibly appear there. Let's say we expect there to be DOC, PDF and PNG files.
Then I would go ahead and do the following:
- create a subdirectory for every file type you expect
- for each file f
- for each file type t
- move f under a nice name with appropriate file extension
to the subdirectory for file type t
- try to open the file with the correct application for t
- continue with next file if it works
- otherwise continue with next file type
- at this point the directory should contain no files anymore
- move all files from the subdirectories back to this one
- remove the subdirectory.
I got a .RAR file which contains different files with the same name.
For example,
index.txt 40 Text Document 04/01/2010 4:40PM
index.txt 22 Text Document 04/01/2010 4:42PM
index.txt 10 Text Document 04/01/2010 4:45PM
index.txt 13 Text Document 04/01/2010 4:50PM
Why?
Like said before, the files could be in separate paths, but as I'll show further, this isn't always the case.
If you use WinRAR to list the file contents and your options are set as the following, then it only appears you have files with the same name, but they are in different paths.
Options -> File list -> Flat folders view (ctrl+h)
Options -> File list -> Details
After the column CRC32, there is one called Path. If this is different, extraction shouldn't be a problem if:
Extract -> Extraction path and options -> Advanced -> Extract relative paths is set.
If it is Do not extract paths, WinRAR will need to ask you to rename them because of file system limitations.
I assume command line unrar won't be a problem in this case because you need to specify additional parameters to change its default behavior.
It is possible for a RAR archive to have multiple files with the same name in the same directory. If you use Windows, use "C:\Program Files\WinRAR\Rar.exe"
instead of rar on the command line in the following examples.
Create a new file and add it to a RAR archive. You can also check the changes by listing its contents.
rar a rarfile.rar testfile.txt
rar l rarfile.rar
rar a rarfile.rar testfile.txt
If you try to re-add this file, rar will replace the already added file with the same name.
Updating archive rarfile.rar
Updating testfile.txt OK
Done
Create an other file or rename the first one and add it to the RAR file.
move testfile.txt second.txt (new file)
rar a rarfile.rar second.txt (add it)
rar lb rarfile.rar (list archive, bare info)
Rename the second file to the first one's name.
rar rn rarfile.rar second.txt testfile.txt
This is how you create a RAR file with multiple files of the same name in the same path. These steps will be similar in WinRAR. If you try to rename the file again, the file name of all files in that directory will change too.
Why would someone want to do this?
The only explanation I can think of is that the person that created this archive wanted to imitate a version control/backup system. But if you want to extract only one specific version and it isn't the first one, WinRAR extracts the wrong file. It seems I've found a very obscure WinRAR bug :-)
Edit: seems a bad explanation after finding this in the RAR documentation:
-ver[n] File version control
Forces RAR to keep previous file versions when updating
files in the already existing archive. Old versions are
renamed to 'filename;n', where 'n' is the version number.
By default, when unpacking an archive without the switch
-ver, RAR extracts only the last added file version, the name
of which does not include a numeric suffix. But if you specify
a file name exactly, including a version, it will be also
unpacked. For example, 'rar x arcname' will unpack only
last versions, when 'rar x arcname file.txt;5' will unpack
'file.txt;5', if it is present in the archive.
If you specify -ver switch without a parameter when unpacking,
RAR will extract all versions of all files that match
the entered file mask. In this case a version number is
not removed from unpacked file names. You may also extract
a concrete file version specifying its number as -ver parameter.
It will tell RAR to unpack only this version and remove
a version number from file names. For example,
'rar x -ver5 arcname' will unpack only 5th file versions.
If you specify 'n' parameter when archiving, it will limit
the maximum number of file versions stored in the archive.
Old file versions exceeding this threshold will be removed.
they are in different paths, most likely.
try outputting the full path. or see what happens when you extract them.
you'll probably see something like:
index.txt
path1/index.txt
path2/index.txt
etc etc
In an F# script file (.fsx), how can I determine the location of the .fsx file currently executing? I'd like to resolve paths relative to it.
I tried Assembly.GetExecutingAssembly().CodeBase but that doesn't work in a "dynamic assembly", apparently.
extract from F# spec:
__SOURCE_DIRECTORY__ - Replaced by a literal verbatim string that specifies the name of the directory that contains the current file, for example, C:\source. The name of the current file is determined by the most recent line directive in the file. If no line directive has been given, the name is determined by that given to the command-line compiler in combination with System.IO.Path.GetFullPath.
__SOURCE_FILE__ - Replaced by a literal verbatim string that contains the name of the current file, for example, file.fs