Comments (2)
I've narrowed it down (by applying __attribute__((optimize("O0")))
to the minimum number of functions) to the following two functions:
hw_config:281
:
uint32_t __attribute__((optimize("O0"))) CDC_Send_DATA(uint8_t *ptrBuffer, uint32_t sendLength)
{
/* Last transmission hasn't finished, abort */
if (packetSent) {
return 0;
}
// We can only put 64 bytes in the buffer
if (sendLength > 64 / 2) {
sendLength = 64 / 2;
}
// Try to load some bytes if we can
if (sendLength) {
UserToPMABufferCopy(ptrBuffer, ENDP1_TXADDR, sendLength);
SetEPTxCount(ENDP1, sendLength);
packetSent += sendLength;
SetEPTxValid(ENDP1);
}
return sendLength;
}
usb_prop.c
:
void __attribute__((optimize("O0"))) Virtual_Com_Port_Reset(void)
{
/* Set Virtual_Com_Port DEVICE as not configured */
pInformation->Current_Configuration = 0;
/* Current Feature initialization */
pInformation->Current_Feature = Virtual_Com_Port_ConfigDescriptor[7];
/* Set Virtual_Com_Port DEVICE with the default Interface*/
pInformation->Current_Interface = 0;
SetBTABLE(BTABLE_ADDRESS);
/* Initialize Endpoint 0 */
SetEPType(ENDP0, EP_CONTROL);
SetEPTxStatus(ENDP0, EP_TX_STALL);
SetEPRxAddr(ENDP0, ENDP0_RXADDR);
SetEPTxAddr(ENDP0, ENDP0_TXADDR);
Clear_Status_Out(ENDP0);
SetEPRxCount(ENDP0, Device_Property.MaxPacketSize);
SetEPRxValid(ENDP0);
/* Initialize Endpoint 1 */
SetEPType(ENDP1, EP_BULK);
SetEPTxAddr(ENDP1, ENDP1_TXADDR);
SetEPTxStatus(ENDP1, EP_TX_NAK);
SetEPRxStatus(ENDP1, EP_RX_DIS);
/* Initialize Endpoint 2 */
SetEPType(ENDP2, EP_INTERRUPT);
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
SetEPRxStatus(ENDP2, EP_RX_DIS);
SetEPTxStatus(ENDP2, EP_TX_NAK);
/* Initialize Endpoint 3 */
SetEPType(ENDP3, EP_BULK);
SetEPRxAddr(ENDP3, ENDP3_RXADDR);
SetEPRxCount(ENDP3, VIRTUAL_COM_PORT_DATA_SIZE);
SetEPRxStatus(ENDP3, EP_RX_VALID);
SetEPTxStatus(ENDP3, EP_TX_DIS);
/* Set this device to response on default address */
SetDeviceAddress(0);
bDeviceState = ATTACHED;
}
The variables in use seem to have the __IO
(which is #define
'd to mean volatile
) specifier, so I'm not sure what is going on...
from airdamon_f3.
It is interesting that if you let the compiler optimize out one/both of the above functions, nothing prints, but a delay is noticeable (as in issue #2) if you are not attempting to consume the data in miniterm.py
for example. As soon as you connect the delay in the blinking LED disappears, but you still cannot see anything being sent.
from airdamon_f3.
Related Issues (11)
- don't try and print if usb not connected for vcp
- SPI MPU6500 using DMA w/ Tx ISR: data is shifted HOT 2
- MPU6500 SPI DMA/ISR - if CLK is too slow, gyro data is corrupted
- std::function `-O0`
- VCP and MPU EXTI HOT 1
- VCP serial connection won't reconnect HOT 2
- USART Rx_DMA_IRQn vs USART_IT_RXNE HOT 1
- F4 USART gibberish HOT 1
- USART/DMA tx stream stuck
- I2C_SR1_AF doesn't get set until after I2C_SendData
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from airdamon_f3.